MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

Runner

MMO\admin\helpers · 1 symbole · générée le 27 Oct 2026

class

Runner

Runner.php:31

Runs a list of aDeployTask against a list of Target, and is the only place that decides what happens when something goes wrong.

class MMO\admin\helpers\Runner
Espace de noms
MMO\admin\helpers
The loop is always the same, whatever the pipeline: **plan -> confirm -> lock -> (apply + verify)* -> record -> unlock**, and on any failure, **rollback in reverse -> record the failure -> stop**. Three deliberate differences from the script this replaces: 1. **It fails closed.** A target that errors stops the run. The old loop caught the exception, asked "continue to next client?", and on a yes carried on reusing the same half-broken state. Continuing is still possible, but only when explicitly asked for ([`$continueOnError`](https://mmoframework.fr/fr/documentation/mmo.admin/php/helpers/Runner.md#runner-continueonerror)). 2. **Confirmation is not the safety mechanism.** The plan is printed and confirmed when a human is there, but every guard that matters (the lock, the checksum, `verify()`, the pre-mutation snapshot) runs either way -- so a non-interactive run is exactly as safe, which is what makes it runnable from CI. 3. **Success is observed, not assumed.** A task is only successful once its own `verify()` has looked at the target and found nothing wrong.
$runner = new Runner(dryRun: false, interactive: true); $reports = $runner->run($targets, [new BuildTask($git), new ShipTask(), new ActivateTask()]);

Index

assumeYes
continueOnError
dryRun
interactive
journaling
reports
repository
confirm($context, $plan)Print the plan and, when a human is watching, ask before touching anything.
debugName()
getLockOwner($context)
getReports()
isSuccessful()
plan($context, $tasks)Ask every task what it would do.
printSummary()One line per target, so a fan-out ends with something readable.
record($context, $outcome, $error)Write the run's outcome to the target's journal -- failures included, because "what did we try last time" is exactly what you want to know when a deployment goes wrong.
rollback($context, $applied)Undo the tasks that already applied, most recent first.
run($targets, $tasks, $options)
runTarget($target, $tasks, $options)Run every task against one target.
__construct($dryRun, $interactive, $assumeYes, $continueOnError, $repository, $journaling)

Propriétés7

assumeYes

bool $assumeYes
Type
bool

continueOnError

bool $continueOnError
Type
bool

dryRun

bool $dryRun
Type
bool

interactive

bool $interactive
Type
bool

journaling

bool $journaling
Type
bool

reports

protected array $reports = []
Type
array

repository

?MMO\core\interfaces\iRepository $repository
Type
null | iRepository

Méthodes12

confirm($context, $plan)

Runner.php:200

Print the plan and, when a human is watching, ask before touching anything.

protected function confirm(MMO\admin\helpers\Context $context, array $plan): bool
$contextContext
$planarray
retourneboolwhether to go ahead.

getLockOwner($context)

Runner.php:266
protected function getLockOwner(MMO\admin\helpers\Context $context): string
$contextContext
retournestringwho is taking the lock, for whoever hits it next.

getReports()

Runner.php:53
function getReports(): array
retournearraythe per-target reports of the last run.

isSuccessful()

Runner.php:56
function isSuccessful(): bool
retourneboolwhether every target succeeded.

plan($context, $tasks)

Runner.php:182

Ask every task what it would do.

protected function plan(MMO\admin\helpers\Context $context, array $tasks): array
$contextContext
$tasksarray
retournearraytask name => string[]

printSummary()

Runner.php:271

One line per target, so a fan-out ends with something readable.

protected function printSummary(): void
retournevoid

record($context, $outcome, $error)

Runner.php:253

Write the run's outcome to the target's journal -- failures included, because "what did we try last time" is exactly what you want to know when a deployment goes wrong.

protected function record( MMO\admin\helpers\Context $context, string $outcome, ?string $error = null ): ?MMO\admin\entities\Deployment
$contextContext
$outcomestring
$error = nullnull | string
retournenull | Deployment

rollback($context, $applied)

Runner.php:224

Undo the tasks that already applied, most recent first.

protected function rollback(MMO\admin\helpers\Context $context, array $applied): bool
$contextContext
$appliedarray
retourneboolwhether the rollback completed.

run($targets, $tasks, $options)

Runner.php:69
function run(array $targets, array $tasks, array $options = []): array
$targetsarray
$tasksarray
$options = []arraycommand-line options forwarded to every context (force, to, file, ...).
retournearraythe per-target reports.

runTarget($target, $tasks, $options)

Runner.php:98

Run every task against one target.

protected function runTarget(MMO\admin\entities\Target $target, array $tasks, array $options): array
$targetTarget
$tasksarray
$optionsarray
retournearraythe target's report.

__construct($dryRun, $interactive, $assumeYes, $continueOnError, $repository, $journaling)

Runner.php:35
function __construct( bool $dryRun = false, bool $interactive = true, bool $assumeYes = false, bool $continueOnError = false, ?MMO\core\interfaces\iRepository $repository = null, bool $journaling = true )
$dryRun = falsebool
$interactive = truebool
$assumeYes = falsebool
$continueOnError = falsebool
$repository = nullnull | iRepository
$journaling = truebool