Skip to content

Commit

Permalink
Simplify app upgrade. Incompatible apps are blocked with a repair step
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Oct 12, 2017
1 parent eec2b19 commit f46cb38
Showing 1 changed file with 1 addition and 54 deletions.
55 changes: 1 addition & 54 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,55 +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() {
$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)) {
$disabledApps = OC_App::disable($app);
$this->emit('\OC\Updater', 'incompatibleAppDisabled', [$app]);
}
}
return $disabledApps;
}


/**
* @param array $disabledApps
* @throws \Exception
*/
private function upgradeAppStoreApps(array $disabledApps) {

//
// TODO: integrate market app in here
//

// foreach($disabledApps as $app) {
// try {
// if (Installer::isUpdateAvailable($app)) {
// $ocsId = \OC::$server->getConfig()->getAppValue($app, 'ocsid', '');
//
// $this->emit('\OC\Updater', 'upgradeAppStoreApp', [$app]);
// Installer::updateAppByOCSId($ocsId);
// }
// } catch (\Exception $ex) {
// $this->log->logException($ex, ['app' => 'core']);
// }
// }
}

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

0 comments on commit f46cb38

Please sign in to comment.