|
|
|
@ -40,11 +40,13 @@ declare(strict_types=1);
|
|
|
|
|
*/
|
|
|
|
|
namespace OC;
|
|
|
|
|
|
|
|
|
|
use OC\App\AppManager;
|
|
|
|
|
use OC\DB\Connection;
|
|
|
|
|
use OC\DB\MigrationService;
|
|
|
|
|
use OC\Hooks\BasicEmitter;
|
|
|
|
|
use OC\IntegrityCheck\Checker;
|
|
|
|
|
use OC_App;
|
|
|
|
|
use OCP\App\IAppManager;
|
|
|
|
|
use OCP\IConfig;
|
|
|
|
|
use OCP\ILogger;
|
|
|
|
|
use OCP\Util;
|
|
|
|
@ -264,9 +266,12 @@ class Updater extends BasicEmitter {
|
|
|
|
|
// Update the appfetchers version so it downloads the correct list from the appstore
|
|
|
|
|
\OC::$server->getAppFetcher()->setVersion($currentVersion);
|
|
|
|
|
|
|
|
|
|
/** @var IAppManager|AppManager $appManager */
|
|
|
|
|
$appManager = \OC::$server->getAppManager();
|
|
|
|
|
|
|
|
|
|
// upgrade appstore apps
|
|
|
|
|
$this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps());
|
|
|
|
|
$autoDisabledApps = \OC::$server->getAppManager()->getAutoDisabledApps();
|
|
|
|
|
$this->upgradeAppStoreApps($appManager->getInstalledApps());
|
|
|
|
|
$autoDisabledApps = $appManager->getAutoDisabledApps();
|
|
|
|
|
$this->upgradeAppStoreApps($autoDisabledApps, true);
|
|
|
|
|
|
|
|
|
|
// install new shipped apps on upgrade
|
|
|
|
@ -414,7 +419,7 @@ class Updater extends BasicEmitter {
|
|
|
|
|
* @throws \Exception
|
|
|
|
|
*/
|
|
|
|
|
private function upgradeAppStoreApps(array $disabledApps, bool $reenable = false): void {
|
|
|
|
|
foreach ($disabledApps as $app) {
|
|
|
|
|
foreach ($disabledApps as $app => $previousEnableSetting) {
|
|
|
|
|
try {
|
|
|
|
|
$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
|
|
|
|
|
if ($this->installer->isUpdateAvailable($app)) {
|
|
|
|
@ -425,7 +430,11 @@ class Updater extends BasicEmitter {
|
|
|
|
|
|
|
|
|
|
if ($reenable) {
|
|
|
|
|
$ocApp = new \OC_App();
|
|
|
|
|
$ocApp->enable($app);
|
|
|
|
|
if (!empty($previousEnableSetting)) {
|
|
|
|
|
$ocApp->enable($app, $previousEnableSetting);
|
|
|
|
|
} else {
|
|
|
|
|
$ocApp->enable($app);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (\Exception $ex) {
|
|
|
|
|
$this->log->error($ex->getMessage(), [
|
|
|
|
|