API / Minn\Cli / Preflight

Preflight final class

Minn\Cli\Preflight · public/minn/src/Minn/Cli/Preflight.php · 417 lines

What a site will and will not get from the engine, before anything moves: the config it can read, the database it can reach, the theme's kind, the plugins the extensions cover, and the content survey (the shortcodes, third-party blocks, menus, extra tables, and extra post types in the database). Every finding is a light; the worst decides.

Used by 1

Constants and properties

privateAREAS = array ( 'admin' => 'wp-admin', 'editor' => 'editor', 'customizer' => 'Customizer', 'xmlrpc' => 'XML-RPC', 'omitted' => 'left out', )

What the dead-end areas are, as a report says them.

privatearray $lines
privatestring $worst
privatereadonly string $engineDir

Promoted from the constructor.

Public

new__construct(string $engineDir = '')#
$engineDirstringthe engine whose facade judges the plugins (this one when empty)
methodlines(): array#

The report, one line per finding. @return list<string>

@return list<string>
methodrun(string $root): string#

Runs every check and returns the worst light: GREEN, AMBER, or RED.

staticthemeKind(string $dir, string $parentDir): string#

Same line Theme::active / ClassicTheme::active draw: a block template index (child or parent) is a block theme; otherwise a parent index.php is a classic theme.

Internals 14

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatereadConfig(string $file): array#

The database constants and prefix, read from the file as text: nothing in it runs.

privateenv(string $name, ?string $default = NULL): ?string#

getenv, then {NAME}_FILE (Docker secrets), then the fallback. Matches the official image's getenv_docker without running that PHP.

privateoptionReader(mysqli $db, string $prefix): Closure#

A reader for one option's raw value, on the site's own connection. @return \Closure(string): ?string

@return \Closure(string): ?string
privatepreflightTheme(string $root, Closure $option): void#

The active theme: present, and block or classic. @param \Closure(string): ?string $option

$option\Closure(string): ?string
privatepreflightPlugins(string $root, Closure $option): array#

The active plugins against the extensions on disk: what each provides, what will not run, and the shortcodes, blocks, and types the active extensions cover, for the content survey.

$option\Closure(string): ?string
@return array{array<string, string>, array<string, string>, array<string, string>}
privatepreflightPlugin(string $file, string $read, string $label, Minn\Runtime\SymbolGap $gap, array $deadEnds): void#

One plugin as the engine's gate will judge it: refused for what the engine lacks, or for declaring a function the engine already defines in its main file; otherwise it runs, and the calls that answer with nothing on Minn are counted by area.

$deadEndsarray<string, mixed>
privatesome(array $names): string#
$nameslist<string>the first five, and how many more
privatesurveyContent(mysqli $db, string $prefix, array $coveredShortcodes, array $coveredBlocks, array $coveredTypes): void#

What the content holds that the engine must serve: shortcodes and third-party blocks against the extensions covering them, menus, extra tables, and extra post types.

$coveredShortcodesarray<string, string>
$coveredBlocksarray<string, string>
$coveredTypesarray<string, string>
privatesurveyMarkup(mysqli $db, string $prefix, array $coveredShortcodes, array $coveredBlocks): void#
$coveredShortcodesarray<string, string>@param array<string, string> $coveredBlocks
privatesurveyMenus(mysqli $db, string $prefix): void#
privatesurveyTables(mysqli $db, string $prefix): void#
privatesurveyTypes(mysqli $db, string $prefix, array $coveredTypes): void#
$coveredTypesarray<string, string>
privatelight(string $light, string $text): void#
privatesay(string $line): void#