Skip to content

Commit acaf214

Browse files
nickvergessenjuliusknorr
authored andcommitted
Run migrations fully when reenabling an app
Signed-off-by: Joas Schilling <[email protected]>
1 parent 0f9dff1 commit acaf214

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/private/Installer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function installApp(string $appId, bool $forceEnable = false): string {
151151

152152
//install the database
153153
$ms = new MigrationService($info['id'], \OC::$server->get(Connection::class));
154-
$ms->migrate('latest', true);
154+
$ms->migrate('latest', !$previousVersion);
155155

156156
if ($previousVersion) {
157157
OC_App::executeRepairSteps($appId, $info['repair-steps']['post-migration']);
@@ -597,8 +597,11 @@ public static function installShippedApp($app) {
597597
$appPath = OC_App::getAppPath($app);
598598
\OC_App::registerAutoloading($app, $appPath);
599599

600+
$config = \OC::$server->getConfig();
601+
600602
$ms = new MigrationService($app, \OC::$server->get(Connection::class));
601-
$ms->migrate('latest', true);
603+
$previousVersion = $config->getAppValue($app, 'installed_version', false);
604+
$ms->migrate('latest', !$previousVersion);
602605

603606
//run appinfo/install.php
604607
self::includeAppScript("$appPath/appinfo/install.php");
@@ -611,8 +614,6 @@ public static function installShippedApp($app) {
611614

612615
OC_App::executeRepairSteps($app, $info['repair-steps']['install']);
613616

614-
$config = \OC::$server->getConfig();
615-
616617
$config->setAppValue($app, 'installed_version', OC_App::getAppVersion($app));
617618
if (array_key_exists('ocsid', $info)) {
618619
$config->setAppValue($app, 'ocsid', $info['ocsid']);

0 commit comments

Comments
 (0)