setInterval($this->getIntervalSeconds()); } protected function run($argument): void { try { /** @var ConfigService $configService */ $configService = \OC::$server->query(ConfigService::class); if (!$configService->isRunnable()) { return; } $this->runEnabled($argument); } catch (\Throwable $e) { try { \OC::$server->getLogger()->warning($this->getFailureMessage(), [ 'app' => Application::APP_ID, 'error' => $e->getMessage(), ]); } catch (\Throwable) { // Runtime failures are non-fatal during the scaffold phase. } } } abstract protected function runEnabled($argument): void; abstract protected function getFailureMessage(): string; protected function getIntervalSeconds(): int { return 300; } }