Skip to content

Commit a7c1061

Browse files
authored
Use the new SQLite driver (#144)
## Motivation for the change, related issues **Do not merge yet.** This should wait for Automattic/wordpress-playground-private#140. Use the new SQLite driver implemented in https://github.com/Automattic/sqlite-database-integration. ## Implementation details For now, the new driver is still behind a feature flag. We'll remove the feature flag once the new driver is the default. ## Testing Instructions (or ideally a Blueprint) 1. Run `npx nx bundle-sqlite-database playground-wordpress-builds`. 2. Run `npm run dev`. 3. Go to http://127.0.0.1:5400/website-server/#{%22steps%22:[{%22step%22:%22mkdir%22,%22path%22:%22wordpress/wp-content/mu-plugins%22},{%22step%22:%22writeFile%22,%22path%22:%22wordpress/wp-content/mu-plugins/load.php%22,%22data%22:%22%3C?php%20var_dump(%20get_class($GLOBALS['wpdb']-%3Edbh));%22}],%22login%22:true} You should see `string(16) "WP_SQLite_Driver"` — the new driver instance (not `string(20) "WP_SQLite_Translator"` — the old driver).
1 parent c98d0bf commit a7c1061

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+274
-110
lines changed

packages/docs/site/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
"executor": "@nx/linter:eslint",
8484
"outputs": ["{options.outputFile}"],
8585
"options": {
86-
"lintFilePatterns": ["packages/docs/site/**/*.ts"]
86+
"lintFilePatterns": ["packages/docs/site/**/*.ts"],
87+
"maxWarnings": 0
8788
}
8889
}
8990
},

packages/nx-extensions/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"packages/nx-extensions/generators.json",
4747
"packages/nx-extensions/executors.json",
4848
"packages/nx-extensions/package.json"
49-
]
49+
],
50+
"maxWarnings": 0
5051
}
5152
},
5253
"test": {

packages/php-wasm/cli/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
"executor": "@nx/linter:eslint",
8787
"outputs": ["{options.outputFile}"],
8888
"options": {
89-
"lintFilePatterns": ["packages/php-wasm/cli/**/*.ts"]
89+
"lintFilePatterns": ["packages/php-wasm/cli/**/*.ts"],
90+
"maxWarnings": 0
9091
}
9192
},
9293
"test": {

packages/php-wasm/fs-journal/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
"executor": "@nx/linter:eslint",
6363
"outputs": ["{options.outputFile}"],
6464
"options": {
65-
"lintFilePatterns": ["packages/php-wasm/fs-journal/**/*.ts"]
65+
"lintFilePatterns": ["packages/php-wasm/fs-journal/**/*.ts"],
66+
"maxWarnings": 0
6667
}
6768
}
6869
},

packages/php-wasm/logger/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"executor": "@nx/linter:eslint",
6161
"outputs": ["{options.outputFile}"],
6262
"options": {
63-
"lintFilePatterns": ["packages/php-wasm/logger/**/*.ts"]
63+
"lintFilePatterns": ["packages/php-wasm/logger/**/*.ts"],
64+
"maxWarnings": 0
6465
}
6566
}
6667
},

packages/php-wasm/node-polyfills/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
"lintFilePatterns": [
7070
"packages/php-wasm/node-polyfills/**/*.ts",
7171
"packages/php-wasm/node-polyfills/package.json"
72-
]
72+
],
73+
"maxWarnings": 0
7374
}
7475
}
7576
},

packages/php-wasm/node/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@
158158
"executor": "@nx/linter:eslint",
159159
"outputs": ["{options.outputFile}"],
160160
"options": {
161-
"lintFilePatterns": ["packages/php-wasm/node/**/*.ts"]
161+
"lintFilePatterns": ["packages/php-wasm/node/**/*.ts"],
162+
"maxWarnings": 0
162163
}
163164
},
164165
"typecheck": {

packages/php-wasm/progress/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"executor": "@nx/linter:eslint",
4444
"outputs": ["{options.outputFile}"],
4545
"options": {
46-
"lintFilePatterns": ["packages/php-wasm/progress/**/*.ts"]
46+
"lintFilePatterns": ["packages/php-wasm/progress/**/*.ts"],
47+
"maxWarnings": 0
4748
}
4849
},
4950
"typecheck": {

packages/php-wasm/scopes/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"executor": "@nx/linter:eslint",
2828
"outputs": ["{options.outputFile}"],
2929
"options": {
30-
"lintFilePatterns": ["packages/php-wasm/scopes/**/*.ts"]
30+
"lintFilePatterns": ["packages/php-wasm/scopes/**/*.ts"],
31+
"maxWarnings": 0
3132
}
3233
},
3334
"test": {

packages/php-wasm/stream-compression/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"lintFilePatterns": [
5353
"packages/php-wasm/stream-compression/**/*.ts",
5454
"packages/php-wasm/stream-compression/package.json"
55-
]
55+
],
56+
"maxWarnings": 0
5657
}
5758
}
5859
},

packages/php-wasm/universal/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"executor": "@nx/linter:eslint",
6161
"outputs": ["{options.outputFile}"],
6262
"options": {
63-
"lintFilePatterns": ["packages/php-wasm/universal/**/*.ts"]
63+
"lintFilePatterns": ["packages/php-wasm/universal/**/*.ts"],
64+
"maxWarnings": 0
6465
}
6566
}
6667
},

packages/php-wasm/util/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"executor": "@nx/linter:eslint",
4949
"outputs": ["{options.outputFile}"],
5050
"options": {
51-
"lintFilePatterns": ["packages/php-wasm/util/**/*.ts"]
51+
"lintFilePatterns": ["packages/php-wasm/util/**/*.ts"],
52+
"maxWarnings": 0
5253
}
5354
},
5455
"test": {

packages/php-wasm/web-service-worker/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"options": {
3939
"lintFilePatterns": [
4040
"packages/php-wasm/web-service-worker/**/*.ts"
41-
]
41+
],
42+
"maxWarnings": 0
4243
}
4344
},
4445
"test": {

packages/php-wasm/web/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@
110110
"executor": "@nx/linter:eslint",
111111
"outputs": ["{options.outputFile}"],
112112
"options": {
113-
"lintFilePatterns": ["packages/php-wasm/web/**/*.ts"]
113+
"lintFilePatterns": ["packages/php-wasm/web/**/*.ts"],
114+
"maxWarnings": 0
114115
}
115116
},
116117
"test": {

packages/playground/blueprints/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
"executor": "@nx/linter:eslint",
8181
"outputs": ["{options.outputFile}"],
8282
"options": {
83-
"lintFilePatterns": ["packages/playground/blueprints/**/*.ts"]
83+
"lintFilePatterns": ["packages/playground/blueprints/**/*.ts"],
84+
"maxWarnings": 0
8485
}
8586
},
8687
"typecheck": {

packages/playground/blueprints/src/lib/steps/activate-plugin.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PHP } from '@php-wasm/universal';
22
import { RecommendedPHPVersion } from '@wp-playground/common';
33
import {
4-
getSqliteDatabaseModule,
4+
getSqliteDriverModule,
55
getWordPressModule,
66
} from '@wp-playground/wordpress-builds';
77
import { activatePlugin } from './activate-plugin';
@@ -20,7 +20,7 @@ describe('Blueprint step activatePlugin()', () => {
2020
siteUrl: 'http://playground-domain/',
2121

2222
wordPressZip: await getWordPressModule(),
23-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
23+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2424
});
2525
php = await handler.getPrimaryPhp();
2626
});

packages/playground/blueprints/src/lib/steps/activate-theme.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { loadNodeRuntime } from '@php-wasm/node';
22
import type { PHP } from '@php-wasm/universal';
33
import { RecommendedPHPVersion } from '@wp-playground/common';
44
import {
5-
getSqliteDatabaseModule,
5+
getSqliteDriverModule,
66
getWordPressModule,
77
} from '@wp-playground/wordpress-builds';
88
import { activateTheme } from './activate-theme';
@@ -20,7 +20,7 @@ describe('Blueprint step activateTheme()', () => {
2020
siteUrl: 'http://playground-domain/',
2121

2222
wordPressZip: await getWordPressModule(),
23-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
23+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2424
});
2525
php = await handler.getPrimaryPhp();
2626
});

packages/playground/blueprints/src/lib/steps/enable-multisite.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RecommendedPHPVersion } from '@wp-playground/common';
22
import {
3-
getSqliteDatabaseModule,
3+
getSqliteDriverModule,
44
getWordPressModule,
55
} from '@wp-playground/wordpress-builds';
66
import { enableMultisite } from './enable-multisite';
@@ -21,7 +21,7 @@ describe('Blueprint step enableMultisite', () => {
2121
sapiName: 'cli',
2222

2323
wordPressZip: await getWordPressModule(),
24-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
24+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2525
createFiles: {
2626
'/tmp/wp-cli.phar': readFileSync(
2727
join(__dirname, '../../../tests/fixtures/wp-cli.phar')

packages/playground/blueprints/src/lib/steps/import-theme-starter-content.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PHP } from '@php-wasm/universal';
22
import { RecommendedPHPVersion } from '@wp-playground/common';
33
import {
4-
getSqliteDatabaseModule,
4+
getSqliteDriverModule,
55
getWordPressModule,
66
} from '@wp-playground/wordpress-builds';
77
import { importThemeStarterContent } from './import-theme-starter-content';
@@ -19,7 +19,7 @@ describe('Blueprint step importThemeStarterContent', () => {
1919
siteUrl: 'http://playground-domain/',
2020

2121
wordPressZip: await getWordPressModule(),
22-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
22+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2323
});
2424
php = await handler.getPrimaryPhp();
2525
});

packages/playground/blueprints/src/lib/steps/import-wxr.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PHP } from '@php-wasm/universal';
22
import { RecommendedPHPVersion } from '@wp-playground/common';
33
import {
4-
getSqliteDatabaseModule,
4+
getSqliteDriverModule,
55
getWordPressModule,
66
} from '@wp-playground/wordpress-builds';
77
import { importWxr } from './import-wxr';
@@ -21,7 +21,7 @@ describe('Blueprint step importWxr', () => {
2121
siteUrl: 'http://playground-domain/',
2222

2323
wordPressZip: await getWordPressModule(),
24-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
24+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2525
});
2626
php = await handler.getPrimaryPhp();
2727

packages/playground/blueprints/src/lib/steps/login.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PHP, PHPRequest } from '@php-wasm/universal';
22
import { RecommendedPHPVersion } from '@wp-playground/common';
33
import {
4-
getSqliteDatabaseModule,
4+
getSqliteDriverModule,
55
getWordPressModule,
66
} from '@wp-playground/wordpress-builds';
77
import { login } from './login';
@@ -21,7 +21,7 @@ describe('Blueprint step login', () => {
2121
siteUrl: 'http://playground-domain/',
2222

2323
wordPressZip: await getWordPressModule(),
24-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
24+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2525
});
2626
php = await handler.getPrimaryPhp();
2727
});

packages/playground/blueprints/src/lib/steps/reset-data.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { PHP } from '@php-wasm/universal';
22
import { RecommendedPHPVersion } from '@wp-playground/common';
33
import { resetData } from './reset-data';
44
import {
5-
getSqliteDatabaseModule,
5+
getSqliteDriverModule,
66
getWordPressModule,
77
} from '@wp-playground/wordpress-builds';
88
import { bootWordPress } from '@wp-playground/wordpress';
@@ -19,7 +19,7 @@ describe('Blueprint step resetData()', () => {
1919
documentRoot: docroot,
2020

2121
wordPressZip: await getWordPressModule(),
22-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
22+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2323
});
2424
php = await handler.getPrimaryPhp();
2525
});

packages/playground/blueprints/src/lib/steps/site-data.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { PHP } from '@php-wasm/universal';
22
import { RecommendedPHPVersion } from '@wp-playground/common';
33
import {
4-
getSqliteDatabaseModule,
4+
getSqliteDriverModule,
55
getWordPressModule,
66
} from '@wp-playground/wordpress-builds';
77
import { setSiteOptions } from './site-data';
@@ -19,7 +19,7 @@ describe('Blueprint step setSiteOptions()', () => {
1919
siteUrl: 'http://playground-domain/',
2020

2121
wordPressZip: await getWordPressModule(),
22-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
22+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2323
});
2424
php = await handler.getPrimaryPhp();
2525
});

packages/playground/blueprints/src/lib/steps/wp-cli.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { splitShellCommand, wpCLI } from './wp-cli';
33
import { readFileSync } from 'fs';
44
import { join } from 'path';
55
import {
6-
getSqliteDatabaseModule,
6+
getSqliteDriverModule,
77
getWordPressModule,
88
} from '@wp-playground/wordpress-builds';
99
import { bootWordPress } from '@wp-playground/wordpress';
@@ -20,7 +20,7 @@ describe('Blueprint step wpCLI', () => {
2020
sapiName: 'cli',
2121

2222
wordPressZip: await getWordPressModule(),
23-
sqliteIntegrationPluginZip: await getSqliteDatabaseModule(),
23+
sqliteIntegrationPluginZip: await getSqliteDriverModule(),
2424
createFiles: {
2525
'/tmp/wp-cli.phar': readFileSync(
2626
join(__dirname, '../../../tests/fixtures/wp-cli.phar')

packages/playground/cli/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
"executor": "@nx/linter:eslint",
8787
"outputs": ["{options.outputFile}"],
8888
"options": {
89-
"lintFilePatterns": ["packages/playground/cli/**/*.ts"]
89+
"lintFilePatterns": ["packages/playground/cli/**/*.ts"],
90+
"maxWarnings": 0
9091
}
9192
},
9293
"test": {

packages/playground/cli/src/download.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export async function fetchSqliteIntegration(
99
monitor: EmscriptenDownloadMonitor
1010
) {
1111
const sqliteZip = await cachedDownload(
12-
'https://github.com/WordPress/sqlite-database-integration/archive/refs/heads/main.zip',
12+
'https://github.com/Automattic/sqlite-database-integration/archive/refs/heads/develop.zip',
1313
'sqlite.zip',
1414
monitor
1515
);

packages/playground/client/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
"executor": "@nx/linter:eslint",
7979
"outputs": ["{options.outputFile}"],
8080
"options": {
81-
"lintFilePatterns": ["packages/playground/client/**/*.ts"]
81+
"lintFilePatterns": ["packages/playground/client/**/*.ts"],
82+
"maxWarnings": 0
8283
}
8384
},
8485
"test": {

packages/playground/client/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ export interface StartPlaygroundOptions {
8383
* your Blueprint to replace all cross-origin URLs with the proxy URL.
8484
*/
8585
corsProxy?: string;
86+
/**
87+
* The version of the SQLite driver to use.
88+
* Defaults to the latest development version.
89+
*/
90+
sqliteDriverVersion?: string;
8691
}
8792

8893
/**
@@ -106,6 +111,7 @@ export async function startPlaygroundWeb({
106111
scope,
107112
corsProxy,
108113
shouldInstallWordPress,
114+
sqliteDriverVersion,
109115
}: StartPlaygroundOptions): Promise<PlaygroundClient> {
110116
assertLikelyCompatibleRemoteOrigin(remoteUrl);
111117
allowStorageAccessByUserActivation(iframe);
@@ -150,6 +156,7 @@ export async function startPlaygroundWeb({
150156
wpVersion: compiled.versions.wp,
151157
withNetworking: compiled.features.networking,
152158
corsProxyUrl: corsProxy,
159+
sqliteDriverVersion,
153160
});
154161
await playground.isReady();
155162
downloadPHPandWP.finish();

packages/playground/common/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
"executor": "@nx/linter:eslint",
7171
"outputs": ["{options.outputFile}"],
7272
"options": {
73-
"lintFilePatterns": ["packages/playground/common/**/*.ts"]
73+
"lintFilePatterns": ["packages/playground/common/**/*.ts"],
74+
"maxWarnings": 0
7475
}
7576
}
7677
},

packages/playground/components/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
"executor": "@nx/linter:eslint",
6969
"outputs": ["{options.outputFile}"],
7070
"options": {
71-
"lintFilePatterns": ["packages/playground/components/**/*.ts"]
71+
"lintFilePatterns": ["packages/playground/components/**/*.ts"],
72+
"maxWarnings": 0
7273
}
7374
},
7475
"typecheck": {

packages/playground/remote/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@
6565
"executor": "@nx/linter:eslint",
6666
"outputs": ["{options.outputFile}"],
6767
"options": {
68-
"lintFilePatterns": ["packages/playground/remote/**/*.ts"]
68+
"lintFilePatterns": ["packages/playground/remote/**/*.ts"],
69+
"maxWarnings": 0
6970
}
7071
},
7172
"test": {

0 commit comments

Comments
 (0)