LegacyLayoutCleanup
in package
Remove leftover v1 `wp-content/<32-hex>/` trees and flat hashed `.js` files.
Table of Contents
Constants
- MARKER_PREFIX_BYTES : mixed = 65536
Methods
- run() : mixed
- Sweep leftover v1 anonymous files under `WP_CONTENT_DIR`.
- bodyAllowed() : mixed
- Whether file contents pass the marker gate.
- directoryAllowed() : mixed
- Whether a leftover hash tree may be deleted given body markers.
- readPrefix() : string|false
- First 64KiB of a leftover JS file. Markers live in the bundle body; reading the whole file OOMs.
Constants
MARKER_PREFIX_BYTES
public
mixed
MARKER_PREFIX_BYTES
= 65536
Methods
run()
Sweep leftover v1 anonymous files under `WP_CONTENT_DIR`.
public
static run([array<string|int, string> $markers = [] ]) : mixed
Parameters
- $markers : array<string|int, string> = []
-
File-body substrings that must appear before anything is deleted
bodyAllowed()
Whether file contents pass the marker gate.
private
static bodyAllowed(string|false $body, array<string|int, string> $markers) : mixed
Parameters
- $body : string|false
- $markers : array<string|int, string>
directoryAllowed()
Whether a leftover hash tree may be deleted given body markers.
private
static directoryAllowed(string $dir, array<string|int, string> $markers) : mixed
Parameters
- $dir : string
-
Hash directory (contains
dist/ordev/) - $markers : array<string|int, string>
readPrefix()
First 64KiB of a leftover JS file. Markers live in the bundle body; reading the whole file OOMs.
private
static readPrefix(string $path) : string|false
Parameters
- $path : string