mirror of
https://github.com/nextcloud/server.git
synced 2026-05-21 01:25:29 -04:00
Merge pull request #29303 from nextcloud/backport/29259/stable20
[stable20] Fix app upgrade
This commit is contained in:
commit
b0f4d1984b
1 changed files with 10 additions and 8 deletions
|
|
@ -268,7 +268,9 @@ class Updater extends BasicEmitter {
|
|||
// upgrade appstore apps
|
||||
$this->upgradeAppStoreApps($appManager->getInstalledApps());
|
||||
$autoDisabledApps = $appManager->getAutoDisabledApps();
|
||||
$this->upgradeAppStoreApps($autoDisabledApps, true);
|
||||
if (!empty($autoDisabledApps)) {
|
||||
$this->upgradeAppStoreApps(array_keys($autoDisabledApps), $autoDisabledApps);
|
||||
}
|
||||
|
||||
// install new shipped apps on upgrade
|
||||
$errors = Installer::installShippedApps(true);
|
||||
|
|
@ -448,12 +450,12 @@ class Updater extends BasicEmitter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $disabledApps
|
||||
* @param bool $reenable
|
||||
* @param array $apps
|
||||
* @param array $previousEnableStates
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
|
||||
foreach ($disabledApps as $app => $previousEnableSetting) {
|
||||
private function upgradeAppStoreApps(array $apps, array $previousEnableStates = []) {
|
||||
foreach ($apps as $app) {
|
||||
try {
|
||||
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
|
||||
if ($this->installer->isUpdateAvailable($app)) {
|
||||
|
|
@ -462,10 +464,10 @@ class Updater extends BasicEmitter {
|
|||
}
|
||||
$this->emit('\OC\Updater', 'checkAppStoreApp', [$app]);
|
||||
|
||||
if ($reenable) {
|
||||
if (!empty($previousEnableStates)) {
|
||||
$ocApp = new \OC_App();
|
||||
if (!empty($previousEnableSetting)) {
|
||||
$ocApp->enable($app, $previousEnableSetting);
|
||||
if (!empty($previousEnableStates[$app])) {
|
||||
$ocApp->enable($app, $previousEnableStates[$app]);
|
||||
} else {
|
||||
$ocApp->enable($app);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue