7373use OCP \AppFramework \QueryException ;
7474use OCP \AppFramework \Utility \ITimeFactory ;
7575use OCP \Collaboration \Resources \IManager ;
76+ use OCP \ILogger ;
7677use OCP \Migration \IOutput ;
7778use OCP \Migration \IRepairStep ;
79+ use Psr \Log \LoggerInterface ;
7880use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
7981use Symfony \Component \EventDispatcher \GenericEvent ;
8082
@@ -89,15 +91,18 @@ class Repair implements IOutput {
8991 /** @var string */
9092 private $ currentStep ;
9193
94+ private $ logger ;
95+
9296 /**
9397 * Creates a new repair step runner
9498 *
9599 * @param IRepairStep[] $repairSteps array of RepairStep instances
96100 * @param EventDispatcherInterface $dispatcher
97101 */
98- public function __construct (array $ repairSteps , EventDispatcherInterface $ dispatcher ) {
102+ public function __construct (array $ repairSteps , EventDispatcherInterface $ dispatcher, LoggerInterface $ logger ) {
99103 $ this ->repairSteps = $ repairSteps ;
100104 $ this ->dispatcher = $ dispatcher ;
105+ $ this ->logger = $ logger ;
101106 }
102107
103108 /**
@@ -116,6 +121,7 @@ public function run() {
116121 try {
117122 $ step ->run ($ this );
118123 } catch (\Exception $ e ) {
124+ $ this ->logger ->error ("Exception while executing repair step " . $ step ->getName (), ['exception ' => $ e ]);
119125 $ this ->emit ('\OC\Repair ' , 'error ' , [$ e ->getMessage ()]);
120126 }
121127 }
0 commit comments