Index

aDeployTask

MMO\admin\classes · 1 symbol · generated 5 Oct 2026

class

aDeployTask

aDeployTask.php:25

One step of a deployment, expressed as four separate questions rather than one procedure:

abstract class MMO\admin\classes\aDeployTask implements MMO\core\interfaces\iLogEmitter use MMO\core\classes\tLogEmitter
Namespace
MMO\admin\classes
Implements
iLogEmitter
Uses traits
tLogEmitter
- [`plan`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/classes/aDeployTask.md#adeploytask-plan) what WOULD happen, described without doing anything. This is what makes `--dry-run` real and what the runner prints before asking for confirmation. - [`apply`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/classes/aDeployTask.md#adeploytask-apply) do it. - [`verify`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/classes/aDeployTask.md#adeploytask-verify) check it actually worked, by observing the target -- NOT by trusting that apply() returned. - [`rollback`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/classes/aDeployTask.md#adeploytask-rollback) undo it, called by the runner (in reverse order) when a LATER task fails. Splitting `verify` out is the point. In the previous production script the deploy step reported success unconditionally: it discarded the stream carrying the remote command's exit code, and its status helper returned `true` on every path that collected errors. Here a task cannot report success -- it can only fail to produce errors from `verify()`, which has to look at the target to say anything at all. A task is cheap and stateless: the runner instantiates it once and runs it against each target, with all per-target state living in the [`Context`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/helpers/Context.md#context).

Index

verbosity
alert($message, $context)Action must be taken immediately.
apply($context) abstractPerform the task. Must throw on failure: returning normally is taken to mean the step ran.
backtraces($message, $context)Force-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).
critical($message, $context)Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)Detailed debug information.
debugName()
emergency($message, $context)System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)Runtime errors that do not require immediate action but should typically be logged and monitored.
getDescription()
getName()
getVerbosity()
info($message, $context)Interesting events. No-op if INFO is currently filtered out by the verbosity mask.
isChange()Whether running this task CHANGES anything.
isNeeded($context)Whether this task has anything to do for this target -- e.g.
isRollbackCritical()
log($level, $message, $context)Logs with an arbitrary level.
notice($message, $context)Normal but significant events.
plan($context) abstractDescribe what apply would do, WITHOUT doing it.
rollback($context)Undo this task. Called by the runner, in reverse order, for every task already applied when a later one failed.
setVerbosity($verb)Set the current verbosity mask, replacing whatever it was before.
testVerbosity($level)Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
verify($context)Check, by looking at the target, that the task really took effect.
warning($message, $context)Exceptional occurrences that are not errors.

Properties1

verbosity

#[MMO\core\attributes\Serialize(order: -1000)] protected int $verbosity = 31
Type
int

Methods23

alert($message, $context)

tLogEmitter.php:121

Action must be taken immediately.

function alert(Stringable|string $message, array $context = []): voidExample: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
$messageStringable | string
$context = []array
returnsvoid
$this->alert('payment gateway unreachable for 5 minutes.');

apply($context)

abstractaDeployTask.php:61

Perform the task. Must throw on failure: returning normally is taken to mean the step ran.

abstract function apply(MMO\admin\helpers\Context $context): void
$contextContext
returnsvoid

backtraces($message, $context)

tLogEmitter.php:234

Force-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).

function backtraces(string $message = ' -- TRACES -- ', array $context = []): void
$message = ' -- TRACES -- 'string
$context = []array
returnsvoid
$this->backtraces('unexpected state reached in {method}.', ['method' => __METHOD__]);

critical($message, $context)

tLogEmitter.php:138

Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.

function critical(Stringable|string $message, array $context = []): voidExample : Application component unavailable, unexpected exception.
$messageStringable | string
$context = []array
returnsvoid
$this->critical('unexpected {exception}.', ['exception' => $e]);

debug($message, $context)

tLogEmitter.php:219

Detailed debug information. No-op if DEBUG is currently filtered out by the verbosity mask.

function debug(Stringable|string $message, array $context = []): void
$messageStringable | string
$context = []array
returnsvoid
$this->debug('set stream [{stream}].', ['stream' => $stream]);

emergency($message, $context)

tLogEmitter.php:103

System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.

function emergency(Stringable|string $message, array $context = []): void
$messageStringable | string
$context = []array
returnsvoid
$this->emergency('database connection lost.');

error($message, $context)

tLogEmitter.php:154

Runtime errors that do not require immediate action but should typically be logged and monitored.

function error(Stringable|string $message, array $context = []): voidNo-op if ERROR is currently filtered out by the verbosity mask.
$messageStringable | string
$context = []array
returnsvoid
$this->error('failed to write [{file}].', ['file' => $filename]);

getDescription()

aDeployTask.php:37
function getDescription(): string
returnsstringa one-line description of what this task is for.

getVerbosity()

tLogEmitter.php:38
function getVerbosity(): int
returnsintthe current verbosity, as a bitmask of iLogLevel::* constants
$this->getVerbosity() === (iLogLevel::ERROR_PLUS); // true if only errors/critical/alert/emergency are enabled

info($message, $context)

tLogEmitter.php:204

Interesting events. No-op if INFO is currently filtered out by the verbosity mask.

function info(Stringable|string $message, array $context = []): voidExample: User logs in, SQL logs.
$messageStringable | string
$context = []array
returnsvoid
$this->info('routing [{request}] ...', ['request' => $request]);

isChange()

aDeployTask.php:91

Whether running this task CHANGES anything.

function isChange(): boolA task that only inspects ([`AssertArtifactTask`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/tasks/AssertArtifactTask.md#assertartifacttask)) still has to run on every release, but a run made up of nothing else changed nothing -- and must not be recorded as a deployment. Without this, re-running `release` on an up-to-date target reported "done" and appended a journal entry describing a deployment that never happened, which is precisely the kind of entry that makes a journal stop being worth reading.
returnsbool

isNeeded($context)

aDeployTask.php:46

Whether this task has anything to do for this target -- e.g. a release already shipped with the same checksum does not need shipping again. A task that returns false is skipped entirely (no apply, no verify, and no rollback if a later task fails).

function isNeeded(MMO\admin\helpers\Context $context): bool
$contextContext
returnsbool

isRollbackCritical()

aDeployTask.php:79
function isRollbackCritical(): bool
returnsboolwhether failing to roll this task back should abort the rest of the rollback.

log($level, $message, $context)

tLogEmitter.php:81

Logs with an arbitrary level.

function log($level, Stringable|string $message, array $context = []): voidNOTE: $level is filtered against the current [`setVerbosity()`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/classes/aDeployTask.md#adeploytask-setverbosity): if the level is masked out, nothing is logged/dispatched at all. Return type is `void` (not the dispatched Log) to satisfy \Psr\Log\LoggerInterface.
$level
$messageStringable | string
$context = []arrayignored if $message is a Log
returnsvoid
$this->log(self::ERROR, 'disk usage at {percent}%.', ['percent' => 92]); $this->log('error', $caughtException); //string levels are resolved through \MMO\core\debug\flags()

notice($message, $context)

tLogEmitter.php:187

Normal but significant events. No-op if NOTICE is currently filtered out by the verbosity mask.

function notice(Stringable|string $message, array $context = []): void
$messageStringable | string
$context = []array
returnsvoid
$this->notice('-- START -- ({mode}): {time}', ['mode' => MMO_MODE, 'time' => date('r')]);

plan($context)

abstractaDeployTask.php:54

Describe what apply would do, WITHOUT doing it. Reading the target is allowed and encouraged -- a plan that cannot see the current state is not worth printing.

abstract function plan(MMO\admin\helpers\Context $context): array
$contextContext
returnsarrayone line per step.

rollback($context)

aDeployTask.php:76

Undo this task. Called by the runner, in reverse order, for every task already applied when a later one failed. Must be safe to call on a task that only partially applied.

function rollback(MMO\admin\helpers\Context $context): void
$contextContext
returnsvoid

setVerbosity($verb)

tLogEmitter.php:64

Set the current verbosity mask, replacing whatever it was before.

function setVerbosity(string|int|null $verb = null): void
$verb = nullstring | int | nulla bitmask of iLogLevel::* constants, or a level name/expression resolved through \MMO\core\debug\flags() (e.g. 'error+' for iLogLevel::ERROR_PLUS)
returnsvoid
$this->setVerbosity(iLogLevel::WARNING_PLUS); // only log warnings and above $this->setVerbosity('all'); // log everything

testVerbosity($level)

tLogEmitter.php:50

Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.

function testVerbosity(string|int $level): int
$levelstring | inta iLogLevel::* constant/bitmask, or a level name resolved through \MMO\core\debug\flags()
returnsintthe bits of $level that are currently enabled (0 if none of them are)
$this->testVerbosity(self::DEBUG); // non-zero if debug-level logging is currently enabled $this->testVerbosity('error'); // same, using the string form

verify($context)

aDeployTask.php:68

Check, by looking at the target, that the task really took effect.

function verify(MMO\admin\helpers\Context $context): array
$contextContext
returnsarrayevery problem found; an empty array means verified.

warning($message, $context)

tLogEmitter.php:172

Exceptional occurrences that are not errors. No-op if WARNING is currently filtered out by the verbosity mask.

function warning(Stringable|string $message, array $context = []): voidExample: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
$messageStringable | string
$context = []array
returnsvoid
$this->warning('{count} logs were dropped.', ['count' => 3]);
Inherited members (19)
ConstantsDeclared byDescription
ALERTiLogLevelAlert: Action must be taken immediately.
ALLiLogLevelMask for all
ALL_PLUSiLogLeveldebug everything
BACKTRACEiLogLevel
CRITICALiLogLevelCritical: Critical conditions.
DEBUGiLogLevelDebug: Detailed debug information.
DEEPiLogLeveldebug everything with arguments
EMERGENCYiLogLevelEmergency: System is unusable.
ERRORiLogLevelError: Runtime errors that do not require immediate action but should typically be logged and monitored.
ERROR_PLUSiLogLevelMask for all error
FATALiLogLevelMask for all fatal error
INFOiLogLevelInfo: Interesting events.
INFO_PLUSiLogLevelMask for all errors/warning/notices/info
MEMORYiLogLevelinclude backtrace object
NOTICEiLogLevelNotice: Normal but significant events.
NOTICE_PLUSiLogLevelMask for all errors/warning/notices/info
TRACEiLogLevelinclude backtrace as origins
WARNINGiLogLevelWarning: Exceptional occurrences that are not errors.
WARNING_PLUSiLogLevelMask for all errors and warnings