MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

CachedPhar

MMO\admin\helpers · 1 symbole · générée le 27 Oct 2026

class

CachedPhar

CachedPhar.php:26

Whether the .phar a package manager keeps for a package (PackageManifest::getBuildFilename) still holds the package's sources -- read, not guessed from dates.

class MMO\admin\helpers\CachedPhar
Espace de noms
MMO\admin\helpers
The package manager reuses a phar it built before as long as no source file is newer than it ([`PackageManifest::isPackageUpToDate`](https://mmoframework.fr/fr/documentation/mmo.core/php/helpers/PackageManifest.md#packagemanifest-ispackageuptodate)). That misses what is not a source -- the package's mmo.json above all -- and a file whose date went back. my.oviepro 5.0.0 changed its modules' mmo.json (their dependencies: oviepro 5.*, mmo.core 21.*) without changing their versions: the release reused `build/oviepro.modules.<name>.<version>.phar`, which still carried the old manifests, and the server answered "missing dependency [mmo.core 20.*]". So the phar is opened and every file it holds compared with the file the build would put there today -- the same list [`build`](https://mmoframework.fr/fr/documentation/mmo.core/php/packages.md#build) packages: the bootstrap, mmo.json, the sources, the documentations and the skills. A phar that differs is rebuilt ([`BuildTask::apply`](https://mmoframework.fr/fr/documentation/mmo.admin/php/tasks/BuildTask.md#buildtask-apply)); one that matches is reused, even when its sources' dates say otherwise.
CachedPhar::whyStale($manifest); // null: up to date; 'mmo.json differs': rebuild it

Index

SHOWNHow many differing files a reason names.
readPhar($phar) static
readSources($manifest) static
whyStale($manifest, $phar) static

Constantes1

SHOWN

How many differing files a reason names.

const SHOWN = 3

Méthodes3

readPhar($phar)

staticCachedPhar.php:107
static function readPhar(string $phar): ?array
$pharstring
retournenull | arraystring>|null path => sha1 of its content for every file $phar holds, null when it cannot be opened (not a phar, or one whose alias another loaded phar already uses). PHP keeps the phar in its cache after this: to build another at its path, delete it with \Phar::unlinkArchive, as \MMO\core\files\package does.

readSources($manifest)

staticCachedPhar.php:65
static function readSources(MMO\core\helpers\PackageManifest $manifest): array
$manifestPackageManifest
retournearraystring> path in the phar => sha1 of its content: what building the package now would package, as \MMO\core\packages\build and \MMO\core\files\package name it.

whyStale($manifest, $phar)

staticCachedPhar.php:36
static function whyStale(MMO\core\helpers\PackageManifest $manifest, ?string $phar = null): ?string
$manifestPackageManifesta package built from a folder (a phar package is its own build: never stale).
$phar = nullnull | stringthe phar to compare (null: the package's own, PackageManifest::getBuildFilename).
retournenull | stringwhy $phar does not hold what the package's folder would build ('mmo.json differs', 'src/A.php differs, src/B.php is new'), null when it does -- or when there is no phar to reuse.