options->get(self::OPTION, []); return $generationId > 0 && is_array($c) && (int) ($c['site_id'] ?? 0) === $siteId && (int) ($c['paused_generation'] ?? 0) === $generationId; } public const AUTO_OPTION = 'aiwend_index_autosync'; /** * The administrator's standing approval to spend the embedding budget on keeping an index current after source changes. Off by * default and per site: without it a source change only marks the index as out of date, and the administrator updates it by hand. */ public function autoSync(int $siteId): bool { $c = $this->options->get(self::AUTO_OPTION, []); return is_array($c) && (int) ($c['site_id'] ?? 0) === $siteId && ($c['enabled'] ?? false) === true; } public function setAutoSync(int $siteId, bool $enabled): void { $this->options->set(self::AUTO_OPTION, ['site_id' => $siteId, 'enabled' => $enabled]); } /** 0 clears the pause. */ public function setPaused(int $siteId, int $generationId): void { $this->options->set(self::OPTION, ['site_id' => $siteId, 'paused_generation' => $generationId]); } }