Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-07-04 16:28:12 +0400
committerkondou <kondou@ts.unde.re>2014-09-09 19:26:11 +0400
commit69f2c0544e80ae1b47a715b3d8e586ac2bfffe98 (patch)
tree693f69163a366c209bf5e2ac6faab4dac05ea1a5
parentdc99fd768ac99c380f1110c7bd4dd84d03256cd8 (diff)
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.
-rw-r--r--core/js/maintenance-check.js20
-rw-r--r--core/templates/update.user.php2
-rw-r--r--lib/base.php1
-rw-r--r--status.php4
4 files changed, 25 insertions, 2 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();
+ }
+ }
+ };
+}
diff --git a/core/templates/update.user.php b/core/templates/update.user.php
index bb93f0fad00..77a5892e174 100644
--- a/core/templates/update.user.php
+++ b/core/templates/update.user.php
@@ -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>
diff --git a/lib/base.php b/lib/base.php
index 5d52db68cb7..c113ed3b506 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -255,6 +255,7 @@ class OC {
// render error page
$tmpl = new OC_Template('', 'update.user', 'guest');
+ OC_Util::addscript('maintenance-check');
$tmpl->printPage();
die();
}
diff --git a/status.php b/status.php
index a42c1581b83..db5813814d0 100644
--- a/status.php
+++ b/status.php
@@ -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());