Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,11 @@ public function disableApp($appId, $automaticDisabled = false) {
}

if ($automaticDisabled) {
$this->autoDisabledApps[] = $appId;
$previousSetting = $this->appConfig->getValue($appId, 'enabled', 'yes');
if ($previousSetting !== 'yes' && $previousSetting !== 'no') {
$previousSetting = json_decode($previousSetting, true);
}
$this->autoDisabledApps[$appId] = $previousSetting;
}

unset($this->installedAppsCache[$appId]);
Expand Down
17 changes: 13 additions & 4 deletions lib/private/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
*/
namespace OC;

use OC\App\AppManager;
use OC\DB\Connection;
use OC\DB\MigrationService;
use OC\Hooks\BasicEmitter;
use OC\IntegrityCheck\Checker;
use OC_App;
use OCP\App\IAppManager;
use OCP\HintException;
use OCP\IConfig;
use OCP\ILogger;
Expand Down Expand Up @@ -265,9 +267,12 @@ private function doUpgrade(string $currentVersion, string $installedVersion): vo
// Update the appfetchers version so it downloads the correct list from the appstore
\OC::$server->getAppFetcher()->setVersion($currentVersion);

/** @var IAppManager|AppManager $appManager */
$appManager = \OC::$server->getAppManager();

// upgrade appstore apps
$this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps());
$autoDisabledApps = \OC::$server->getAppManager()->getAutoDisabledApps();
$this->upgradeAppStoreApps($appManager->getInstalledApps());
$autoDisabledApps = $appManager->getAutoDisabledApps();
$this->upgradeAppStoreApps($autoDisabledApps, true);

// install new shipped apps on upgrade
Expand Down Expand Up @@ -400,7 +405,7 @@ private function isCodeUpgrade(): bool {
* @throws \Exception
*/
private function upgradeAppStoreApps(array $disabledApps, bool $reenable = false): void {
foreach ($disabledApps as $app) {
foreach ($disabledApps as $app => $previousEnableSetting) {
try {
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
if ($this->installer->isUpdateAvailable($app)) {
Expand All @@ -411,7 +416,11 @@ private function upgradeAppStoreApps(array $disabledApps, bool $reenable = false

if ($reenable) {
$ocApp = new \OC_App();
$ocApp->enable($app);
if (!empty($previousEnableSetting)) {
$ocApp->enable($app, $previousEnableSetting);
} else {
$ocApp->enable($app);
}
}
} catch (\Exception $ex) {
$this->log->error($ex->getMessage(), [
Expand Down
6 changes: 0 additions & 6 deletions lib/public/App/IAppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,6 @@ public function getAlwaysEnabledApps();
*/
public function getEnabledAppsForGroup(IGroup $group): array;

/**
* @return array
* @since 17.0.0
*/
public function getAutoDisabledApps(): array;

/**
* @param String $appId
* @return string[]
Expand Down