Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Run migrations fully when reenabling an app
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and juliusknorr committed Dec 29, 2021
commit acaf214b674aa11e300b3fc8136de1073e4f37ef
9 changes: 5 additions & 4 deletions lib/private/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code scanning - InvalidArgument - Error
Argument 3 of OCP\IConfig::getAppValue cannot be false, string value expected

While that is right with the docs, it's wrong with the signatures of the methods and actually used like this in several places, including same file line 147. So I vote to dismiss the warning here

$ms->migrate('latest', !$previousVersion);

//run appinfo/install.php
self::includeAppScript("$appPath/appinfo/install.php");
Expand All @@ -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']);
Expand Down