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:
authorLukas Reschke <lukas@owncloud.com>2015-02-17 16:48:09 +0300
committerLukas Reschke <lukas@owncloud.com>2015-02-17 16:48:09 +0300
commit431638742c50d7054959e86bbad514d97243f512 (patch)
treea68975a5244e7961e136a437220ce81be01d3fd2
parent7b432cbbf7ce5d9a22881ba959261f6c2a21ce5e (diff)
parent61852536fee1d9eacc4475edf91ecfb90a56388e (diff)
Merge pull request #14040 from owncloud/stable7-app-upgrade-order
[Stable7] app upgrade order fix
-rw-r--r--lib/private/updater.php40
1 files changed, 37 insertions, 3 deletions
diff --git a/lib/private/updater.php b/lib/private/updater.php
index be294c165b4..c6c2ad2257d 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);
+ }
}
}
}