diff --git a/includes/assets/css/default.css b/includes/assets/css/default.css index a478bc95..7234d370 100644 --- a/includes/assets/css/default.css +++ b/includes/assets/css/default.css @@ -12,3 +12,10 @@ .ui.modal > .actions { text-align: inherit; } + +/** + * Progress + */ +.ui.progress.nolabel:last-child { + margin: 0; +} diff --git a/includes/assets/js/update.js b/includes/assets/js/update.js new file mode 100644 index 00000000..18d648d0 --- /dev/null +++ b/includes/assets/js/update.js @@ -0,0 +1,28 @@ +$(function() { + const urlParams = new URLSearchParams(window.location.search); + + var retryIn = urlParams.has('interval') ? urlParams.get('interval') : 5; + var value = 0; + var total = retryIn * 1000; + + $('#retryIn').html(retryIn); + + setTimeout(function step() { + $('.ui.progress').progress({ + total: total, + value: value + }); + + if (value >= total) { + setTimeout(function() { + urlParams.set('interval', parseInt(retryIn) + 5); + + window.location.href = window.location.origin + '/?' + urlParams.toString(); + }, 1000); + } else { + value += 100; + + setTimeout(step, 100); + } + }, 100) +}); diff --git a/includes/pages/update.php b/includes/pages/update.php new file mode 100644 index 00000000..06ebad6a --- /dev/null +++ b/includes/pages/update.php @@ -0,0 +1,41 @@ + + */ + +use wishthis\{Page, User}; + +$page = new page(__FILE__, 'Update'); +$page->header(); +$page->navigation(); +?> + +
+
+

title ?>

+ + isLoggedIn()) { ?> + +
+

Maintenance

+

+ The administrator of this site is currently running an update. + This usually just takes a couple of seconds. +

+

+ Trying again in 5 seconds... +

+
+
+
+
+ +
+
+ +footer(); +?> diff --git a/index.php b/index.php index 00d816a5..5a25bc0d 100644 --- a/index.php +++ b/index.php @@ -73,6 +73,7 @@ if (!$options) { if ($options) { if (-1 === version_compare($options->version, '0.2.0')) { $options->updateAvailable = true; + $page = 'update'; } } @@ -92,5 +93,6 @@ if (file_exists($pagePath)) {

Not found

The requested URL was not found on this server.