summaryrefslogtreecommitdiffstats
path: root/lib/private/Migration
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-06-28 12:55:26 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-08-08 17:03:19 +0200
commit48d9c4d2b093e12ec3bf3cd29295da0f2277028f (patch)
treed66f1d2f54e8ae745fc7ce7bf067ce2072eeac6a /lib/private/Migration
parent19a2d6f6e7d54eb9318279809bf6c3f40bf566e2 (diff)
downloadnextcloud-server-48d9c4d2b093e12ec3bf3cd29295da0f2277028f.tar.gz
nextcloud-server-48d9c4d2b093e12ec3bf3cd29295da0f2277028f.zip
Port existing server code to new interface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib/private/Migration')
-rw-r--r--lib/private/Migration/BackgroundRepair.php41
1 files changed, 12 insertions, 29 deletions
diff --git a/lib/private/Migration/BackgroundRepair.php b/lib/private/Migration/BackgroundRepair.php
index 03a3d3f4a7c..f3ae8f4bdcf 100644
--- a/lib/private/Migration/BackgroundRepair.php
+++ b/lib/private/Migration/BackgroundRepair.php
@@ -26,13 +26,12 @@
*/
namespace OC\Migration;
-use OC\BackgroundJob\JobList;
-use OC\BackgroundJob\TimedJob;
use OC\NeedsUpdateException;
use OC\Repair;
use OC_App;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
-use OCP\ILogger;
+use OCP\BackgroundJob\TimedJob;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -42,33 +41,16 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
* @package OC\Migration
*/
class BackgroundRepair extends TimedJob {
+ private IJobList $jobList;
+ private LoggerInterface $logger;
+ private EventDispatcherInterface $dispatcher;
- /** @var IJobList */
- private $jobList;
-
- /** @var ILogger */
- private $logger;
-
- /** @var EventDispatcherInterface */
- private $dispatcher;
-
- public function __construct(EventDispatcherInterface $dispatcher) {
+ public function __construct(EventDispatcherInterface $dispatcher, ITimeFactory $time, LoggerInterface $logger, IJobList $jobList) {
+ parent::__construct($time);
$this->dispatcher = $dispatcher;
- }
-
- /**
- * run the job, then remove it from the job list
- *
- * @param JobList $jobList
- * @param ILogger|null $logger
- */
- public function execute($jobList, ILogger $logger = null) {
- // add an interval of 15 mins
- $this->setInterval(15 * 60);
-
- $this->jobList = $jobList;
$this->logger = $logger;
- parent::execute($jobList, $logger);
+ $this->jobList = $jobList;
+ $this->setInterval(15 * 60);
}
/**
@@ -97,8 +79,9 @@ class BackgroundRepair extends TimedJob {
try {
$repair->addStep($step);
} catch (\Exception $ex) {
- $this->logger->logException($ex, [
- 'app' => 'migration'
+ $this->logger->error($ex->getMessage(), [
+ 'app' => 'migration',
+ 'exception' => $ex,
]);
// remove the job - we can never execute it