diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-13 14:16:16 +0300 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-03-13 14:16:16 +0300 |
commit | 0bd2b3cb0ca24f115655c4f46eac8b58b8d09637 (patch) | |
tree | 7bc6ad4a8670973b70874da578a6eedb203f5a80 /lib/private/updater.php | |
parent | 40b28897857cf81bafb23223a7a34fd19de02b13 (diff) |
[WIP] upgrade app store apps during console upgrade
Diffstat (limited to 'lib/private/updater.php')
-rw-r--r-- | lib/private/updater.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/private/updater.php b/lib/private/updater.php index 4d813ee3d39..11e1d63a52a 100644 --- a/lib/private/updater.php +++ b/lib/private/updater.php @@ -10,6 +10,7 @@ namespace OC; use OC\Hooks\BasicEmitter; use OC_App; +use OC_Installer; use OC_Util; use OCP\IConfig; use OC\Setup; @@ -233,9 +234,14 @@ class Updater extends BasicEmitter { if ($this->updateStepEnabled) { $this->doCoreUpgrade(); - $this->checkAppsRequirements(); + // update all shipped apps + $disabledApps = $this->checkAppsRequirements(); $this->doAppUpgrade(); + // upgrade appstore apps + $this->upgradeAppStoreApps($disabledApps); + + // post-upgrade repairs $repair = new Repair(Repair::getRepairSteps()); $this->emitRepairMessages($repair); @@ -356,6 +362,7 @@ class Updater extends BasicEmitter { $isCoreUpgrade = $this->isCodeUpgrade(); $apps = OC_App::getEnabledApps(); $version = OC_Util::getVersion(); + $disabledApps = []; foreach ($apps as $app) { // check if the app is compatible with this version of ownCloud $info = OC_App::getAppInfo($app); @@ -378,8 +385,10 @@ class Updater extends BasicEmitter { // disable any other 3rd party apps \OC_App::disable($app); + $disabledApps[]= $app; $this->emit('\OC\Updater', 'thirdPartyAppDisabled', array($app)); } + return $disabledApps; } private function isCodeUpgrade() { @@ -390,5 +399,16 @@ class Updater extends BasicEmitter { } return false; } + + private function upgradeAppStoreApps($disabledApps) { + foreach($disabledApps as $app) { + if (OC_Installer::isUpdateAvailable($app)) { + $ocsId=\OC::$server->getConfig()->getAppValue($app, 'ocsid', ''); + + $this->emit('\OC\Updater', 'upgradeAppStoreApp', array($app)); + OC_Installer::updateAppByOCSId($ocsId); + } + } + } } |