You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simplify legacy-wp/ patches and trim verbose comments
Reviewed every patch in legacy-wp/legacy-fixes.ts (and supporting files)
for need, gating tightness, and comment clarity. Net: 4828 → 3672 lines.
Verified WP 1.0–4.9 + PHP 5.2 still boot end-to-end.
Notable changes:
- Drop ensureLegacyAdminAuth — duplicated the auto-login flow already
provided by legacy-mu-plugins.ts.
- Drop the wp_check_mysql_version no-op — mysql-shims.ts already
returns '8.0.0' from mysql_get_server_info.
- Drop the dead overrides array in patchWpAdminRelativePaths — the
generic regex pass already covers every entry.
- Drop duplicate mysql_/mysqli_/str_* stubs from generateDbPhpContent —
the 0-sqlite.php preload runs first and already defines them.
- Share legacyAuthCookieBlock(usernameExpr) between
patchAdminAuthRedirect and patchAdminAjaxAuth; replace their brittle
wp-settings.php text scans with readOnDiskWpVersion gates.
- Add explicit version gates to patchLegacyWpCategoriesZeroPk,
patchWpSchemaPhp, patchWp47ThemeSearchForms, and
patchAdminNetworkCalls instead of needle-only / file-existence
heuristics.
- Replace the fragile one-level-nesting regex in patchCheckAdminReferer
with a reusable balanced-brace helper (replacePhpFunctionBody), reused
by the "not installed" die() and the do_action('init') rewrite
extracted out of patchWpSettingsPhp.
- Fix patchWpSettingsPhp bug where settingsChanged was set
unconditionally inside the error_reporting block, rewriting
wp-settings on every boot.
- Split the PHP 5.2 vs 5.3+ error-handler boilerplate in
legacy-mu-plugins.ts into named helpers instead of inline ternaries.
- Trim multi-paragraph "## The bug / ## The fix" docblocks to a single
why-sentence each, dropping embedded WP source samples and
indentation diagrams.
0 commit comments