Skip to content
Snippets Groups Projects
Commit 7ada4125 authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

Port of #14041 to master

on ownCloud upgrade: upgrade all apps in order, load important ones

Fix "other" app update stack
parent 0e47d1fc
No related branches found
No related tags found
No related merge requests found
...@@ -291,13 +291,47 @@ class Updater extends BasicEmitter { ...@@ -291,13 +291,47 @@ class Updater extends BasicEmitter {
include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php'; 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() { protected function doAppUpgrade() {
$apps = \OC_App::getEnabledApps(); $apps = \OC_App::getEnabledApps();
$priorityTypes = array('authentication', 'filesystem', 'logging');
$pseudoOtherType = 'other';
$stacks = array($pseudoOtherType => array());
foreach ($apps as $appId) { foreach ($apps as $appId) {
if (\OC_App::shouldUpgrade($appId)) { $priorityType = false;
\OC_App::updateApp($appId); foreach ($priorityTypes as $type) {
$this->emit('\OC\Updater', 'appUpgrade', array($appId, \OC_App::getAppVersion($appId))); 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);
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment