| 1 |
# includes/root-boot/ |
| 2 |
|
| 3 |
Procedural bootstrap functions for the plugin entry point (`404-solution.php`). |
| 4 |
|
| 5 |
## What belongs here |
| 6 |
|
| 7 |
The global `abj404_*` functions that the WordPress plugin entry-point file |
| 8 |
delegates to: early settings/path helpers, the runtime clock/logging helpers, |
| 9 |
request benchmarking instrumentation, the boot-failure shutdown handler, the |
| 10 |
degraded-install admin surface, cron-action listeners, the locale filter, |
| 11 |
admin-notice renderers, localhost diagnostics, and the `admin_init` readiness |
| 12 |
handlers. |
| 13 |
|
| 14 |
The class autoloader itself stays in `404-solution.php` (it cannot be moved here |
| 15 |
because `AutoloaderTraitDependenciesCompletenessTest` reads its |
| 16 |
`$traitDependencyClasses` array from the entry-point source text). |
| 17 |
|
| 18 |
These are **procedural global functions**, not classes. They are registered |
| 19 |
with WordPress as hook callbacks by string name (e.g. |
| 20 |
`add_action('template_redirect', 'abj404_404listener')`), so they must remain |
| 21 |
global functions with stable names and signatures. They are intentionally NOT |
| 22 |
converted to class methods or traits: doing so would change the hook |
| 23 |
registration contract. |
| 24 |
|
| 25 |
Each file here is `require_once`'d from `404-solution.php` immediately after the |
| 26 |
autoloader is registered, so every function is defined before any top-level |
| 27 |
executable statement (the `add_action`/`add_filter` registrations, the option |
| 28 |
read, the benchmark calls) that references it runs. |
| 29 |
|
| 30 |
## What does NOT belong here |
| 31 |
|
| 32 |
- Service-container registration. That lives in `includes/bootstrap/` |
| 33 |
(`CoreServiceRegistration.php`, etc.) and is wired through |
| 34 |
`includes/bootstrap.php` / `includes/Loader.php`. Do not mix DI registration |
| 35 |
into this directory. |
| 36 |
- Business logic, data access, or view rendering of the plugin proper. Those |
| 37 |
live in their own `includes/` subtrees and are loaded lazily via the |
| 38 |
autoloader. Functions here only *bootstrap* and *route to* that code. |
| 39 |
|
| 40 |
## Why some entry-point functions stay in `404-solution.php` |
| 41 |
|
| 42 |
A set of structural tests (e.g. `CronListenerServiceWiringTest`, |
| 43 |
`OpcacheStaleAfterUpgradeTest`, `PageLoadFallbackHookRegistrationTest`, |
| 44 |
`FeedbackTransportCronListenerTest`, `SqlFileIntegrityListCompletenessTest`, |
| 45 |
`BlankPagePreventionTest`, `CollationAutoRecoveryTest`) read the source *text* |
| 46 |
of `404-solution.php` and assert that specific `abj404_*` functions are defined |
| 47 |
there (and inspect their bodies). Those functions cannot be moved without |
| 48 |
breaking those tests, so they remain in the entry-point file. Everything not |
| 49 |
pinned by such a test is extracted here. |
| 50 |
|
| 51 |
## Direct-access guard |
| 52 |
|
| 53 |
Every file in this directory begins with `<?php` and the standard |
| 54 |
`if (!defined('ABSPATH')) { exit; }` guard, enforced by `DirectAccessGuardTest`. |
| 55 |
|