Browse Source

Fix maintenance refresh interval

* fix XMLHttpRequest - send after callback is registered
* check for correct type of value - it's a boolean
* return correct content-type in status.php
Morris Jobke 9 years ago
parent
commit
78ec7543d5
2 changed files with 3 additions and 2 deletions
  1. 2 2
      core/js/maintenance-check.js
  2. 1 0
      status.php

+ 2 - 2
core/js/maintenance-check.js

@@ -7,14 +7,14 @@ function checkStatus() {
 		0, location.pathname.indexOf('index.php')
 	);
 	request.open("GET", ocroot+'status.php', true);
-	request.send();
 	request.onreadystatechange = function() {
 		if (request.readyState === 4) {
 			var response = request.responseText;
 			var responseobj = JSON.parse(response);
-			if (responseobj.maintenance === 'false') {
+			if (responseobj.maintenance === false) {
 				window.location.reload();
 			}
 		}
 	};
+	request.send();
 }

+ 1 - 0
status.php

@@ -41,6 +41,7 @@ try {
 	if (OC::$CLI) {
 		print_r($values);
 	} else {
+		header('Content-Type: application/json');
 		echo json_encode($values);
 	}