objects

Registry

SQLite index of every page UUID with its path, view, status and timestamps. find() queries it with the comma-separated DSL.

$registry Phlat\Data\Registry 19 methods
Properties (1)
$registry->path string The registry file in use: the newest complete build of this SCHEMA, or the one the first build will write.
Show
  • allRows Like rows() but with no default limit - all matching rows returned.
  • atomic Runs $fn as one transaction on the registry, so a bulk change pays for the disk once.
  • boot Connects, building the first registry if there is none; while one request builds, the rest get a 503.
  • countRows Total row count matching the same query DSL as rows(), ignoring limit/offset.
  • deleteSubtree Clears registry/field_index/search_index rows for a page subtree - the page and its descendants.
  • distinctValues Distinct non-empty values for a structural column (e.g. 'view'), sorted - used to populate filter selects.
  • find Query the registry and return a typed collection.
  • gate The [sql, params] that are true when no page closes $path to this visitor - $path being an SQL expression for a page path, and $registry the registry table as the caller reaches it ('reg.registry' from a database it attached).
  • get The path of the page with this uuid, or null.
  • index Brings the registry row and the record's field_index/search_index rows up to date - one call keeps every derived index current.
  • locate Resolves a bare uuid (no type prefix) to its registry row, trying each candidate type in turn.
  • mountOf The path of the first site page, by path, whose view is exactly $view, or null.
  • pruneColumns Drops the columns of fields no view or role declares any more (FieldIndex::prune()).
  • rebuild Rebuilds the registry by scanning all page and user directories.
  • remove Drops the registry row for $uuid, and with it (FieldIndex::trigger()) its field_index/search_index rows.
  • rows Same query DSL as find(), but returns raw rows (registry columns only) instead of hydrated Page/User objects.
  • sumRows Sum of a number field over the rows matching $query, ignoring limit/offset.
  • undeclaredColumns The fields with a column in the registry that no view or role declares any more.
  • updatedAt Returns the `updated` timestamp for the site page at $path, or null if not indexed.

Methods

$registry->allRows(string $query = ''): array

Like rows() but with no default limit - all matching rows returned.

For internal use by collection hydration.

Parameters (1)
$query string = ''

Returns array

phlat/src/Data/Registry.php:474
$registry->atomic(callable $fn): mixed

Runs $fn as one transaction on the registry, so a bulk change pays for the disk once.

Returns what $fn returns.

Parameters (1)
$fn callable

Returns mixed

phlat/src/Data/Registry.php:363
$registry->boot(): void

Connects, building the first registry if there is none; while one request builds, the rest get a 503.

phlat/src/Data/Registry.php:138
$registry->countRows(string $query = ''): int

Total row count matching the same query DSL as rows(), ignoring limit/offset.

Parameters (1)
$query string = ''

Returns int

phlat/src/Data/Registry.php:481
$registry->deleteSubtree(string $subtree): void

Clears registry/field_index/search_index rows for a page subtree - the page and its descendants.

Users are keyed by name in the same path column, so they are left alone.

Parameters (1)
$subtree string
phlat/src/Data/Registry.php:703
$registry->distinctValues(string $column): array

Distinct non-empty values for a structural column (e.g. 'view'), sorted - used to populate filter selects.

Returns [] for an unrecognized column.

Parameters (1)
$column string

Returns array

phlat/src/Data/Registry.php:403
$registry->find(string $query = ''): RecordCollection

Query the registry and return a typed collection.

Structural fields: type, root, depth, view, role, published, access, hidden, position, locked, path, created, updated Content fields: any other field name, a column of the registry that a declared field gets when a page first holds a value for it. A field no view or role declares is an error, as is a typo; a declared one nothing holds yet matches nothing. A list's or object's sub-values are reached with a dot-path (tags.0=php); only *= looks in them without one. Operators: = != *= ^= $= < > <= >= (a comparison matches only numbers: a number field, or a date as its timestamp) Dates: a date field and the created and updated columns hold Unix timestamps, and take a date in a condition, e.g. starts>=2026-10-18 or starts<2026-10-18T09:00Z. A date with no offset is read in the site timezone. With no time it names the whole day: starts=2026-10-18 matches anywhere in it, <= and > take its end, < and >= its start. A date with a time is that instant. Multi-value: field=a|b matches any of the pipe-separated values (OR) Full text: search=words - ranked match against search_index (FTS5), default sort when present. Weighted by each field's search.weight option (high/normal/low, default normal) and gated by its search.enabled option (default true, unless the fieldtype's own _index.json declares a different default - see FieldIndex). Fuzzy: fuzzy=true (or fuzzy=1) alongside search= widens each search term to nearby indexed terms by edit distance, for typo tolerance. No effect without search=. Sort: sort=field sort=-field (descending) Paging: limit=n offset=n Scope: what the visitor may open only - see scope(). Editors and the CLI get everything. Type: a find() returns one type, as the paths it keeps mean a page or a user: type=page (the default) or type=user.

Parameters (1)
$query string = ''

Returns RecordCollection

phlat/src/Data/Registry.php:441
$registry->gate(string $path, string $registry = 'registry'): array

The [sql, params] that are true when no page closes $path to this visitor - $path being an SQL expression for a page path, and $registry the registry table as the caller reaches it ('reg.registry' from a database it attached).

A page closes its own path and everything beneath it. Whether the visitor sees everything (an editor) is the caller's to ask first; this always builds the gate.

Parameters (2)
$path string
$registry string = 'registry'

Returns array

phlat/src/Data/Registry.php:525

get

$registry->get(string $uuid): ?string

The path of the page with this uuid, or null.

Parameters (1)
$uuid string

Returns ?string

phlat/src/Data/Registry.php:219
$registry->index(Record $object): void

Brings the registry row and the record's field_index/search_index rows up to date - one call keeps every derived index current.

Parameters (1)
$object Record
phlat/src/Data/Registry.php:325
$registry->locate(string $uuid, array $types = [...]): ?array

Resolves a bare uuid (no type prefix) to its registry row, trying each candidate type in turn.

Lets file-owning code (PageFiles) resolve a file's owner without assuming it's a Page - a user owns files too.

Parameters (2)
$uuid string
$types array = [...]

Returns ?array

phlat/src/Data/Registry.php:234
$registry->mountOf(string $view): ?string

The path of the first site page, by path, whose view is exactly $view, or null.

Unscoped: a hidden or gated mount root is still what the addon is mounted on.

Parameters (1)
$view string

Returns ?string

phlat/src/Data/Registry.php:268
$registry->pruneColumns(): array

Drops the columns of fields no view or role declares any more (FieldIndex::prune()).

Returns the fields dropped.

Returns array

phlat/src/Data/Registry.php:378
$registry->rebuild(?string $subtree = null, ?callable $onProgress = null): void

Rebuilds the registry by scanning all page and user directories.

A full rebuild fills a new file beside the live one, which keeps serving and taking saves meanwhile, then makes the new file the registry with one rename: nothing ever reads a half-built registry. A name is never reused, as renaming onto a WAL database that is open would pair the new file with the old one's journal. What was saved or deleted during the walk is carried over before the rename (catchUp()). A build that dies leaves the live file as it was. $subtree, when given (a page path relative to site/pages), scopes the rebuild to just that page and its descendants, replaced in one transaction on the live file. Field definitions are never indexed here at all - see App::fields(), which resolves them straight from disk. Collections are not in the registry, so their folders - the _-prefixed ones - are not walked. $onProgress, when given, is called with each page's relative path as it's indexed.

Parameters (2)
$subtree ?string = null
$onProgress ?callable = null
phlat/src/Data/Registry.php:566
$registry->remove(string $uuid): void

Drops the registry row for $uuid, and with it (FieldIndex::trigger()) its field_index/search_index rows.

Parameters (1)
$uuid string
phlat/src/Data/Registry.php:354
$registry->rows(string $query = '', int $limit = 50, int $offset = 0): array

Same query DSL as find(), but returns raw rows (registry columns only) instead of hydrated Page/User objects.

Parameters (3)
$query string = ''
$limit int = 50
$offset int = 0

Returns array

phlat/src/Data/Registry.php:467
$registry->sumRows(string $query, string $field): float

Sum of a number field over the rows matching $query, ignoring limit/offset.

Parameters (2)
$query string
$field string

Returns float

phlat/src/Data/Registry.php:488
$registry->undeclaredColumns(): array

The fields with a column in the registry that no view or role declares any more.

Returns array

phlat/src/Data/Registry.php:371
$registry->updatedAt(string $path): ?int

Returns the `updated` timestamp for the site page at $path, or null if not indexed.

Parameters (1)
$path string

Returns ?int

phlat/src/Data/Registry.php:256