API / Minn\Cli / Runtime

Runtime final class

Minn\Cli\Runtime · public/minn/src/Minn/Cli/Runtime.php · 80 lines

The engine, booted for a command: reads the site's wp-config.php (which ends in wp-settings.php, whose engine boot stops short of serving under WP-CLI) so the database constants and table prefix are known.

Constants and properties

privatestatic ?self $shared
privatestatic ?Minn\Runtime\Runtime $engine
propreadonly Minn\Db $db

Promoted from the constructor.

propreadonly Minn\Content\Site $site

Promoted from the constructor.

propreadonly Minn\Content\Users $users

Promoted from the constructor.

propreadonly Minn\Auth\Capabilities $capabilities

Promoted from the constructor.

propreadonly Minn\Front\Permalinks $permalinks

Promoted from the constructor.

Public

new__construct(Minn\Db $db, Minn\Content\Site $site, Minn\Content\Users $users, Minn\Auth\Capabilities $capabilities, Minn\Front\Permalinks $permalinks)#
staticboot(): self#

The engine's runtime for a CLI process, booted once.

staticbootEngine(): Minn\Runtime\Runtime#

The full WordPress runtime for a command, booted once: the facade is defined, the site's plugins load as code, and the lifecycle actions fire, so a verb can fire a scheduled hook whose callback a plugin registered. The lighter boot() does none of this; only a command that needs the runtime (cron) asks for this, since it loads every plugin.

staticstandIn(): void#

The runtime for a command WP-CLI loads WordPress for: WP-CLI has already run wp-config.php, so the engine boots from the constants it defined, loads the site's plugins as code (their commands register as they load), and hands control back for WP-CLI to run the command.

Internals 1

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

privateloadConfig(string $file): void#

wp-config.php sets $table_prefix as a variable; the engine reads it as a global.