API / Minn\Ops / ShapeFiles

ShapeFiles final class

Minn\Ops\ShapeFiles · public/minn/src/Minn/Ops/ShapeFiles.php · 104 lines

The files an install lays at the webroot for tooling to find: the shape files from layout/ (index.php, wp-settings.php, version.php and the rest) and one file for each of the reference's wp-includes and wp-admin/includes files, an empty placeholder or, where layout/ ships one, the engine's loader. An engine update lays them again from the new engine: a file still as the replaced engine wrote it is replaced, a missing one is written, and one the site changed is left alone.

Uses 1

Constants and properties

constLAYOUT = array ( 0 => 'index.php', 1 => 'wp-login.php', 2 => 'wp-settings.php', 3 => 'wp-cli.yml', 4 => 'wp-includes/version.php', 5 => 'wp-admin/index.php', )

The shape files copied from layout/ as they are.

Public

staticlay(string $engineDir, string $root): array#

An install: every layout file copied, and each of the reference's files the site lacks written (an empty placeholder found there becomes the loader layout/ ships for it).

@return array{layout: int, placeholders: int} how many were written
staticrefresh(string $engineDir, string $root, string $previous): int#

An update, once the new engine is in place: each file the new engine lays that is missing, or still as the replaced engine ($previous, its folder) laid it, is written from the new one.

staticplaceholder(string $file): string#

The empty placeholder for one of the reference's files.

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateboots(string $root): bool#

Whether the webroot boots the engine: its wp-settings.php requires minn/bootstrap.php.

privatewanted(string $engineDir): array#
@return array<string, string> every file the engine lays, by path from the webroot
privatereferenceFiles(string $engineDir): array#
@return array<string, string> the reference's files, each with the placeholder or loader the engine lays for it
privatestale(string $path, string $want, array $earlier): bool#
$earlierlist<string>what an engine wrote there before
privatewrite(string $path, string $contents): bool#