l10n->t('Task Processing worker status'); } public function run(): SetupResult { $lastNDays = self::HAS_TASKS_IN_LAST_X_DAYS; $tasks = $this->taskProcessingManager->getTasks(userId: '', scheduleAfter: $this->timeFactory->now()->getTimestamp() - (60 * 60 * 24 * $lastNDays)); $taskCount = count($tasks); if ($taskCount === 0) { // In case taskprocessing is not used at all return SetupResult::success( $this->l10n->n( 'No scheduled tasks in the last day.', 'No scheduled tasks in the last %n days.', $lastNDays ) ); } $lastIteration = (int)$this->appConfig->getValueString('core', 'taskprocessing_worker_last_iteration', lazy: true); if ($lastIteration > $this->timeFactory->now()->getTimestamp() - (60 * self::IS_RUNNING_IN_LAST_X_MINUTES)) { return SetupResult::success( $this->l10n->n('The Task Processing worker has run in the last minute.', 'The Task Processing worker has run in the last %n minute.', self::IS_RUNNING_IN_LAST_X_MINUTES) ); } return SetupResult::warning( $this->l10n->t('The Task Processing worker does not seem to be running. The last run was at %s.', [date('Y-m-d H:i:s', (int)$this->appConfig->getValueString('core', 'taskprocessing_worker_last_iteration'))]) ); } }