getConfig(); $runtimeRaw = trim((string)$config->getAppValue( Application::APP_ID, 'publish_queue_runtime', '{}' )); $runtime = []; if ($runtimeRaw !== '') { try { $decoded = json_decode($runtimeRaw, true, 512, JSON_THROW_ON_ERROR); if (is_array($decoded)) { $runtime = $decoded; } } catch (\Throwable) { $runtime = []; } } $attemptEpoch = time(); $runtime['attemptCount'] = max(0, (int)($runtime['attemptCount'] ?? 0)) + 1; $runtime['lastAttemptAt'] = gmdate('c', $attemptEpoch); $runtime['lastAttemptAtEpoch'] = $attemptEpoch; $runtime['lastStatus'] = 'running'; $runtime['lastError'] = ''; $config->setAppValue( Application::APP_ID, 'publish_queue_runtime', (string)json_encode($runtime, JSON_UNESCAPED_SLASHES) ); /** @var FilesPublishService $queueService */ $queueService = \OC::$server->query(FilesPublishService::class); $queueService->processPublishQueueCycle(); $runtime['lastStatus'] = 'ok'; $runtime['lastError'] = ''; $runtime['lastSuccessAt'] = gmdate('c'); $runtime['lastSuccessAtEpoch'] = time(); $config->setAppValue( Application::APP_ID, 'publish_queue_runtime', (string)json_encode($runtime, JSON_UNESCAPED_SLASHES) ); } catch (\Throwable $e) { try { $config = \OC::$server->getConfig(); $runtimeRaw = trim((string)$config->getAppValue( Application::APP_ID, 'publish_queue_runtime', '{}' )); $runtime = []; if ($runtimeRaw !== '') { try { $decoded = json_decode($runtimeRaw, true, 512, JSON_THROW_ON_ERROR); if (is_array($decoded)) { $runtime = $decoded; } } catch (\Throwable) { $runtime = []; } } $runtime['lastStatus'] = 'failed'; $runtime['lastError'] = $e->getMessage(); $runtime['lastFailureAt'] = gmdate('c'); $runtime['lastFailureAtEpoch'] = time(); $config->setAppValue( Application::APP_ID, 'publish_queue_runtime', (string)json_encode($runtime, JSON_UNESCAPED_SLASHES) ); } catch (\Throwable) { // ignore runtime persistence errors } try { \OC::$server->getLogger()->warning('Qortal Files bridge direct cron publish queue fallback failed', [ 'app' => Application::APP_ID, 'error' => $e->getMessage(), ]); } catch (\Throwable) { // no-op } exit(1); } exit(0);