summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-02-19 15:49:30 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-02-19 15:49:30 +0100
commit6e4fa80fe6d29c2967e2a11120a08663a2ad0aaa (patch)
tree7398958ffb4ab5e229589f7adbb4832b5fe4bb7c
parent0e47d1fcca879234e57e5ebde184fbbffd7266db (diff)
parent7ada41259c2d02b7bb38ce1b669f034be015a62d (diff)
downloadnextcloud-server-6e4fa80fe6d29c2967e2a11120a08663a2ad0aaa.tar.gz
nextcloud-server-6e4fa80fe6d29c2967e2a11120a08663a2ad0aaa.zip
Merge pull request #14377 from owncloud/port-14041
Port of #14041 to master
-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 fb41e2d36f0..c120d55b6f7 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -291,13 +291,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);
+ }
}
}
}