From 06ddd4088635e47f4fe08b26e8b8a41c9786bc92 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 13 Oct 2015 17:34:13 +0200 Subject: [PATCH 1/2] Prevent leaving the DB update page while in progress --- core/js/update.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/js/update.js b/core/js/update.js index bc8df0e20c0..7cf9b558c22 100644 --- a/core/js/update.js +++ b/core/js/update.js @@ -27,6 +27,11 @@ this.$el = $el; this._started = true; + + $(window).on('beforeunload.inprogress', function () { + return t('core', 'The upgrade is in progress, leaving this page might interrupt the process in some environments.'); + }); + this.addMessage(t( 'core', 'Updating {productName} to version {version}, this may take a while.', { @@ -61,6 +66,8 @@ .appendTo($el); }); updateEventSource.listen('done', function() { + $(window).off('beforeunload.inprogress'); + if (hasWarnings) { $('').addClass('bold') .append('
') From 1e64968ff7cf24ba9f59a528237163d412fa501c Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 14 Oct 2015 10:04:20 +0200 Subject: [PATCH 2/2] Allow leaving update page when errors occurred --- core/js/update.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/js/update.js b/core/js/update.js index 7cf9b558c22..090f8fa5d23 100644 --- a/core/js/update.js +++ b/core/js/update.js @@ -51,12 +51,14 @@ }); updateEventSource.listen('error', function(message) { message = message || t('core', 'An error occurred.'); + $(window).off('beforeunload.inprogress'); $('').addClass('error').append(message).append('
').appendTo($el); message = t('core', 'Please reload the page.'); $('').addClass('error').append(''+message+'
').appendTo($el); updateEventSource.close(); }); updateEventSource.listen('failure', function(message) { + $(window).off('beforeunload.inprogress'); $('').addClass('error').append(message).append('
').appendTo($el); $('') .addClass('bold')