maintenance-check.js 487 B

123456789101112131415161718
  1. // Check every 20 seconds via status.php if maintenance is over
  2. window.setInterval(checkStatus, 20000);
  3. function checkStatus() {
  4. var request = new XMLHttpRequest();
  5. request.open("GET", OC.webroot+'/status.php', true);
  6. request.onreadystatechange = function() {
  7. if (request.readyState === 4) {
  8. var response = request.responseText;
  9. var responseobj = JSON.parse(response);
  10. if (responseobj.maintenance === false) {
  11. window.location.reload();
  12. }
  13. }
  14. };
  15. request.send();
  16. }