]> source.dussan.org Git - nextcloud-server.git/commitdiff
Refresh if maintenance mode is over
authorkondou <kondou@ts.unde.re>
Thu, 4 Jul 2013 12:28:12 +0000 (14:28 +0200)
committerkondou <kondou@ts.unde.re>
Tue, 9 Sep 2014 15:26:11 +0000 (17:26 +0200)
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.

core/js/maintenance-check.js [new file with mode: 0644]
core/templates/update.user.php
lib/base.php
status.php

diff --git a/core/js/maintenance-check.js b/core/js/maintenance-check.js
new file mode 100644 (file)
index 0000000..8ca0045
--- /dev/null
@@ -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();
+                       }
+               }
+       };
+}
index bb93f0fad0080b662d112e6bfe49dea76dd1ac40..77a5892e174ea8e9424276880cb012a126fe7b9c 100644 (file)
@@ -1,7 +1,7 @@
 <ul>
        <li class='update'>
                <?php p($l->t('This ownCloud instance is currently being updated, which may take a while.')) ?><br/><br/>
-               <?php p($l->t('Please reload this page after a short time to continue using ownCloud.')) ?><br/><br/>
+               <?php p($l->t('This page will refresh itself when the ownCloud instance is available again.')) ?><br/><br/>
                <?php p($l->t('Contact your system administrator if this message persists or appeared unexpectedly.')) ?><br/><br/>
                <?php p($l->t('Thank you for your patience.')); ?><br/><br/>
        </li>
index 5d52db68cb7730b28395ccee70f34a977d181e4c..c113ed3b50643c2a1d938848adeb3570f491e03c 100644 (file)
@@ -255,6 +255,7 @@ class OC {
 
                        // render error page
                        $tmpl = new OC_Template('', 'update.user', 'guest');
+                       OC_Util::addscript('maintenance-check');
                        $tmpl->printPage();
                        die();
                }
index a42c1581b837cce7e270acb41ea7301f4bcf3231..db5813814d0442b254bdfb79221b766bfe1deb9a 100644 (file)
@@ -25,9 +25,11 @@ try {
 
        require_once 'lib/base.php';
 
-       if(OC_Config::getValue('installed')==1) $installed='true'; else $installed='false';
+       $installed = OC_Config::getValue('installed') == 1;
+       $maintenance = OC_Config::getValue('maintenance', false);
        $values=array(
                'installed'=>$installed,
+               'maintenance' => $maintenance,
                'version'=>implode('.', OC_Util::getVersion()),
                'versionstring'=>OC_Util::getVersionString(),
                'edition'=>OC_Util::getEditionString());