summaryrefslogtreecommitdiffstats
path: root/core/js/maintenance-check.js
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-07-04 14:28:12 +0200
committerkondou <kondou@ts.unde.re>2014-09-09 17:26:11 +0200
commit69f2c0544e80ae1b47a715b3d8e586ac2bfffe98 (patch)
tree693f69163a366c209bf5e2ac6faab4dac05ea1a5 /core/js/maintenance-check.js
parentdc99fd768ac99c380f1110c7bd4dd84d03256cd8 (diff)
downloadnextcloud-server-69f2c0544e80ae1b47a715b3d8e586ac2bfffe98.tar.gz
nextcloud-server-69f2c0544e80ae1b47a715b3d8e586ac2bfffe98.zip
Refresh if maintenance mode is over
Using status.php for this. I modified status.php to also show, whether we're in maintenance. Checks every 20 seconds if maintenance is over, if yes: reload.
Diffstat (limited to 'core/js/maintenance-check.js')
-rw-r--r--core/js/maintenance-check.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/js/maintenance-check.js b/core/js/maintenance-check.js
new file mode 100644
index 00000000000..8ca00456fef
--- /dev/null
+++ b/core/js/maintenance-check.js
@@ -0,0 +1,20 @@
+// Check every 20 seconds via status.php if maintenance is over
+window.setInterval(checkStatus, 20000);
+
+function checkStatus() {
+ var request = new XMLHttpRequest();
+ var ocroot = location.pathname.substr(
+ 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') {
+ window.location.reload();
+ }
+ }
+ };
+}