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

PlainCopies

MMO\admin\helpers · 1 symbole · générée le 30 Nov 2026

class

PlainCopies

PlainCopies.php:20

The register of the databases of this machine that hold a client's data NOT anonymised (ISO/IEC 27001 A.8.33, A.8.11): who restored it, why, until when. backup --restore-locally anonymises by default (BackupTask); --plain restores in clear only with a reason and an end date, and writes it here.

class MMO\admin\helpers\PlainCopies use MMO\core\classes\tSingleton
Espace de noms
MMO\admin\helpers
Utilise les traits
tSingleton
`local-copies` lists the databases of this machine against it: anonymised, plain and registered (expired or not), plain and unregistered -- the copies to drop, by a person. The file is this machine's (`{root}/db/plain-copies.json`, not versioned): what is on its disk.
PlainCopies::Shared()->register('kuehnenagel', 'kuehnenagel', 'reproduce the bug #412 on its data', '2026-11-25'); PlainCopies::Shared()->expired(); // the entries past their date: drop those databases

Index

fictitious
file
maxDays
check($reason, $until)
entries()
expired()
forget($database)
Instantiate($config) static(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
IsShared() static
register($database, $source, $reason, $until, $who)Record a database of this machine as a plain copy
Shared() staticGet the shared instance, creating (and configuring) it on first call.
status($repository)The databases of this machine, each with its state: anonymised (its marker), fictitious ($fictitious), registered (a plain copy of the register, expired past its date), unregistered …
Unshare($serialize) staticRemove the shared instance, so the next Shared() call creates a fresh one.
Who() static
write($entries)

Propriétés3

fictitious

array $fictitious = []
Type
array

file

string $file = '{root}/db/plain-copies.json'
Type
string

maxDays

int $maxDays = 30
Type
int

Méthodes12

check($reason, $until)

PlainCopies.php:36
function check(?string $reason, ?string $until): string
$reasonnull | stringwhy a copy in clear is needed (a ticket, a bug that the anonymised copy does not show)
$untilnull | stringuntil when, YYYY-MM-DD
retournestring$until, checked
lèvewithout a reason, or with a date past, or further than $maxDays

entries()

PlainCopies.php:77
function entries(): array
retournearrayarray{database: string, source: string, who: string, reason: string, until: string, date: string}> by database

expired()

PlainCopies.php:85
function expired(): array
retournearrayarray<string, string>> the entries past their date

forget($database)

PlainCopies.php:68
function forget(string $database): bool
$databasestring
retourneboolwhether $database was registered (it is no longer: anonymised, or dropped)

Instantiate($config)

statictSingleton.php:66

(Re)create the shared instance immediately, configured with $config merged into the class's existing config.

static function Instantiate(array $config = []): staticUnlike a plain [`Shared()`](https://mmoframework.fr/fr/documentation/mmo.admin/php/helpers/PlainCopies.md#plaincopies-shared) call (which lazily builds the instance from whatever config was already loaded), this lets you supply/override config right before the instance is built.
$config = []arrayconfig values merged in before the instance is constructed
retournestaticthe newly (re)created shared instance
MyService::Instantiate(['greeting' => 'yo'])->greeting; // 'yo'

IsShared()

statictSingleton.php:54
static function IsShared(): bool
retournebooltrue if the shared instance has already been created (a call to Shared() would not need to construct a new one)
MyService::IsShared(); // false until the first MyService::Shared() call

register($database, $source, $reason, $until, $who)

PlainCopies.php:54

Record a database of this machine as a plain copy

function register( string $database, string $source, ?string $reason, ?string $until, ?string $who = null ): array
$databasestringthe local database
$sourcestringwhat it is a copy of (the target)
$reasonnull | stringcheck
$untilnull | stringcheck
$who = nullnull | stringthe person (the user of this machine by default)
retournearraystring, source: string, who: string, reason: string, until: string, date: string} the entry

Shared()

statictSingleton.php:22

Get the shared instance, creating (and configuring) it on first call.

static function Shared(): static
retournestatic
MyService::Shared()->greeting; // 'hello'

status($repository)

PlainCopies.php:115

The databases of this machine, each with its state: anonymised (its marker), fictitious ($fictitious), registered (a plain copy of the register, expired past its date), unregistered (a client's data in clear no one answers for)

function status(object $repository): array
$repositoryobjectthe local repository: its getDatabases(), and anonymizedMarker() when it has one (mmo.mongodb)
retournearrayarray{state: string, entry?: array<string, string>, marker?: array<string, mixed>}> by database; the entries of the register whose database is gone too (gone)

Unshare($serialize)

statictSingleton.php:40

Remove the shared instance, so the next Shared() call creates a fresh one.

static function Unshare(bool $serialize = true): bool
Voir
serialize) and kept as the class's config, so the next instance created picks up where this one left off; if false, the instance is simply discarded and the next one starts from the class's original config
$serialize = trueboolif true (the default) and an instance currently exists, it is serialized first (via
retournebooltrue if an instance actually existed and was removed
MyService::Unshare(); // true if MyService::Shared() had already been called; the next call rebuilds it

Who()

staticPlainCopies.php:102
static function Who(): string
retournestringthe person at this machine: its git name, else its user