diff --git a/lib/private/Installer.php b/lib/private/Installer.php index f3af74167d19f..b63619b821ca7 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -151,7 +151,7 @@ public function installApp(string $appId, bool $forceEnable = false): string { //install the database $ms = new MigrationService($info['id'], \OC::$server->get(Connection::class)); - $ms->migrate('latest', true); + $ms->migrate('latest', !$previousVersion); if ($previousVersion) { OC_App::executeRepairSteps($appId, $info['repair-steps']['post-migration']); @@ -597,8 +597,11 @@ public static function installShippedApp($app) { $appPath = OC_App::getAppPath($app); \OC_App::registerAutoloading($app, $appPath); + $config = \OC::$server->getConfig(); + $ms = new MigrationService($app, \OC::$server->get(Connection::class)); - $ms->migrate('latest', true); + $previousVersion = $config->getAppValue($app, 'installed_version', false); + $ms->migrate('latest', !$previousVersion); //run appinfo/install.php self::includeAppScript("$appPath/appinfo/install.php"); @@ -611,8 +614,6 @@ public static function installShippedApp($app) { OC_App::executeRepairSteps($app, $info['repair-steps']['install']); - $config = \OC::$server->getConfig(); - $config->setAppValue($app, 'installed_version', OC_App::getAppVersion($app)); if (array_key_exists('ocsid', $info)) { $config->setAppValue($app, 'ocsid', $info['ocsid']);