connection = $connection; $this->jobList = $jobList; } /** * @inheritdoc */ public function getName() { return 'Registering background jobs to update cache for webcal calendars'; } /** * @inheritdoc */ public function run(IOutput $output) { $query = $this->connection->getQueryBuilder(); $query->select(['principaluri', 'uri']) ->from('calendarsubscriptions'); $stmt = $query->execute(); $count = 0; while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { $args = [ 'principaluri' => $row['principaluri'], 'uri' => $row['uri'], ]; if (!$this->jobList->has(RefreshWebcalJob::class, $args)) { $this->jobList->add(RefreshWebcalJob::class, $args); $count++; } } $output->info("Added $count background jobs to update webcal calendars"); } }