MMOframework
Pourquoi l'IA Playground Bibliothèques Développeurs Agence
FR EN
Créer un projet en direct
Index

tFileBackup

MMO\core\classes · 1 symbole · générée le 30 Nov 2026

trait

tFileBackup

tFileBackup.php:22
trait MMO\core\classes\tFileBackup
Espace de noms
MMO\core\classes
Voir
iBackupRepository for a database of files: a JSON collection per file (JsonRepository), an SQLite database (mmo.pdo's PDORepository). A dump is a .tar.gz of the files, by their path from the application's root, so it is restored under another root -- a server's release -- as it was made here.
- [`backup`](https://mmoframework.fr/documentation/mmo.core/php/classes/tFileBackup.md#tfilebackup-backup) archives the files where they are (the shell's machine), through [`snapshotFile`](https://mmoframework.fr/documentation/mmo.core/php/classes/tFileBackup.md#tfilebackup-snapshotfile): a plain copy, or what the repository makes consistent (SQLite's `.backup` of a database in use); - [`restore`](https://mmoframework.fr/documentation/mmo.core/php/classes/tFileBackup.md#tfilebackup-restore) extracts into a folder beside the files, then moves each into place: a rename, so the site reads the old file or the new one, never half of one. Only the collections asked; with `$drop`, the repository's files the dump does not hold are removed. The class gives `getBackupFiles`; `BACKUP_KIND` names its dumps (`20261112-153000-json.tar.gz`).

Propriétés2

backupFolder

string $backupFolder = '{root}/db/backups'
Type
string

backupRoot

string $backupRoot = '{root}'
Type
string

Méthodes7

backup($filename, $database, $shell, $remoteFile)

tFileBackup.php:55
function backup( ?string $filename = null, ?string $database = null, ?MMO\core\interfaces\iShell $shell = null, ?string $remoteFile = null ): string
$filename = nullnull | string
$database = nullnull | string
$shell = nullnull | iShell
$remoteFile = nullnull | string
retournestring

getBackupPaths()

tFileBackup.php:43
function getBackupPaths(): array
retournearraystring> collection => its file, from the application's root
lèvewhen a file is not under it: it would not be where a release has it

restore($filename, $database, $collections, $shell, $oldDatabase, $drop)

tFileBackup.php:93
function restore( DateTimeInterface|string|int $filename, ?string $database = null, ?array $collections = null, ?MMO\core\interfaces\iShell $shell = null, ?string $oldDatabase = null, bool $drop = true ): void
$filenameDateTimeInterface | string | int
$database = nullnull | string
$collections = nullnull | array
$shell = nullnull | iShell
$oldDatabase = nullnull | string
$drop = truebool
retournevoid

snapshotFile($from, $to)

tFileBackup.php:91
protected function snapshotFile(string $from, string $to): string
$fromstringa file of the database, on the shell's machine
$tostringwhere its copy goes
retournestringthe shell command copying it as one moment of it: a plain copy; a database in use says otherwise