Skip to content
This repository was archived by the owner on Sep 11, 2026. It is now read-only.

Commit 1414e25

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents a22540e + 8767a36 commit 1414e25

80 files changed

Lines changed: 4926 additions & 1387 deletions

File tree

Some content is hidden

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

‎.gitattributes‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ wp-setup.sh export-ignore
1010
/grammar-tools export-ignore
1111
/packages export-ignore
1212
/tests export-ignore
13-
/wp-includes/sqlite/class-wp-sqlite-crosscheck-db.php export-ignore
1413
/wordpress export-ignore
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: SQLite Plugin PHPUnit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
# Disable permissions for all available scopes by default.
14+
# Any needed permissions should be configured at the job level.
15+
permissions: {}
16+
17+
jobs:
18+
test:
19+
name: SQLite Plugin PHPUnit Tests
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 20
22+
permissions:
23+
contents: read # Required to clone the repo.
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Set UID and GID for PHP in WordPress images
33+
run: |
34+
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
35+
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
36+
37+
- name: Run SQLite plugin single-site PHPUnit tests
38+
run: composer run wp-test-sqlite-plugin-php
39+
40+
- name: Run SQLite plugin multisite PHPUnit tests
41+
run: composer run wp-test-sqlite-plugin-php-multisite
42+
43+
- name: Stop Docker containers
44+
if: always()
45+
run: composer run wp-test-clean

‎.github/workflows/wp-tests-phpunit-run.js‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,26 @@ const expectedErrors = [
1818

1919
const expectedFailures = [
2020
'Tests_Admin_wpSiteHealth::test_object_cache_thresholds with data set #3',
21-
'Tests_Comment::test_wp_new_comment_respects_comment_field_lengths',
2221
'Tests_Comment::test_wp_update_comment',
2322
'Tests_Comment_CheckComment::test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment',
2423
'Tests_Comment_CheckComment::test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment',
2524
'Tests_Comment_CheckComment::test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email',
26-
'Tests_DB_Charset::test_get_column_charset with data set #0',
27-
'Tests_DB_Charset::test_get_column_charset with data set #1',
28-
'Tests_DB_Charset::test_get_column_charset with data set #2',
29-
'Tests_DB_Charset::test_get_column_charset with data set #3',
30-
'Tests_DB_Charset::test_get_column_charset with data set #4',
3125
'Tests_DB_Charset::test_get_column_charset with data set #5',
3226
'Tests_DB_Charset::test_get_column_charset with data set #6',
33-
'Tests_DB_Charset::test_get_column_charset with data set #7',
34-
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #0',
3527
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #1',
3628
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #2',
3729
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #3',
3830
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #4',
3931
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #5',
4032
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #6',
4133
'Tests_DB_Charset::test_get_column_charset_is_mysql_undefined with data set #7',
42-
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #0',
4334
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #1',
4435
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #2',
4536
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #3',
4637
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #4',
4738
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #5',
4839
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #6',
4940
'Tests_DB_Charset::test_get_column_charset_non_mysql with data set #7',
50-
'Tests_DB_Charset::test_process_field_charsets_on_nonexistent_table',
5141
'Tests_DB_Charset::test_strip_invalid_text with data set #21',
5242
'Tests_DB_Charset::test_strip_invalid_text with data set #22',
5343
'Tests_DB_Charset::test_strip_invalid_text with data set #23',
@@ -64,23 +54,10 @@ const expectedFailures = [
6454
'Tests_DB_Charset::test_strip_invalid_text with data set #39',
6555
'Tests_DB_Charset::test_strip_invalid_text with data set #40',
6656
'Tests_DB_Charset::test_strip_invalid_text with data set #41',
67-
'Tests_DB_Charset::test_strip_invalid_text_for_column_bails_if_ascii_input_too_long',
68-
'Tests_DB_dbDelta::test_spatial_indices',
69-
'Tests_DB::test_charset_switched_to_utf8mb4',
70-
'Tests_DB::test_close',
71-
'Tests_DB::test_delete_value_too_long_for_field with data set "too long"',
72-
'Tests_DB::test_has_cap',
73-
'Tests_DB::test_insert_value_too_long_for_field with data set "too long"',
57+
'Tests_DB_dbDelta::test_column_type_change',
7458
'Tests_DB::test_mysqli_flush_sync',
75-
'Tests_DB::test_non_unicode_collations',
76-
'Tests_DB::test_pre_get_col_charset_filter',
77-
'Tests_DB::test_process_fields_on_nonexistent_table',
78-
'Tests_DB::test_process_fields_value_too_long_for_field with data set "too long"',
7959
'Tests_DB::test_query_value_contains_invalid_chars',
80-
'Tests_DB::test_replace_value_too_long_for_field with data set "too long"',
8160
'Tests_DB::test_replace',
82-
'Tests_DB::test_supports_collation',
83-
'Tests_DB::test_update_value_too_long_for_field with data set "too long"',
8461
'Tests_Menu_Walker_Nav_Menu::test_start_el_with_empty_attributes with data set #1',
8562
'Tests_Menu_Walker_Nav_Menu::test_start_el_with_empty_attributes with data set #2',
8663
'Tests_Menu_Walker_Nav_Menu::test_start_el_with_empty_attributes with data set #3',

‎AGENTS.md‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ This project implements SQLite database support for MySQL-based projects.
1414
It is a monorepo that includes the following components:
1515
- **MySQL lexer** — A fast MySQL lexer with multi-version support.
1616
- **MySQL parser** — An exhaustive MySQL parser with multi-version support.
17-
- **SQLite driver** — A MySQL emulation layer on top of SQLite with a PDO-compatible API.
17+
- **MySQL on SQLite** — A MySQL emulation layer on top of SQLite with a PDO-compatible API.
1818
- **MySQL proxy** — A MySQL binary protocol implementation to support MySQL-based projects beyond PHP.
1919
- **WordPress plugin** — A plugin that adds SQLite support to WordPress.
2020
- **Test suites** — A set of extensive test suites to cover MySQL syntax and functionality.
2121

2222
The monorepo packages are placed under the `packages` directory.
2323

24-
The WordPress plugin links the SQLite driver using a symlink. The build script
25-
replaces the symlink with a copy of the driver for release.
24+
The WordPress plugin links the MySQL on SQLite package using a symlink. The build
25+
script replaces the symlink with a copy of the package for release.
2626

2727
The codebase is pure PHP with zero dependencies. It supports PHP 7.2 through 8.5,
2828
MySQL syntax from version 5.7 onward, and requires SQLite 3.37.0 or newer
@@ -37,14 +37,18 @@ composer install # Install dependencies
3737
composer run check-cs # Check coding standards (PHPCS)
3838
composer run fix-cs # Auto-fix coding standards (PHPCBF)
3939
composer run build-sqlite-plugin-zip # Build the plugin zip
40-
composer run prepare-release # Prepare a new release
40+
composer run prepare-release <version> # Prepare a new release
4141

42-
# SQLite driver tests (under packages/mysql-on-sqlite)
42+
# MySQL on SQLite tests (under packages/mysql-on-sqlite)
4343
cd packages/mysql-on-sqlite
4444
composer run test # Run unit tests
4545
composer run test tests/SomeTest.php # Run specific unit test file
4646
composer run test -- --filter testName # Run specific unit test class/method
4747

48+
# SQLite Database Integration plugin PHPUnit tests
49+
composer run wp-test-sqlite-plugin-php # Run single-site plugin tests
50+
composer run wp-test-sqlite-plugin-php-multisite # Run multisite plugin tests
51+
4852
# SQLite Database Integration plugin E2E tests
4953
composer run test-e2e # Run E2E tests (Playwright via WP env)
5054

@@ -66,7 +70,7 @@ Release is streamlined with a local preparation script and GitHub Actions:
6670
```
6771
The script will:
6872
- Bump version numbers and generate a changelog from merged PRs.
69-
- Create a `release/<version>` branch with a preparation commit.
73+
- Create a `release/v<version>` branch with a preparation commit.
7074
- Push the branch and create a PR.
7175

7276
2. **Review the PR.**
@@ -80,19 +84,19 @@ Release is streamlined with a local preparation script and GitHub Actions:
8084

8185
## Architecture
8286
The project consists of multiple components providing different APIs that funnel
83-
into the SQLite driver to support diverse use cases both inside and outside the
87+
into MySQL on SQLite to support diverse use cases both inside and outside the
8488
PHP ecosystem.
8589

8690
### Component overview
8791
The following diagrams show how different types of applications can be supported
8892
using components from this project.
8993

90-
**PHP applications** are supported through a PDO\MySQL-compatible API:
94+
**PHP applications** are supported through an API compatible with the PDO MySQL driver:
9195
```
9296
PHP applications, Adminer, phpMyAdmin
93-
↓ PDO\MySQL API
94-
SQLite driver
95-
↓ PDO\SQLite
97+
↓ PDO MySQL API
98+
MySQL on SQLite
99+
↓ PDO SQLite
96100
SQLite
97101
```
98102

@@ -101,9 +105,9 @@ SQLite
101105
WordPress + plugins, WordPress Playground, WordPress Studio, wp-env
102106
↓ wpdb
103107
wpdb drop-in
104-
↓ PDO\MySQL API
105-
SQLite driver
106-
↓ PDO\SQLite
108+
↓ PDO MySQL API
109+
MySQL on SQLite
110+
↓ PDO SQLite
107111
SQLite
108112
```
109113

@@ -112,9 +116,9 @@ SQLite
112116
MySQL CLI, Desktop clients
113117
↓ MySQL binary protocol v10
114118
MySQL proxy
115-
↓ PDO\MySQL API
116-
SQLite driver
117-
↓ PDO\SQLite
119+
↓ PDO MySQL API
120+
MySQL on SQLite
121+
↓ PDO SQLite
118122
SQLite
119123
```
120124

@@ -170,7 +174,7 @@ the public APIs responsibly, following semantic versioning practices.
170174
In particular:
171175
- **Public APIs:** It's possible to evolve the public API, but this must always be
172176
surfaced to the developer so versioning decisions can be made.
173-
- **PDO API:** The SQLite driver must follow PDO\MySQL API as closely as possible.
177+
- **PDO API:** MySQL on SQLite must match the PDO MySQL driver API as closely as possible.
174178
- **MySQL binary protocol:** The MySQL proxy must follow the MySQL binary protocol
175179
as closely as possible.
176180
- **PHP version support:** All PHP versions starting from **PHP 7.2** must be supported.

‎README.md‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ This project implements SQLite database support for MySQL-based projects.
1212
It is a monorepo that includes the following components:
1313
- **MySQL lexer** — A fast MySQL lexer with multi-version support.
1414
- **MySQL parser** — An exhaustive MySQL parser with multi-version support.
15-
- **SQLite driver** — A MySQL emulation layer on top of SQLite with a PDO-compatible API.
16-
- **MySQL proxy** — A MySQL binary protocol implementation to support MySQL-based projects beyond PHP.
15+
- [**MySQL on SQLite**](packages/mysql-on-sqlite/) — A MySQL emulation layer on top of SQLite with a PDO-compatible API.
16+
- [**MySQL proxy**](packages/mysql-proxy/) — A MySQL binary protocol implementation to support MySQL-based projects beyond PHP.
1717
- **WordPress plugin** — A plugin that adds SQLite support to WordPress.
1818
- **Test suites** — A set of extensive test suites to cover MySQL syntax and functionality.
1919

2020
The monorepo packages are placed under the `packages` directory.
2121

22-
The WordPress plugin links the SQLite driver using a symlink. The build script
23-
replaces the symlink with a copy of the driver for release.
22+
The WordPress plugin links the MySQL on SQLite package using a symlink. The build
23+
script replaces the symlink with a copy of the package for release.
2424

2525
The codebase is pure PHP with zero dependencies. It supports PHP 7.2 through 8.5,
2626
MySQL syntax from version 5.7 onward, and requires SQLite 3.37.0 or newer
@@ -35,14 +35,18 @@ composer install # Install dependencies
3535
composer run check-cs # Check coding standards (PHPCS)
3636
composer run fix-cs # Auto-fix coding standards (PHPCBF)
3737
composer run build-sqlite-plugin-zip # Build the plugin zip
38-
composer run prepare-release # Prepare a new release
38+
composer run prepare-release <version> # Prepare a new release
3939

40-
# SQLite driver tests (under packages/mysql-on-sqlite)
40+
# MySQL on SQLite tests (under packages/mysql-on-sqlite)
4141
cd packages/mysql-on-sqlite
4242
composer run test # Run unit tests
4343
composer run test tests/SomeTest.php # Run specific unit test file
4444
composer run test -- --filter testName # Run specific unit test class/method
4545

46+
# SQLite Database Integration plugin PHPUnit tests
47+
composer run wp-test-sqlite-plugin-php # Run single-site plugin tests
48+
composer run wp-test-sqlite-plugin-php-multisite # Run multisite plugin tests
49+
4650
# SQLite Database Integration plugin E2E tests
4751
composer run test-e2e # Run E2E tests (Playwright via WP env)
4852

@@ -57,7 +61,7 @@ composer run wp-test-clean # Clean up WordPress environment (Docker
5761

5862
## Optional: Native MySQL Parser Extension
5963

60-
The default code path is pure PHP. For environments that can load PHP extensions, the optional `wp_mysql_parser` extension accelerates the MySQL lexer/parser used by the SQLite driver.
64+
The default code path is pure PHP. For environments that can load PHP extensions, the optional `wp_mysql_parser` extension accelerates the MySQL lexer/parser used by MySQL on SQLite.
6165

6266
- [Published WASM release list, manifest links, Playground links, and native extension overview](https://wordpress.github.io/sqlite-database-integration/)
6367
- [Build, load, and benchmark docs](packages/php-ext-wp-mysql-parser/README.md)
@@ -73,7 +77,7 @@ Release is streamlined with a local preparation script and GitHub Actions:
7377
```
7478
The script will:
7579
- Bump version numbers and generate a changelog from merged PRs.
76-
- Create a `release/<version>` branch with a preparation commit.
80+
- Create a `release/v<version>` branch with a preparation commit.
7781
- Push the branch and create a PR.
7882

7983
2. **Review the PR.**
@@ -87,7 +91,7 @@ Release is streamlined with a local preparation script and GitHub Actions:
8791

8892
## Architecture
8993
The project consists of multiple components providing different APIs that funnel
90-
into the SQLite driver to support diverse use cases both inside and outside the
94+
into MySQL on SQLite to support diverse use cases both inside and outside the
9195
PHP ecosystem.
9296

9397
### Component overview
@@ -100,10 +104,10 @@ using components from this project:
100104
│ Adminer, phpMyAdmin │──────────────────────────┐
101105
└──────────────────────┘ │
102106
│
103-
┌──────────────────────┐ wpdb API │ PDO\MySQL API PDO\SQLite
104-
│ WordPress + plugins │ │ ╔══════════════╗ │ │ ╔═══════════════╗ │ ┌────────┐
105-
│ WordPress Playground │───┴──→║ wpdb drop-in ║───┼───┴──→║ SQLite driver ║───┴──→│ SQLite │
106-
│ Studio, wp-env │ ╚══════════════╝ │ ╚═══════════════╝ └────────┘
107+
┌──────────────────────┐ wpdb API │ PDO MySQL API PDO SQLite
108+
│ WordPress + plugins │ │ ╔══════════════╗ │ │ ╔═════════════════╗ │ ┌────────┐
109+
│ WordPress Playground │───┴──→║ wpdb drop-in ║───┼───┴──→║ MySQL on SQLite ║───┴──→│ SQLite │
110+
│ Studio, wp-env │ ╚══════════════╝ │ ╚═════════════════╝ └────────┘
107111
└──────────────────────┘ │
108112
MySQL binary protocol │
109113
┌──────────────────────┐ │ ╔══════════════╗ │

‎bin/prepare-release.sh‎

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ fail() {
1919
exit 1
2020
}
2121

22-
REPO_URL="https://github.com/WordPress/sqlite-database-integration"
22+
REPO="WordPress/sqlite-database-integration"
23+
REPO_URL="https://github.com/$REPO"
2324
VERSION_PHP="packages/mysql-on-sqlite/src/version.php"
2425
LOAD_PHP="packages/plugin-sqlite-database-integration/load.php"
2526
README_TXT="packages/plugin-sqlite-database-integration/readme.txt"
@@ -58,19 +59,45 @@ git pull --ff-only origin trunk --quiet || fail "trunk is not up to date with or
5859
LATEST_TAG="v$CURRENT_VERSION"
5960

6061
echo "Generating changelog from merged PRs since $LATEST_TAG..."
62+
git fetch --quiet origin "refs/tags/$LATEST_TAG:refs/tags/$LATEST_TAG" \
63+
|| fail "Failed to fetch release tag $LATEST_TAG from origin."
64+
git merge-base --is-ancestor "$LATEST_TAG" origin/trunk \
65+
|| fail "Release tag $LATEST_TAG is not an ancestor of origin/trunk."
66+
67+
COMMITS="$(git rev-list --first-parent "$LATEST_TAG..origin/trunk")"
6168
CHANGELOG=""
6269

63-
if git rev-parse "$LATEST_TAG" >/dev/null 2>&1; then
64-
TAG_TIMESTAMP="$(git log -1 --format='%aI' "$LATEST_TAG")"
65-
66-
CHANGELOG="$(gh pr list \
67-
--state merged \
68-
--base trunk \
69-
--search "merged:>$TAG_TIMESTAMP" \
70-
--limit 100 \
71-
--json number,title,mergedAt \
72-
--jq "sort_by(.mergedAt) | reverse | .[]
73-
| \"* \\(.title) ([#\\(.number)]($REPO_URL/pull/\\(.number)))\"")"
70+
if [ -n "$COMMITS" ]; then
71+
QUERY='query($owner: String!, $name: String!) {
72+
repository(owner: $owner, name: $name) {'
73+
while IFS= read -r commit; do
74+
QUERY="$QUERY
75+
commit_$commit: object(oid: \"$commit\") {
76+
... on Commit {
77+
associatedPullRequests(first: 100) {
78+
nodes { number title mergedAt baseRefName }
79+
}
80+
}
81+
}"
82+
done <<< "$COMMITS"
83+
QUERY="$QUERY
84+
}
85+
}"
86+
87+
if ! CHANGELOG="$(gh api graphql \
88+
-f query="$QUERY" \
89+
-F owner="${REPO%%/*}" \
90+
-F name="${REPO#*/}" \
91+
--jq "[.data.repository[]
92+
| .associatedPullRequests.nodes[]
93+
| select(.mergedAt != null and .baseRefName == \"trunk\")]
94+
| unique_by(.number)
95+
| sort_by(.mergedAt)
96+
| reverse
97+
| .[]
98+
| \"* \\(.title) ([#\\(.number)]($REPO_URL/pull/\\(.number)))\"")"; then
99+
fail "Failed to generate changelog from merged pull requests."
100+
fi
74101
fi
75102

76103
if [ -z "$CHANGELOG" ]; then

‎composer.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
"rm -rf wordpress/src/wp-content/database/.ht.sqlite @no_additional_args",
7070
"npm --prefix wordpress run test:php -- @additional_args"
7171
],
72+
"wp-test-sqlite-plugin-php": [
73+
"@wp-test-php /var/www/tests-sqlite-database-integration/phpunit"
74+
],
75+
"wp-test-sqlite-plugin-php-multisite": [
76+
"@wp-test-php -c tests/phpunit/multisite.xml /var/www/tests-sqlite-database-integration/phpunit"
77+
],
7278
"wp-test-e2e": [
7379
"@wp-test-ensure-env @no_additional_args",
7480
"npm --prefix wordpress run test:e2e -- @additional_args"

0 commit comments

Comments
 (0)