dbCore = $dbCore; $this->logsRepo = $logsRepo; $this->logger = $logger; } /** * Schedule a rebuild only if logsRepo reports the rollup is stale * relative to logsv2. * * @return void */ public function maybeUpdateRedirectsForViewHitsTable(): void { if ($this->dbCore->noticeState()->shouldSkipNonEssentialDbWrites()) { $this->logger->debugMessage(__METHOD__ . ' skipped due to temporary DB write cooldown.'); return; } if (!$this->logsRepo->logsHitsTableExists()) { $this->logger->debugMessage(__METHOD__ . " table doesn't exist, deferring creation to WP-Cron."); $this->logsRepo->scheduleHitsTableRebuild(); return; } $this->logsRepo->recordLogsHitsRollupStalenessSignal(); if (!$this->logsRepo->hitsTableNeedsRebuild()) { return; } $this->logsRepo->scheduleHitsTableRebuild(); } }