From d9d7774cc14bed8987e050f134a3ce8e67e1af75 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 3 Feb 2015 19:02:25 +0100 Subject: on ownCloud upgrade: upgrade all apps in order, load important ones --- lib/private/updater.php | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/lib/private/updater.php b/lib/private/updater.php index be294c165b4..83defc7972c 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -298,13 +298,47 @@ class Updater extends BasicEmitter { include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php'; } + + /** + * upgrades all apps within a major ownCloud upgrade. Also loads "priority" + * (types authentication, filesystem, logging, in that order) afterwards. + * + * @throws NeedsUpdateException + */ protected function doAppUpgrade() { $apps = \OC_App::getEnabledApps(); + $priorityTypes = array('authentication', 'filesystem', 'logging'); + $pseudoOtherType = 'other'; + $stacks = array($pseudoOtherType => array()); foreach ($apps as $appId) { - if (\OC_App::shouldUpgrade($appId)) { - \OC_App::updateApp($appId); - $this->emit('\OC\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId))); + $priorityType = false; + foreach ($priorityTypes as $type) { + if(!isset($stacks[$type])) { + $stacks[$type] = array(); + } + if (\OC_App::isType($appId, $type)) { + $stacks[$type][] = $appId; + $priorityType = true; + break; + } + } + if (!$priorityType) { + $stacks[$pseudoOtherType] = $appId; + } + } + foreach ($stacks as $type => $stack) { + foreach ($stack as $appId) { + if (\OC_App::shouldUpgrade($appId)) { + \OC_App::updateApp($appId); + $this->emit('\OC\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId))); + } + if($type !== $pseudoOtherType) { + // load authentication, filesystem and logging apps after + // upgrading them. Other apps my need to rely on modifying + // user and/or filesystem aspects. + \OC_App::loadApp($appId, false); + } } } } -- cgit v1.2.3 From 61852536fee1d9eacc4475edf91ecfb90a56388e Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 5 Feb 2015 18:44:44 +0100 Subject: Fix "other" app update stack --- lib/private/updater.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/updater.php b/lib/private/updater.php index 83defc7972c..c6c2ad2257d 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -324,7 +324,7 @@ class Updater extends BasicEmitter { } } if (!$priorityType) { - $stacks[$pseudoOtherType] = $appId; + $stacks[$pseudoOtherType][] = $appId; } } foreach ($stacks as $type => $stack) { -- cgit v1.2.3