Index

aDatabaseTask

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

class

aDatabaseTask

aDatabaseTask.php:18

Shared ground for the tasks that touch a target's database (BackupTask,

abstract class MMO\admin\classes\aDatabaseTask extends MMO\admin\classes\aDeployTask
Namespace
MMO\admin\classes
Extends
aDeployTask
See
RestoreTask, MigrateTask).
The repository does the actual work -- [`MongoRepository::backup`](https://mcp.mmoframework.fr/documentation/mmo.mongodb/php/MongoRepository.md#mongorepository-backup) already takes an `iShell` and transparently runs `mongodump` on the other side, then pulls the archive back. That abstraction was the one genuinely well-factored piece of the old production script, so these tasks reuse it rather than re-implementing it, and mmo.admin does NOT depend on mmo.mongodb: the three methods it needs are checked at runtime, and a repository without them gets a clear error instead of a fatal.

Index

REQUIRED
getDatabase($context)
getRepository($context)
getShell($context)
snapshot($context)Take a snapshot of the target's database and record it on the context, so whatever comes next is reversible.

Constants1

REQUIRED

const REQUIRED = ['backup', 'restore', 'patch', 'getBackupName']

Methods4

getDatabase($context)

aDatabaseTask.php:46
protected function getDatabase(MMO\admin\helpers\Context $context): string
$contextContext
returnsstringthe database name on the target.
throwswhen the target declares none.

getRepository($context)

aDatabaseTask.php:27
protected function getRepository(MMO\admin\helpers\Context $context): object
$contextContext
returnsobjectthe repository, guaranteed to support the backup/restore/patch trio.
throwswhen the run has no repository, or one that cannot do this.

getShell($context)

aDatabaseTask.php:86
protected function getShell(MMO\admin\helpers\Context $context): ?MMO\core\interfaces\iShell
$contextContext
returnsnull | iShellthe shell the repository should run its mongo commands through (null means local).

snapshot($context)

aDatabaseTask.php:61

Take a snapshot of the target's database and record it on the context, so whatever comes next is reversible. Every mutating database task calls this FIRST -- in the old script this was a habit (route_reset did it by hand, restore and patch did not); here it is the only way in.

protected function snapshot(MMO\admin\helpers\Context $context): ?string
$contextContext
returnsnull | stringthe backup's filename on the target (null during a dry run).
Inherited members (43)
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
PropertiesDeclared byDescription
verbosityaDeployTask
MethodsDeclared byDescription
alert($message, $context)aDeployTaskAction must be taken immediately.
apply($context)aDeployTaskPerform the task. Must throw on failure: returning normally is taken to mean the step ran.
backtraces($message, $context)aDeployTaskForce-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)aDeployTaskCritical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)aDeployTaskDetailed debug information.
debugName()aDeployTask
emergency($message, $context)aDeployTaskSystem is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)aDeployTaskRuntime errors that do not require immediate action but should typically be logged and monitored.
getDescription()aDeployTask
getName()aDeployTask
getVerbosity()aDeployTask
info($message, $context)aDeployTaskInteresting events. No-op if INFO is currently filtered out by the verbosity mask.
isChange()aDeployTaskWhether running this task CHANGES anything.
isNeeded($context)aDeployTaskWhether this task has anything to do for this target -- e.g.
isRollbackCritical()aDeployTask
log($level, $message, $context)aDeployTaskLogs with an arbitrary level.
notice($message, $context)aDeployTaskNormal but significant events.
plan($context)aDeployTaskDescribe what apply would do, WITHOUT doing it.
rollback($context)aDeployTaskUndo this task. Called by the runner, in reverse order, for every task already applied when a later one failed.
setVerbosity($verb)aDeployTaskSet the current verbosity mask, replacing whatever it was before.
testVerbosity($level)aDeployTaskTest whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
verify($context)aDeployTaskCheck, by looking at the target, that the task really took effect.
warning($message, $context)aDeployTaskExceptional occurrences that are not errors.