From ea9f2361ae5691a8d0eae8b38cd7e2fad55bdd55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 18 Jun 2024 11:55:08 +0200 Subject: [PATCH] perf: Avoid reusing previous migration steps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Repair.php | 2 ++ lib/private/legacy/OC_App.php | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/private/Repair.php b/lib/private/Repair.php index b265d5767eabc..d8a110d5a20c7 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -102,6 +102,8 @@ public function run() { $this->dispatcher->dispatchTyped(new RepairErrorEvent($e->getMessage())); } } + + $this->repairSteps = []; } /** diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index c9d1f86cb0e81..cb1a7b111c61e 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -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 @@ -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