diff options
author | kondou <kondou@ts.unde.re> | 2013-07-04 14:28:12 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2014-09-09 17:26:11 +0200 |
commit | 69f2c0544e80ae1b47a715b3d8e586ac2bfffe98 (patch) | |
tree | 693f69163a366c209bf5e2ac6faab4dac05ea1a5 /core/js/maintenance-check.js | |
parent | dc99fd768ac99c380f1110c7bd4dd84d03256cd8 (diff) | |
download | nextcloud-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.js | 20 |
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(); + } + } + }; +} |