diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Migration/BackgroundRepair.php | 3 | ||||
-rw-r--r-- | lib/private/Repair.php | 7 | ||||
-rw-r--r-- | lib/private/Updater.php | 5 | ||||
-rw-r--r-- | lib/private/legacy/OC_App.php | 3 |
4 files changed, 13 insertions, 5 deletions
diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php index 5b8c7875ab7..749a1a1bc69 100644 --- a/lib/private/Migration/BackgroundRepair.php +++ b/lib/private/Migration/BackgroundRepair.php @@ -33,6 +33,7 @@ use OC\Repair; use OC_App; use OCP\BackgroundJob\IJobList; use OCP\ILogger; +use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** @@ -92,7 +93,7 @@ class BackgroundRepair extends TimedJob { } $step = $argument['step']; - $repair = new Repair([], $this->dispatcher); + $repair = new Repair([], $this->dispatcher, \OC::$server->get(LoggerInterface::class)); try { $repair->addStep($step); } catch (\Exception $ex) { diff --git a/lib/private/Repair.php b/lib/private/Repair.php index 22a715caf1d..353f6c855bc 100644 --- a/lib/private/Repair.php +++ b/lib/private/Repair.php @@ -76,6 +76,7 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\Collaboration\Resources\IManager; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; +use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; @@ -90,15 +91,18 @@ class Repair implements IOutput { /** @var string */ private $currentStep; + private $logger; + /** * Creates a new repair step runner * * @param IRepairStep[] $repairSteps array of RepairStep instances * @param EventDispatcherInterface $dispatcher */ - public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher) { + public function __construct(array $repairSteps, EventDispatcherInterface $dispatcher, LoggerInterface $logger) { $this->repairSteps = $repairSteps; $this->dispatcher = $dispatcher; + $this->logger = $logger; } /** @@ -117,6 +121,7 @@ class Repair implements IOutput { try { $step->run($this); } catch (\Exception $e) { + $this->logger->error("Exception while executing repair step " . $step->getName(), ['exception' => $e]); $this->emit('\OC\Repair', 'error', [$e->getMessage()]); } } diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 65e2c9bd57f..f6ba27991e7 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -45,6 +45,7 @@ use OC_App; use OCP\IConfig; use OCP\ILogger; use OCP\Util; +use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\GenericEvent; /** @@ -243,7 +244,7 @@ class Updater extends BasicEmitter { file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); // pre-upgrade repairs - $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher()); + $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher(), \OC::$server->get(LoggerInterface::class)); $repair->run(); $this->doCoreUpgrade(); @@ -276,7 +277,7 @@ class Updater extends BasicEmitter { } // post-upgrade repairs - $repair = new Repair(Repair::getRepairSteps(), \OC::$server->getEventDispatcher()); + $repair = new Repair(Repair::getRepairSteps(), \OC::$server->getEventDispatcher(), \OC::$server->get(LoggerInterface::class)); $repair->run(); //Invalidate update feed diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index d48d6c40810..aeaaf3bf1ea 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -61,6 +61,7 @@ use OCP\App\ManagerEvent; use OCP\AppFramework\QueryException; use OCP\Authentication\IAlternativeLogin; use OCP\ILogger; +use Psr\Log\LoggerInterface; /** * This class manages the apps. It allows them to register and integrate in the @@ -1041,7 +1042,7 @@ class OC_App { $dispatcher = OC::$server->getEventDispatcher(); // load the steps - $r = new Repair([], $dispatcher); + $r = new Repair([], $dispatcher, \OC::$server->get(LoggerInterface::class)); foreach ($steps as $step) { try { $r->addStep($step); |