Skip to content

Commit

Permalink
Merge pull request #45945 from nextcloud/perf/upgrade-reset-steps
Browse files Browse the repository at this point in the history
perf: Avoid reusing previous migration steps
  • Loading branch information
st3iny authored Jun 18, 2024
2 parents ae4a64b + ea9f236 commit 4e840fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/private/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public function run() {
$this->dispatcher->dispatchTyped(new RepairErrorEvent($e->getMessage()));
}
}

$this->repairSteps = [];
}

/**
Expand Down
8 changes: 5 additions & 3 deletions lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
use OCP\Authentication\IAlternativeLogin;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IAppConfig;
use OCP\Server;
use Psr\Container\ContainerExceptionInterface;
use Psr\Log\LoggerInterface;
use function OCP\Log\logger;

/**
* This class manages the apps. It allows them to register and integrate in the
Expand Down Expand Up @@ -777,16 +779,16 @@ public static function executeRepairSteps(string $appId, array $steps) {
// load the app
self::loadApp($appId);

$dispatcher = \OC::$server->get(IEventDispatcher::class);
$dispatcher = Server::get(IEventDispatcher::class);

// load the steps
$r = \OCP\Server::get(Repair::class);
$r = Server::get(Repair::class);
foreach ($steps as $step) {
try {
$r->addStep($step);
} catch (Exception $ex) {
$dispatcher->dispatchTyped(new RepairErrorEvent($ex->getMessage()));
\OC::$server->getLogger()->logException($ex);
logger('core')->error('Failed to add app migration step ' . $step, ['exception' => $ex]);
}
}
// run the steps
Expand Down

0 comments on commit 4e840fb

Please sign in to comment.