mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
[WIP] upgrade app store apps during console upgrade
This commit is contained in:
parent
40b2889785
commit
0bd2b3cb0c
1 changed files with 21 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue