diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-02-08 11:52:40 +0100 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2024-02-08 18:27:44 +0100 |
commit | 303e2febc717065581a3e3bdc92e1672bb8253dc (patch) | |
tree | c8f88c01fa1e7f93958a6b48bee3aa4bf5525dfb /apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php | |
parent | f6ed1effbf4bb040ab35c625159ad80caff5e687 (diff) | |
download | nextcloud-server-303e2febc717065581a3e3bdc92e1672bb8253dc.tar.gz nextcloud-server-303e2febc717065581a3e3bdc92e1672bb8253dc.zip |
Merge pull request #43387 from nextcloud/fix/migrate-away-from-ilogger-in-jobs
Diffstat (limited to 'apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php')
-rw-r--r-- | apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php | 55 |
1 files changed, 17 insertions, 38 deletions
diff --git a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php index a816e2619a3..0b89a3d1d77 100644 --- a/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php +++ b/apps/dav/lib/Migration/BuildCalendarSearchIndexBackgroundJob.php @@ -1,7 +1,11 @@ <?php + +declare(strict_types=1); + /** * @copyright 2017 Georg Ehrke <oc.list@georgehrke.com> * + * @author Côme Chilliet <come.chilliet@nextcloud.com> * @author Georg Ehrke <oc.list@georgehrke.com> * @author Joas Schilling <coding@schilljs.com> * @@ -23,47 +27,22 @@ */ namespace OCA\DAV\Migration; -use OC\BackgroundJob\QueuedJob; use OCA\DAV\CalDAV\CalDavBackend; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; +use OCP\BackgroundJob\QueuedJob; use OCP\IDBConnection; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { - - /** @var IDBConnection */ - private $db; - - /** @var CalDavBackend */ - private $calDavBackend; - - /** @var ILogger */ - private $logger; - - /** @var IJobList */ - private $jobList; - - /** @var ITimeFactory */ - private $timeFactory; - - /** - * @param IDBConnection $db - * @param CalDavBackend $calDavBackend - * @param ILogger $logger - * @param IJobList $jobList - * @param ITimeFactory $timeFactory - */ - public function __construct(IDBConnection $db, - CalDavBackend $calDavBackend, - ILogger $logger, - IJobList $jobList, - ITimeFactory $timeFactory) { - $this->db = $db; - $this->calDavBackend = $calDavBackend; - $this->logger = $logger; - $this->jobList = $jobList; - $this->timeFactory = $timeFactory; + public function __construct( + private IDBConnection $db, + private CalDavBackend $calDavBackend, + private LoggerInterface $logger, + private IJobList $jobList, + ITimeFactory $timeFactory + ) { + parent::__construct($timeFactory); } public function run($arguments) { @@ -72,8 +51,8 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); - $startTime = $this->timeFactory->getTime(); - while (($this->timeFactory->getTime() - $startTime) < 15) { + $startTime = $this->time->getTime(); + while (($this->time->getTime() - $startTime) < 15) { $offset = $this->buildIndex($offset, $stopAt); if ($offset >= $stopAt) { break; @@ -105,7 +84,7 @@ class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { ->orderBy('id', 'ASC') ->setMaxResults(500); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch(\PDO::FETCH_ASSOC)) { $offset = $row['id']; |