Merge pull request #8380 from nextcloud/bugfix/noid/reenable-disabled-apps

Re-enable apps that got automatically disabled while updating
This commit is contained in:
Morris Jobke 2018-07-25 11:37:10 +02:00 committed by GitHub
commit 7eb74186ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -254,6 +254,7 @@ class Updater extends BasicEmitter {
// upgrade appstore apps
$this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps());
$this->upgradeAppStoreApps(\OC_App::$autoDisabledApps, true);
// install new shipped apps on upgrade
OC_App::loadApps(['authentication']);
@ -434,9 +435,10 @@ class Updater extends BasicEmitter {
/**
* @param array $disabledApps
* @param bool $reenable
* @throws \Exception
*/
private function upgradeAppStoreApps(array $disabledApps) {
private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
foreach($disabledApps as $app) {
try {
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
@ -445,6 +447,11 @@ class Updater extends BasicEmitter {
$this->installer->updateAppstoreApp($app);
}
$this->emit('\OC\Updater', 'checkAppStoreApp', [$app]);
if ($reenable) {
$ocApp = new \OC_App();
$ocApp->enable($app);
}
} catch (\Exception $ex) {
$this->log->logException($ex, ['app' => 'core']);
}

View file

@ -70,6 +70,7 @@ class OC_App {
static private $loadedApps = [];
static private $altLogin = [];
static private $alreadyRegistered = [];
static public $autoDisabledApps = [];
const officialApp = 200;
/**
@ -156,6 +157,7 @@ class OC_App {
if (!\OC::$server->getAppManager()->isShipped($app)) {
// Only disable apps which are not shipped
\OC::$server->getAppManager()->disableApp($app);
self::$autoDisabledApps[] = $app;
}
}
\OC::$server->getEventLogger()->end('load_app_' . $app);