Index

Journal

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

class

Journal

Journal.php:28

A target's deployment history, stored ON the target (deploy/deployments.json) rather than on whoever's laptop ran the deploy -- so it survives a fresh clone of the project, and describes the truth of that one machine. SyncTask mirrors it into the local store for a fleet-wide view.

class MMO\admin\helpers\Journal
Namespace
MMO\admin\helpers
It is what makes the rest honest: - `status` compares the recorded state with the live one instead of re-deriving everything over ssh; - a rollback knows which release to go back to, and which database snapshot goes with it; - a database patch can be applied exactly once ([`MigrateTask`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/tasks/MigrateTask.md#migratetask)). **Nothing is ever discarded.** An earlier version capped the file at 100 entries and dropped the oldest, which quietly destroyed the audit trail and -- far worse -- the record of which patches had already run, so a patch could be applied a second time once its entry aged out. Here the live file is rotated into `deployments.{n}.json` and [`getAppliedPatches`](https://mcp.mmoframework.fr/documentation/mmo.admin/php/helpers/Journal.md#journal-getappliedpatches) reads back through every one of them.
$journal = new Journal($runner, $target->getJournalFilename()); $journal->last()?->getVersion(); // what is actually live $journal->append($deployment);

Index

archived
entries
filename
limit
shell
all($reload, $archives)
append($deployment)Append $deployment and write the file back (atomically, ShellRunner::write), rotating it first when it is full.
debugName()
getAppliedPatches()Every database patch already applied on this target, across all deployments -- the basis of
getCurrentRelease()
getFilename()
getPreviousRelease()The release to roll back to: the one live before the current one.
history($count)
last($outcome)
listArchives()
readFile($filename)
rotate()Move the live file aside as deployments.{n}.json, keeping every entry it holds.
__construct($shell, $filename, $limit)

Properties5

archived

protected ?array $archived = null
Type
null | array

entries

protected ?array $entries = null
Type
null | array

filename

protected string $filename
Type
string

limit

protected int $limit
Type
int

shell

protected MMO\core\server\ShellRunner $shell
Type
ShellRunner

Methods13

all($reload, $archives)

Journal.php:51
function all(bool $reload = false, bool $archives = false): array
$reload = falseboolre-read the file even if it was already loaded.
$archives = falseboolalso read back through the rotated files.
returnsarrayrecorded deployments, oldest first.

append($deployment)

Journal.php:182

Append $deployment and write the file back (atomically, ShellRunner::write), rotating it first when it is full.

function append(MMO\admin\entities\Deployment $deployment): void
$deploymentDeployment
returnsvoid

getAppliedPatches()

Journal.php:167

Every database patch already applied on this target, across all deployments -- the basis of

function getAppliedPatches(): arrayReads the ARCHIVES too, always. A patch whose journal entry has rotated out of the live file has still been applied, and re-running it would be exactly the kind of quiet, destructive mistake this package exists to make impossible.
See
MigrateTask's idempotence.
returnsarraypatch id => the release that applied it

getCurrentRelease()

Journal.php:132
function getCurrentRelease(): ?string
returnsnull | stringthe release currently recorded as live.

getPreviousRelease()

Journal.php:145

The release to roll back to: the one live before the current one.

function getPreviousRelease(): ?stringNot simply `last()->getPrevious()`, because plenty of recorded runs ship nothing -- a database migration, a backup -- and carry no release transition at all. Reading the newest entry blindly would let a migration run erase the rollback target, so this walks back to the last entry that actually MOVED the target, and skips the ones that merely confirm where it already is.
returnsnull | string

history($count)

Journal.php:123
function history(int $count = 10): array
$count = 10int
returnsarraythe $count most recent entries, newest first.

last($outcome)

Journal.php:111
function last(?string $outcome = MMO\admin\entities\Deployment::APPLIED): ?MMO\admin\entities\Deployment
$outcome = MMO\admin\entities\Deployment::APPLIEDnull | stringonly consider entries with this outcome (default: only successful ones).
returnsnull | Deploymentthe most recent matching deployment.

listArchives()

Journal.php:92
function listArchives(): array
returnsarraythe rotated journal files on the target, oldest first.

rotate()

Journal.php:201

Move the live file aside as deployments.{n}.json, keeping every entry it holds.

protected function rotate(): void
returnsvoid

__construct($shell, $filename, $limit)

Journal.php:35
function __construct(MMO\core\server\ShellRunner $shell, string $filename, int $limit = 100)
$shellShellRunner
$filenamestring
$limit = 100int