From bbf7f56f949f48ec0cf95d416b431d0cd739582f Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Tue, 17 Feb 2015 12:00:39 +0100 Subject: 3rd-party apps are disabled on upgrade - refs #14026 --- core/ajax/update.php | 26 ++++++++++++++++++-------- core/command/upgrade.php | 10 +++++++--- core/js/update.js | 3 +++ 3 files changed, 28 insertions(+), 11 deletions(-) (limited to 'core') diff --git a/core/ajax/update.php b/core/ajax/update.php index baa01b4f208..656fe2736ac 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -36,9 +36,12 @@ if (OC::checkUpgrade(false)) { $eventSource = \OC::$server->createEventSource(); $updater = new \OC\Updater( \OC::$server->getHTTPHelper(), - \OC::$server->getAppConfig(), + \OC::$server->getConfig(), \OC_Log::$object ); + $incompatibleApps = []; + $disabledThirdPartyApps = []; + $updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned on maintenance mode')); }); @@ -57,13 +60,11 @@ if (OC::checkUpgrade(false)) { $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updated "%s" to %s', array($app, $version))); }); - $updater->listen('\OC\Updater', 'disabledApps', function ($appList) use ($eventSource, $l) { - $list = array(); - foreach ($appList as $appId) { - $info = OC_App::getAppInfo($appId); - $list[] = $info['name'] . ' (' . $info['id'] . ')'; - } - $eventSource->send('success', (string)$l->t('Disabled incompatible apps: %s', implode(', ', $list))); + $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) { + $incompatibleApps[]= $app; + }); + $updater->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use (&$disabledThirdPartyApps) { + $disabledThirdPartyApps[]= $app; }); $updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource) { $eventSource->send('failure', $message); @@ -73,6 +74,15 @@ if (OC::checkUpgrade(false)) { $updater->upgrade(); + if (!empty($incompatibleApps)) { + $eventSource->send('notice', + (string)$l->t('Following incompatible apps have been disabled: %s', implode(', ', $incompatibleApps))); + } + if (!empty($disabledThirdPartyApps)) { + $eventSource->send('notice', + (string)$l->t('Following 3rd party apps have been disabled: %s', implode(', ', $disabledThirdPartyApps))); + } + $eventSource->send('done', ''); $eventSource->close(); } diff --git a/core/command/upgrade.php b/core/command/upgrade.php index 91e4c3c744a..8899bd50ba7 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -100,7 +100,8 @@ class Upgrade extends Command { if(\OC::checkUpgrade(false)) { $self = $this; - $updater = new Updater(\OC::$server->getHTTPHelper(), \OC::$server->getAppConfig()); + $updater = new Updater(\OC::$server->getHTTPHelper(), + \OC::$server->getConfig()); $updater->setSimulateStepEnabled($simulateStepEnabled); $updater->setUpdateStepEnabled($updateStepEnabled); @@ -122,8 +123,11 @@ class Upgrade extends Command { $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($output) { $output->writeln('Checked database schema update'); }); - $updater->listen('\OC\Updater', 'disabledApps', function ($appList) use($output) { - $output->writeln('Disabled incompatible apps: ' . implode(', ', $appList) . ''); + $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($output) { + $output->writeln('Disabled incompatible app: ' . $app . ''); + }); + $updater->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use($output) { + $output->writeln('Disabled 3rd-party app: ' . $app . ''); }); $updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) { diff --git a/core/js/update.js b/core/js/update.js index f63808f65be..60f04832935 100644 --- a/core/js/update.js +++ b/core/js/update.js @@ -38,6 +38,9 @@ updateEventSource.listen('success', function(message) { $('').append(message).append('
').appendTo($el); }); + updateEventSource.listen('notice', function(message) { + $('').addClass('error').append(message).append('
').appendTo($el); + }); updateEventSource.listen('error', function(message) { $('').addClass('error').append(message).append('
').appendTo($el); message = t('core', 'Please reload the page.'); -- cgit v1.2.3