Skip to content
Draft
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
43 changes: 24 additions & 19 deletions lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1093,60 +1093,65 @@ public function setAppTypes(string $app, array $appData): void {
*/
#[\Override]
public function upgradeApp(string $appId): bool {
// for apps distributed with core, we refresh app path in case the downloaded version
// have been installed in custom apps and not in the default path
// For apps distributed with core, refresh the app path in case the downloaded
// version was installed in custom apps and not in the default path.
$appPath = $this->getAppPath($appId, true);

$this->clearAppsCache();

$appInfo = $this->getAppInfo($appId);
if ($appInfo === null) {
throw new AppPathNotFoundException('Could not find ' . $appId);
}

$ignoreMaxApps = $this->config->getSystemValue('app_install_overwrite', []);
$ignoreMax = in_array($appId, $ignoreMaxApps, true);

$this->checkAppDependencies($appId, $ignoreMax);

\OC_App::registerAutoloading($appId, $appPath, true);

$this->executeRepairSteps($appId, $appInfo['repair-steps']['pre-migration']);

$ms = new MigrationService($appId, Server::get(\OC\DB\Connection::class));
$ms->migrate();

$this->executeRepairSteps($appId, $appInfo['repair-steps']['post-migration']);
$queue = Server::get(IJobList::class);
foreach ($appInfo['repair-steps']['live-migration'] as $step) {
$queue->add(BackgroundRepair::class, [
'app' => $appId,
'step' => $step]);
}

// update appversion in app manager
// Refresh cached app metadata/version after the migration finished.
$this->clearAppsCache();
$this->getAppVersion($appId, false);
Comment on lines 1122 to 1123

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't believe these are necessary, but not being certain I left as-is.

Side note: clearAppsCache() is a bit of a misleading name since it doesn't cover all cached bits.


// Setup background jobs
foreach ($appInfo['background-jobs'] as $job) {
$queue->add($job);
}
$this->setAppTypes($appId, $appInfo);

//set remote/public handlers
// Set remote/public handlers.
foreach ($appInfo['remote'] as $name => $path) {
$this->config->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
}
foreach ($appInfo['public'] as $name => $path) {
$this->config->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
}

$this->setAppTypes($appId, $appInfo);
// Migrate eventual new config keys in the process.
/** @psalm-suppress InternalMethod */
$this->configManager->migrateConfigLexiconKeys($appId);
$this->configManager->updateLexiconEntries($appId);

$version = $this->getAppVersion($appId);
$this->config->setAppValue($appId, 'installed_version', $version);

// migrate eventual new config keys in the process
/** @psalm-suppress InternalMethod */
$this->configManager->migrateConfigLexiconKeys($appId);
$this->configManager->updateLexiconEntries($appId);
$queue = Server::get(IJobList::class);

foreach ($appInfo['repair-steps']['live-migration'] as $step) {
$queue->add(BackgroundRepair::class, [
'app' => $appId,
'step' => $step]);
}

// Set up background jobs.
foreach ($appInfo['background-jobs'] as $job) {
$queue->add($job);
}

$this->dispatcher->dispatchTyped(new AppUpdateEvent($appId));
$this->dispatcher->dispatch(ManagerEvent::EVENT_APP_UPDATE, new ManagerEvent(
Expand Down
Loading