Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Dispatch upgradeAppStoreApps event" #27729

Merged
merged 3 commits into from
Oct 13, 2017
Merged
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
76 changes: 1 addition & 75 deletions lib/private/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,9 @@ private function doUpgrade($currentVersion, $installedVersion) {
throw new \Exception($e->getMessage());
}

// update all shipped apps
$disabledApps = $this->checkAppsRequirements();
// update all apps
$this->doAppUpgrade();

// upgrade appstore apps
$this->upgradeAppStoreApps($disabledApps);

// install new shipped apps on upgrade
OC_App::loadApps('authentication');
$errors = Installer::installShippedApps(true);
Expand Down Expand Up @@ -321,76 +317,6 @@ protected function doAppUpgrade() {
}
}

/**
* check if the current enabled apps are compatible with the current
* ownCloud version. disable them if not.
* This is important if you upgrade ownCloud and have non ported 3rd
* party apps installed.
*
* @return array
* @throws \Exception
*/
private function checkAppsRequirements() {
$isCoreUpgrade = $this->isCodeUpgrade();
$apps = OC_App::getEnabledApps();
$version = Util::getVersion();
$disabledApps = [];
foreach ($apps as $app) {
// check if the app is compatible with this version of ownCloud
$info = OC_App::getAppInfo($app);
if(!OC_App::isAppCompatible($version, $info)) {
OC_App::disable($app);
$disabledApps[]= $app;
$this->emit('\OC\Updater', 'incompatibleAppDisabled', [$app]);
continue;
}
// no need to disable any app in case this is a non-core upgrade
if (!$isCoreUpgrade) {
continue;
}
// shipped apps will remain enabled
if (OC_App::isShipped($app)) {
continue;
}
// authentication and session apps will remain enabled as well
if (OC_App::isType($app, ['session', 'authentication'])) {
continue;
}
}
return $disabledApps;
}

/**
* @return bool
*/
private function isCodeUpgrade() {
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
$currentVersion = implode('.', Util::getVersion());
if (version_compare($currentVersion, $installedVersion, '>')) {
return true;
}
return false;
}

/**
* @param array $disabledApps
* @throws \Exception
*/
private function upgradeAppStoreApps(array $disabledApps) {
$dispatcher = \OC::$server->getEventDispatcher();
foreach($disabledApps as $app) {
try {
$this->emit('\OC\Updater', 'upgradeAppStoreApp', [$app]);
$dispatcher->dispatch(
self::class . '::upgradeAppStoreApps',
new GenericEvent($app)
);
} catch (\Exception $ex) {
$this->log->logException($ex, ['app' => 'core']);
}
}
}

/**
* Forward messages emitted by the repair routine
*/
Expand Down