l->t('NG Backup'); } public function run(): SetupResult { $link = $this->url->linkToRouteAbsolute('settings.AdminSettings.index', ['section' => 'ng_backup']); if (!$this->keys->isInitialized() || $this->keys->recoveryKitConfirmation() === null) { return SetupResult::error($this->l->t('Backups are not set up: create the backup key and confirm the recovery kit.'), $link); } $targets = $this->targets->list(); if ($targets === []) { return SetupResult::warning($this->l->t('No backup location is configured.'), $link); } $problems = []; foreach ($targets as $t) { $last = $this->runs->lastFinished($t->getId(), BackupService::KIND_FULL); if ($last === null) { $problems[] = $this->l->t('%s: no successful backup yet', [$t->getName()]); } elseif (time() - (int)$last->getFinishedAt() > AlertService::STALE_AFTER) { $problems[] = $this->l->t('%1$s: last successful backup %2$s', [$t->getName(), date('Y-m-d H:i', (int)$last->getFinishedAt())]); } } foreach ($this->runs->findRecent(10) as $r) { if ($r->getStatus() === Run::FAILED && $r->getStartedAt() > time() - AlertService::STALE_AFTER) { $problems[] = $this->l->t('A %1$s run failed: %2$s', [$r->getKind(), mb_strimwidth((string)$r->getError(), 0, 120, '…')]); break; } } return $problems === [] ? SetupResult::success($this->l->t('Recent backups to all locations succeeded.')) : SetupResult::warning(implode("\n", $problems), $link); } }