Skip to content
Corex

ModeCommand

Corex\Cli\Commands\ModeCommand · class · CLI layer

wp corex mode get|set (spec 101, FR-017): read the operations mode, and change it, from the command line — for a deploy script that puts a fresh install into Coming soon before anybody visits it, and for an operator who cannot reach the screen. It holds no rule about changing mode. {@see ModeChangeService} does, and it is the same service the Operations screen calls, so the command cannot be a way round a confirmation: --acknowledge is the ticked box and --phrase is the typed phrase, and without the one its mode needs nothing changes and the command fails. What this class owns is reading its arguments and saying what happened in words and an exit code.

__construct(ModeChangeService $changes, OperationsModeStore $store, OperationsMode $modes)

Section titled “__construct(ModeChangeService $changes, OperationsModeStore $store, OperationsMode $modes)”

execute(string $action, array $args, array $assoc, int $actorId, DateTimeImmutable $now): ModeCommandResult

Section titled “execute(string $action, array $args, array $assoc, int $actorId, DateTimeImmutable $now): ModeCommandResult”

The command without the printing.

run(string $action, array $args, array $assoc): void

Section titled “run(string $action, array $args, array $assoc): void”