@wp-playground/wordpress 3.1.20 → 3.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/boot.d.ts +7 -0
- package/database-prerequisites.d.ts +9 -0
- package/index.cjs +1651 -193
- package/index.cjs.map +1 -1
- package/index.d.ts +7 -2
- package/index.js +2719 -441
- package/index.js.map +1 -1
- package/legacy-wp/legacy-boot.d.ts +39 -0
- package/legacy-wp/legacy-fixes.d.ts +86 -0
- package/legacy-wp/legacy-mu-plugins.d.ts +21 -0
- package/legacy-wp/legacy-sqlite-preload.d.ts +13 -0
- package/legacy-wp/mysql-shims.d.ts +18 -0
- package/package.json +8 -7
- package/platform-mu-plugins.d.ts +11 -0
- package/sqlite-preload-loader.d.ts +8 -0
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy WordPress boot flow.
|
|
3
|
+
*
|
|
4
|
+
* Self-contained entry point for legacy PHP (5.2 WASM) running old
|
|
5
|
+
* WordPress (1.0–4.9) on SQLite. Mirrors the structure of
|
|
6
|
+
* {@link bootWordPress} in boot.ts but with every legacy-specific
|
|
7
|
+
* step — source patches, db.php drop-in, defensive installer
|
|
8
|
+
* dispatch, PDO post-install fixups — co-located here so the modern
|
|
9
|
+
* boot flow stays free of `isLegacyPhp` branches.
|
|
10
|
+
*
|
|
11
|
+
* Nothing in this module runs for modern PHP; boot.ts only delegates
|
|
12
|
+
* here when isLegacyPHPVersion(options.phpVersion) is true.
|
|
13
|
+
*/
|
|
14
|
+
import type { PHP, PHPRequestHandler } from '@php-wasm/universal';
|
|
15
|
+
import type { BootWordPressOptions } from '../boot';
|
|
16
|
+
/**
|
|
17
|
+
* Merges the legacy network disable list into php.ini for legacy PHP
|
|
18
|
+
* (no-op on modern). Merge instead of overwrite so a caller-supplied
|
|
19
|
+
* disable_functions list is preserved.
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyLegacyPhpIniOverrides(php: PHP, options: {
|
|
22
|
+
phpVersion?: string;
|
|
23
|
+
phpIniEntries?: Record<string, string>;
|
|
24
|
+
}): void;
|
|
25
|
+
/**
|
|
26
|
+
* Boots a legacy WordPress instance (PHP 5.2 + WP 1.0–4.9 on SQLite).
|
|
27
|
+
*
|
|
28
|
+
* Mirrors {@link bootWordPress}'s step ordering but runs the legacy
|
|
29
|
+
* variant of each step:
|
|
30
|
+
*
|
|
31
|
+
* * wp-config-sample fallback instead of ensureWpConfig()
|
|
32
|
+
* * patchWordPressSourceFiles() for WP source-level fixes
|
|
33
|
+
* * full-content db.php drop-in (not a placeholder)
|
|
34
|
+
* * defensive install.php dispatch with per-WP-version fallbacks
|
|
35
|
+
* * PDO-based post-install schema completion
|
|
36
|
+
* * no assertValidDatabaseConnection — loading wp-load.php for
|
|
37
|
+
* the check can trigger WASM traps that corrupt the runtime
|
|
38
|
+
*/
|
|
39
|
+
export declare function bootLegacyWordPress(requestHandler: PHPRequestHandler, options: BootWordPressOptions): Promise<PHPRequestHandler>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress source-file patches for legacy / mid-modern WordPress.
|
|
3
|
+
*
|
|
4
|
+
* Two kinds of patches live here:
|
|
5
|
+
*
|
|
6
|
+
* * Full source-level rewrites that let WordPress 1.0–2.8 boot on
|
|
7
|
+
* the PHP 5.2 WASM + SQLite stack. Entry point:
|
|
8
|
+
* {@link patchWordPressSourceFiles}. Used from legacy-wp/legacy-boot.ts.
|
|
9
|
+
* * A mysqli-check backport that lets WP 5.0–6.1 boot on SQLite.
|
|
10
|
+
* Entry point: {@link backportWpPreV62MysqlCheck}. Used from the
|
|
11
|
+
* main boot.ts flow.
|
|
12
|
+
*
|
|
13
|
+
* In addition this file exposes a PDO-based post-install fixup
|
|
14
|
+
* ({@link runPostInstallLegacyFixups}) and a legacy-db.php generator
|
|
15
|
+
* ({@link generateDbPhpContent}) that legacy-wp/legacy-boot.ts composes
|
|
16
|
+
* into its install flow.
|
|
17
|
+
*
|
|
18
|
+
* Patches are plain, idempotent string replacements — no PHP parser.
|
|
19
|
+
* Each one plants a `pg_*` marker so re-runs are no-ops, and its
|
|
20
|
+
* match string is narrow enough that non-matching WP versions are
|
|
21
|
+
* silently skipped. {@link patchWordPressSourceFiles} also gates
|
|
22
|
+
* range-specific patches on the on-disk `$wp_version`; the rest
|
|
23
|
+
* rely on match specificity alone. Legacy WP releases are frozen,
|
|
24
|
+
* so a needle that matches today will keep matching tomorrow.
|
|
25
|
+
*
|
|
26
|
+
* The balance is delicate: a patch may have been quietly covering
|
|
27
|
+
* more WP versions than it advertises, so tightening a needle or
|
|
28
|
+
* changing the replacement can break one you didn't know about.
|
|
29
|
+
* The boot-smoke suite in `tests/test-legacy-wp-version-boot.mjs`
|
|
30
|
+
* exercises every supported legacy WP version end-to-end; run it
|
|
31
|
+
* before landing changes here.
|
|
32
|
+
*/
|
|
33
|
+
import type { PHP } from '@php-wasm/universal';
|
|
34
|
+
/**
|
|
35
|
+
* Backports WP 6.2's mysqli check to WP 5.0–6.1 on SQLite: the
|
|
36
|
+
* `extension_loaded('mysqli')` guard in `wp_check_php_mysql_versions()`
|
|
37
|
+
* runs before `$wpdb` and before `WP_CONTENT_DIR` is defined, so
|
|
38
|
+
* neither a userland stub nor a `wp-content/db.php` drop-in can
|
|
39
|
+
* satisfy it — the source itself has to change.
|
|
40
|
+
*/
|
|
41
|
+
export declare function backportWpPreV62MysqlCheck(php: PHP, documentRoot: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* PHP error_reporting mask for legacy WordPress: all errors EXCEPT
|
|
44
|
+
* E_DEPRECATED (8192) and E_STRICT (2048). Old WordPress class
|
|
45
|
+
* declarations (e.g. Walker_Page) trigger E_STRICT during compile;
|
|
46
|
+
* masking it keeps install and bootstrap output clean.
|
|
47
|
+
*
|
|
48
|
+
* Keep the two representations below in sync: on PHP 5.2, E_ALL is
|
|
49
|
+
* 0x7fff (before E_STRICT was folded into E_ALL in PHP 5.4), so
|
|
50
|
+
* `0x7fff & ~8192 & ~2048` is the numeric equivalent of the PHP
|
|
51
|
+
* expression `E_ALL & ~8192 & ~2048`.
|
|
52
|
+
*/
|
|
53
|
+
export declare const LEGACY_WP_ERROR_REPORTING_VALUE: number;
|
|
54
|
+
export declare const LEGACY_WP_ERROR_REPORTING_PHP_EXPR = "E_ALL & ~8192 & ~2048";
|
|
55
|
+
/**
|
|
56
|
+
* Patches WordPress source files for legacy version compatibility.
|
|
57
|
+
*
|
|
58
|
+
* Applies all necessary patches to make old WordPress versions
|
|
59
|
+
* (1.0 through 2.8) work with modern PHP and the SQLite integration.
|
|
60
|
+
*
|
|
61
|
+
* Called from legacy-wp/legacy-boot.ts; legacy boot path only.
|
|
62
|
+
*/
|
|
63
|
+
export declare function patchWordPressSourceFiles(php: PHP, documentRoot: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the PHP content for wp-content/db.php.
|
|
66
|
+
*
|
|
67
|
+
* This db.php provides MySQL/MySQLi function stubs and, for WP < 3.0,
|
|
68
|
+
* loads the SQLite integration directly. Modern WP only needs this file
|
|
69
|
+
* to *exist* (to bypass the extension_loaded('mysql') check), but old
|
|
70
|
+
* WP actually uses the stubs defined here.
|
|
71
|
+
*/
|
|
72
|
+
export declare function generateDbPhpContent(): string;
|
|
73
|
+
/**
|
|
74
|
+
* Post-install fixups for legacy WordPress.
|
|
75
|
+
*
|
|
76
|
+
* Stage 1 (always): boots WordPress and patches data via $wpdb —
|
|
77
|
+
* siteurl/home, admin password, roles/caps, default content.
|
|
78
|
+
*
|
|
79
|
+
* Stage 2 (WP < 3.5 only): direct PDO writes that create the WP 1.x-era
|
|
80
|
+
* schema and seed users/posts/categories/options. Runs in addition to
|
|
81
|
+
* stage 1 (idempotent guards), so it backfills whatever stage 1 missed
|
|
82
|
+
* — including the case where wp-load.php crashed before stage 1 ran.
|
|
83
|
+
* Skipped for WP 3.5+ to avoid polluting the AST driver's schema with
|
|
84
|
+
* legacy-shaped tables it never registers in information_schema.
|
|
85
|
+
*/
|
|
86
|
+
export declare function runPostInstallLegacyFixups(php: PHP, siteUrl: string): Promise<void>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-level mu-plugin setup for legacy PHP (< 7) running old
|
|
3
|
+
* WordPress (1.0–2.8). Self-contained mirror of
|
|
4
|
+
* {@link setupPlatformLevelMuPlugins} in index.ts — the modern
|
|
5
|
+
* function dispatches here when isLegacyPHPVersion(phpVersion) is
|
|
6
|
+
* true, and this file owns every PHP string that differs from the
|
|
7
|
+
* modern path.
|
|
8
|
+
*
|
|
9
|
+
* The three common mu-plugins (0-playground.php, sitemap-redirect,
|
|
10
|
+
* inline-tinymce-content-css) are shared with the modern path via
|
|
11
|
+
* {@link writeCommonPlatformMuPlugins} to avoid duplicating ~200
|
|
12
|
+
* lines of identical PHP.
|
|
13
|
+
*/
|
|
14
|
+
import type { UniversalPHP } from '@php-wasm/universal';
|
|
15
|
+
/**
|
|
16
|
+
* Full legacy version of {@link setupPlatformLevelMuPlugins}. Writes
|
|
17
|
+
* a custom auto_prepend_file, legacy-aware preload env.php, legacy
|
|
18
|
+
* auto-login mu-plugin, the common platform mu-plugins, and the PHP
|
|
19
|
+
* 5.2 variant of the error handler.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setupLegacyPlatformLevelMuPlugins(php: UniversalPHP): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy WordPress SQLite preload setup for legacy PHP (< 7) running
|
|
3
|
+
* WP 1.0–4.9 on SQLite. Self-contained mirror of
|
|
4
|
+
* {@link preloadSqliteIntegration} in index.ts — the modern function
|
|
5
|
+
* dispatches here when isLegacyPHPVersion(phpVersion) is true.
|
|
6
|
+
*
|
|
7
|
+
* Uses the shared {@link SQLITE_PRELOAD_LOADER_CLASS} helper so the
|
|
8
|
+
* Playground_SQLite_Integration_Loader class definition stays in
|
|
9
|
+
* sync between modern and legacy preloads.
|
|
10
|
+
*/
|
|
11
|
+
import type { UniversalPHP } from '@php-wasm/universal';
|
|
12
|
+
import type { SqliteIntegrationOptions } from '..';
|
|
13
|
+
export declare function preloadLegacySqliteIntegration(php: UniversalPHP, sqliteZip: File, _options?: SqliteIntegrationOptions): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mysql_* / mysqli_* function stubs for legacy WordPress (<3.0) whose
|
|
3
|
+
* wpdb::__construct calls mysql_connect() / mysqli_init() inline and
|
|
4
|
+
* bail()s on a falsy return, and for WP 1.x code paths that call
|
|
5
|
+
* mysql_query() / mysql_list_tables() / mysql_fetch_row() directly
|
|
6
|
+
* (bypassing $wpdb).
|
|
7
|
+
*
|
|
8
|
+
* Result sets returned by mysql_query() / mysql_list_tables() live in
|
|
9
|
+
* the $_mysql_results global keyed by an integer id; mysql_fetch_*
|
|
10
|
+
* consume rows from there.
|
|
11
|
+
*
|
|
12
|
+
* Every stub is function_exists()-guarded so the constant is safe to
|
|
13
|
+
* include alongside real ext/mysql or to interpolate twice.
|
|
14
|
+
*
|
|
15
|
+
* Interpolated into the 0-sqlite.php preload built by
|
|
16
|
+
* {@link buildLegacySqlitePreload} in legacy-sqlite-preload.ts.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MYSQL_SHIMS_PHP = "\n// Connection stubs \u2014 wpdb::__construct bails on a falsy return.\nif (!function_exists('mysqli_connect')) {\n\tfunction mysqli_connect() { return true; }\n}\nif (!function_exists('mysqli_init')) {\n\tfunction mysqli_init() { return true; }\n}\nif (!function_exists('mysql_connect')) {\n\tfunction mysql_connect() { return true; }\n}\nif (!function_exists('mysql_select_db')) {\n\tfunction mysql_select_db() { return true; }\n}\n// WordPress < 3.0 wpdb::__construct calls mysql_set_charset directly.\nif (!function_exists('mysql_set_charset')) {\n\tfunction mysql_set_charset() { return true; }\n}\n// Functional mysql_* stubs that delegate to $wpdb (SQLite driver).\n$GLOBALS['_mysql_results'] = array();\n$GLOBALS['_mysql_result_id'] = 0;\nif (!function_exists('mysql_query')) {\n\tfunction mysql_query($query, $link = null) {\n\t\tglobal $wpdb;\n\t\tif (isset($wpdb) && method_exists($wpdb, 'query')) {\n\t\t\t$wpdb->query($query);\n\t\t\tif (preg_match('/^\\s*(SELECT|SHOW|DESCRIBE|EXPLAIN)/i', $query)) {\n\t\t\t\t$rows = isset($wpdb->last_result) ? $wpdb->last_result : array();\n\t\t\t\t$id = ++$GLOBALS['_mysql_result_id'];\n\t\t\t\t$GLOBALS['_mysql_results'][$id] = array(\n\t\t\t\t\t'rows' => $rows,\n\t\t\t\t\t'index' => 0,\n\t\t\t\t);\n\t\t\t\treturn $id;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\nif (!function_exists('mysql_error')) {\n\tfunction mysql_error($link = null) {\n\t\tglobal $wpdb;\n\t\tif (isset($wpdb) && isset($wpdb->last_error)) {\n\t\t\treturn $wpdb->last_error;\n\t\t}\n\t\treturn '';\n\t}\n}\nif (!function_exists('mysql_list_tables')) {\n\tfunction mysql_list_tables($db = '', $link = null) {\n\t\tglobal $wpdb;\n\t\tif (isset($wpdb) && method_exists($wpdb, 'get_results')) {\n\t\t\t$tables = $wpdb->get_results(\n\t\t\t\t\"SELECT name FROM sqlite_master WHERE type='table' ORDER BY name\"\n\t\t\t);\n\t\t\t$rows = array();\n\t\t\tif ($tables) {\n\t\t\t\tforeach ($tables as $t) {\n\t\t\t\t\t$obj = new stdClass();\n\t\t\t\t\t$obj->name = is_object($t) ? $t->name : $t['name'];\n\t\t\t\t\t$rows[] = $obj;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$id = ++$GLOBALS['_mysql_result_id'];\n\t\t\t$GLOBALS['_mysql_results'][$id] = array(\n\t\t\t\t'rows' => $rows,\n\t\t\t\t'index' => 0,\n\t\t\t);\n\t\t\treturn $id;\n\t\t}\n\t\treturn false;\n\t}\n}\nif (!function_exists('mysql_fetch_row')) {\n\tfunction mysql_fetch_row($result) {\n\t\tif (!isset($GLOBALS['_mysql_results'][$result])) return null;\n\t\t$r = &$GLOBALS['_mysql_results'][$result];\n\t\tif ($r['index'] >= count($r['rows'])) return null;\n\t\t$row = $r['rows'][$r['index']++];\n\t\treturn array_values((array)$row);\n\t}\n}\nif (!function_exists('mysql_fetch_object')) {\n\tfunction mysql_fetch_object($result) {\n\t\tif (!isset($GLOBALS['_mysql_results'][$result])) return null;\n\t\t$r = &$GLOBALS['_mysql_results'][$result];\n\t\tif ($r['index'] >= count($r['rows'])) return null;\n\t\treturn (object)(array)$r['rows'][$r['index']++];\n\t}\n}\nif (!function_exists('mysql_num_rows')) {\n\tfunction mysql_num_rows($result) {\n\t\tif (isset($GLOBALS['_mysql_results'][$result])) {\n\t\t\treturn count($GLOBALS['_mysql_results'][$result]['rows']);\n\t\t}\n\t\treturn 0;\n\t}\n}\nif (!function_exists('mysql_get_server_info')) {\n\tfunction mysql_get_server_info() { return '8.0.0'; }\n}\nif (!function_exists('mysql_affected_rows')) {\n\tfunction mysql_affected_rows() {\n\t\tglobal $wpdb;\n\t\tif (isset($wpdb) && isset($wpdb->rows_affected)) {\n\t\t\treturn $wpdb->rows_affected;\n\t\t}\n\t\treturn 0;\n\t}\n}\nif (!function_exists('mysql_insert_id')) {\n\tfunction mysql_insert_id() {\n\t\tglobal $wpdb;\n\t\tif (isset($wpdb) && isset($wpdb->insert_id)) {\n\t\t\treturn $wpdb->insert_id;\n\t\t}\n\t\treturn 0;\n\t}\n}\nif (!function_exists('mysql_free_result')) {\n\tfunction mysql_free_result($result) {\n\t\tunset($GLOBALS['_mysql_results'][$result]);\n\t\treturn true;\n\t}\n}\nif (!function_exists('mysql_num_fields')) {\n\tfunction mysql_num_fields($result) {\n\t\tif (isset($GLOBALS['_mysql_results'][$result])\n\t\t\t&& !empty($GLOBALS['_mysql_results'][$result]['rows'])) {\n\t\t\treturn count((array)$GLOBALS['_mysql_results'][$result]['rows'][0]);\n\t\t}\n\t\treturn 0;\n\t}\n}\nif (!function_exists('mysql_real_escape_string')) {\n\tfunction mysql_real_escape_string($s) { return addslashes($s); }\n}\nif (!function_exists('mysql_escape_string')) {\n\tfunction mysql_escape_string($s) { return addslashes($s); }\n}";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-playground/wordpress",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.22",
|
|
4
4
|
"description": "WordPress-related plumbing for WordPress Playground",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,21 +35,22 @@
|
|
|
35
35
|
"access": "public",
|
|
36
36
|
"directory": "../../../dist/packages/playground/wordpress"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "04c986b63dd56fe74e4ed0cf04d00cae7ac050bf",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"express": "4.22.0",
|
|
41
41
|
"fast-xml-parser": "^5.5.1",
|
|
42
42
|
"fs-ext-extra-prebuilt": "2.2.7",
|
|
43
43
|
"ini": "4.1.2",
|
|
44
44
|
"jsonc-parser": "3.3.1",
|
|
45
|
+
"playwright": "1.55.1",
|
|
45
46
|
"wasm-feature-detect": "1.8.0",
|
|
46
47
|
"ws": "8.18.0",
|
|
47
48
|
"yargs": "17.7.2",
|
|
48
|
-
"@php-wasm/universal": "3.1.
|
|
49
|
-
"@php-wasm/util": "3.1.
|
|
50
|
-
"@php-wasm/logger": "3.1.
|
|
51
|
-
"@wp-playground/common": "3.1.
|
|
52
|
-
"@php-wasm/node": "3.1.
|
|
49
|
+
"@php-wasm/universal": "3.1.22",
|
|
50
|
+
"@php-wasm/util": "3.1.22",
|
|
51
|
+
"@php-wasm/logger": "3.1.22",
|
|
52
|
+
"@wp-playground/common": "3.1.22",
|
|
53
|
+
"@php-wasm/node": "3.1.22"
|
|
53
54
|
},
|
|
54
55
|
"packageManager": "npm@10.9.2",
|
|
55
56
|
"overrides": {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UniversalPHP } from '@php-wasm/universal';
|
|
2
|
+
/**
|
|
3
|
+
* Writes the Playground platform mu-plugins that run on every
|
|
4
|
+
* supported PHP/WordPress combination — 0-playground.php,
|
|
5
|
+
* sitemap-redirect.php, inline-tinymce-content-css.php.
|
|
6
|
+
*
|
|
7
|
+
* Both {@link setupPlatformLevelMuPlugins} (modern path) and
|
|
8
|
+
* {@link setupLegacyPlatformLevelMuPlugins} call this to avoid
|
|
9
|
+
* duplicating ~200 lines of identical PHP strings.
|
|
10
|
+
*/
|
|
11
|
+
export declare function writeCommonPlatformMuPlugins(php: UniversalPHP): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared Playground_SQLite_Integration_Loader class definition,
|
|
3
|
+
* parameterized by the load_sqlite_integration() body.
|
|
4
|
+
*
|
|
5
|
+
* Used by both buildModernSqlitePreload (in index.ts) and
|
|
6
|
+
* buildLegacySqlitePreload (in legacy-wp/legacy-sqlite-preload.ts).
|
|
7
|
+
*/
|
|
8
|
+
export declare function SQLITE_PRELOAD_LOADER_CLASS(loadBody: string): string;
|