final class ApiKeyZoneScopeMigration (View source)

Rewrites API key zone scopes from zones row ids to canonical zone ids, once.

Before 4.6.0 the API key form stored the row id of each zone in API backend mode, while every request compared the canonical id, so on installs migrated from SQL mode a scope named the wrong zone. The marker row in app_settings doubles as the lock: only the request that inserts it runs the rewrite, so the overlapping id spaces are never mapped twice. SQL mode stores domains.id, already canonical, and only sets the marker.

Constants

MARKER

private UNREACHABLE_ZONE_ID

Scope value for a stored id whose meaning is unknown: it matches no zone.

Methods

__construct(PDO $db, bool $isApiBackend, LoggerInterface $logger)

No description

bool
runOnce()

Run the rewrite unless it already ran. Returns whether stored scopes are canonical: always in SQL mode, and in API mode once the rewrite has committed.

Details

__construct(PDO $db, bool $isApiBackend, LoggerInterface $logger)

No description

Parameters

PDO $db
bool $isApiBackend
LoggerInterface $logger

bool runOnce()

Run the rewrite unless it already ran. Returns whether stored scopes are canonical: always in SQL mode, and in API mode once the rewrite has committed.

Return Value

bool