From 78ec7543d50ff3ab269e4d668730405841038c6b Mon Sep 17 00:00:00 2001
From: Morris Jobke <hey@morrisjobke.de>
Date: Wed, 8 Apr 2015 18:02:00 +0200
Subject: [PATCH] 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
---
 core/js/maintenance-check.js | 4 ++--
 status.php                   | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/js/maintenance-check.js b/core/js/maintenance-check.js
index 8ca00456fe..061a434214 100644
--- a/core/js/maintenance-check.js
+++ b/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();
 }
diff --git a/status.php b/status.php
index 1628e824e0..6e7bcea526 100644
--- a/status.php
+++ b/status.php
@@ -41,6 +41,7 @@ try {
 	if (OC::$CLI) {
 		print_r($values);
 	} else {
+		header('Content-Type: application/json');
 		echo json_encode($values);
 	}
 
-- 
GitLab