MMOframework
Why AI Playground Libraries Developers Agency
FR EN
Build a project live
Index

BackupFiles

MMO\admin\helpers · 1 symbol · generated 30 Nov 2026

class

BackupFiles

BackupFiles.php:16

A site's backups, where they are: on its server ({folder}/backups) and on this machine (what backup --fetch and backup-fetch brought), grouped into their sets (BackupSets) -- a set's encrypted copies (.age) with it --, and what deleting some of them, or keeping only the newest, takes away. Each place always keeps its newest complete set (every part the site's backup makes): no pick, nor any number to keep, reaches it.

class MMO\admin\helpers\BackupFiles
Namespace
MMO\admin\helpers
$inventory = BackupFiles::Inventory('alcon', $serverFiles, $localFiles, ['databases', 'files', 'config']); $plan = BackupFiles::Plan($inventory, ['keep' => 3, 'where' => ['server']]); $plan['server']; // the files to delete there, oldest sets first

Index

WHEREwhere a site's backups are: its server's backups/, this machine's copies
Inventory($target, $server, $local, $expects) staticA site's sets, in both places.
Leaving($files) staticThe files of a set that may leave the server: each part's encrypted copy when there is one, else its plain one -- but the configuration, which leaves encrypted or not at all (…
Ordered($parts) static
Parse($target, $file) static
Plan($inventory, $pick) staticWhat deleting takes away.

Constants1

WHERE

where a site's backups are: its server's backups/, this machine's copies

const WHERE = ['server', 'local']

Methods5

Inventory($target, $server, $local, $expects)

staticBackupFiles.php:30

A site's sets, in both places.

static function Inventory(string $target, array $server, array $local, array $expects): array
$targetstringthe site's name
$serverarray
$localarray
$expectsarraythe parts a complete set holds (BackupSets::PARTS): the site's backup makes them
returnsarraylist<array{stamp: string, at: int, parts: list<string>, places: array<string, array{files: list<string>, size: int, parts: list<string>, complete: bool}>}>, others: list<array{file: string, size: int, at: int}>, protected: array<string, ?string>, totals: array<string, array{sets: int, size: int}>, expects: list<string>} the sets newest first; others the server's files of no set; protected each place's newest complete set

Leaving($files)

staticBackupFiles.php:141

The files of a set that may leave the server: each part's encrypted copy when there is one, else its plain one -- but the configuration, which leaves encrypted or not at all (SiteBackupTask).

static function Leaving(array $files): array
$filesarraya set's files on the server
returnsarraylist<string>, left: list<string>} what to download, and what stays (a plain configuration)

Parse($target, $file)

staticBackupFiles.php:158
static function Parse(string $target, string $file): ?array
$targetstring
$filestringa backup file's name, its .age copy too
returnsnull | arraystring, 1: string}|null its set's time and its part (databases, files, config), null when it is no set's

Plan($inventory, $pick)

staticBackupFiles.php:86

What deleting takes away.

static function Plan(array $inventory, array $pick): array
$inventoryarrayInventory
$pickarray
returnsarraylist<string>, local: list<string>, kept: list<array{where: string, stamp: string, why: string}>, sets: array<string, list<string>>} the files to delete in each place; what was picked and is kept, and why; sets each place's sets deleted
throwsfor nothing picked, a set or a file that is none, a number to keep below 1