Commit 373d90a
committed
Fix wp-admin loading on legacy WordPress versions
Three issues prevented wp-admin from working on PHP 5.6:
1. template.php and media.php were replaced with empty stubs as a
workaround for the WASM parser size limit. The real fix is to
strip doc comments (which stripDocCommentsFromWpIncludes already
does). Remove the stub replacement. Also preserve ?> tags during
comment stripping — PHP's ?> closes PHP mode even inside //
comments.
2. Old WordPress (< 3.7) uses relative paths in wp-admin scripts.
Patch these to use dirname(__FILE__) for absolute resolution.
Covers index.php, index-extra.php, and admin.php across all
old WP versions.
3. Auth cookies don't persist correctly for old WordPress admin
sessions. Fix by re-generating auth cookies on every admin
request: mu-plugin for WP 2.8+, direct admin.php patch for
WP < 2.8 (no mu-plugin support). Handles three auth eras:
- WP 2.5+: wp_generate_auth_cookie + $_COOKIE population
- WP 2.0-2.4: USER_COOKIE/PASS_COOKIE with md5(md5(password))
- WP 1.5: COOKIEHASH-based hardcoded cookie names
Also skip prefetchUpdateChecks for WP < 5.0 (the functions it
calls don't exist in old WP), skip 0-playground.php mu-plugin
for WP < 3.0 (closures in hooks cause fatal errors), and set up
wp_user_roles + usermeta when missing after install.1 parent a5fe6f7 commit 373d90a
File tree
4 files changed
+578
-23
lines changed- packages/playground
- client/src
- remote/src/lib/playground-mu-plugin
- wordpress
- src
- tests
4 files changed
+578
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | | - | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
2 | 9 | | |
3 | 10 | | |
4 | 11 | | |
| |||
0 commit comments