-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to official WordPress SQLite plugin that uses SQL parser (#152)
Migrates Playground from regexp-based [wp-sqlite-db](aaemnnosttv/wp-sqlite-db#55) to the official [sqlite-database-integration](https://github.com/WordPress/sqlite-database-integration) plugin which [translates queries using SQL parser](WordPress/sqlite-database-integration#9) instead of regular expressions. This makes for a more reliable SQLite integration that passes almost all WordPress unit tests. [Learn more](aaemnnosttv/wp-sqlite-db#55) about the problem with regular expressions.
- Loading branch information
Showing
48 changed files
with
5,268 additions
and
1,609 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...yground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/.editorconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[{*.txt,wp-config-sample.php}] | ||
end_of_line = crlf |
7 changes: 7 additions & 0 deletions
7
...ground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/.gitattributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Omit during export. | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
composer.json export-ignore | ||
phpcs.xml.dist export-ignore | ||
tests/*.php export-ignore |
2 changes: 2 additions & 0 deletions
2
...playground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor/ | ||
composer.lock |
339 changes: 339 additions & 0 deletions
339
...es/playground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/LICENSE
Large diffs are not rendered by default.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
...yground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/composer.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "wordpress/sqlite-database-integration", | ||
"license": "GPL-2.0-or-later", | ||
"description": "SQLite integration plugin for WordPress.", | ||
"homepage": "https://github.com/wordpress/sqlite-database-integration", | ||
"keywords": [ "wordpress", "plugin", "database", "sqlite" ], | ||
"support": { | ||
"issues": "https://github.com/wordpress/sqlite-database-integration/issues" | ||
}, | ||
"require": { | ||
"php": ">=5.6" | ||
}, | ||
"require-dev": { | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", | ||
"squizlabs/php_codesniffer": "3.7.0", | ||
"wp-coding-standards/wpcs": "~2.3.0", | ||
"phpcompatibility/phpcompatibility-wp": "~2.1.3", | ||
"yoast/phpunit-polyfills": "^1.0.1" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...es/playground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/db.copy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Plugin Name: SQLite integration (Drop-in) | ||
* Version: 1.0.0 | ||
* Author: WordPress Performance Team | ||
* Author URI: https://make.wordpress.org/performance/ | ||
* | ||
* This file is auto-generated and copied from the sqlite plugin. | ||
* Please don't edit this file directly. | ||
* | ||
* @package wp-sqlite-integration | ||
*/ | ||
|
||
define( 'SQLITE_DB_DROPIN_VERSION', '1.8.0' ); | ||
|
||
// Bail early if the SQLite implementation was not located in the plugin. | ||
if ( ! file_exists( '{SQLITE_IMPLEMENTATION_FOLDER_PATH}/wp-includes/sqlite/db.php' ) ) { | ||
return; | ||
} | ||
|
||
// Constant for backward compatibility. | ||
if ( ! defined( 'DATABASE_TYPE' ) ) { | ||
define( 'DATABASE_TYPE', 'sqlite' ); | ||
} | ||
// Define SQLite constant. | ||
if ( ! defined( 'DB_ENGINE' ) ) { | ||
define( 'DB_ENGINE', 'sqlite' ); | ||
} | ||
|
||
// Require the implementation from the plugin. | ||
require_once '{SQLITE_IMPLEMENTATION_FOLDER_PATH}/wp-includes/sqlite/db.php'; | ||
|
||
// Activate the performance-lab plugin if it is not already activated. | ||
add_action( | ||
'admin_footer', | ||
function() { | ||
if ( defined( 'SQLITE_MAIN_FILE' ) ) { | ||
return; | ||
} | ||
if ( ! function_exists( 'activate_plugin' ) ) { | ||
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | ||
} | ||
if ( is_plugin_inactive( '{SQLITE_PLUGIN}' ) ) { | ||
activate_plugin( '{SQLITE_PLUGIN}' ); | ||
} | ||
} | ||
); |
39 changes: 39 additions & 0 deletions
39
...ground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/phpcs.xml.dist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WordPress Coding Standards"> | ||
<description>Apply WordPress Coding Standards</description> | ||
|
||
<!-- Only scan PHP files. --> | ||
<arg name="extensions" value="php"/> | ||
|
||
<!-- Set the memory limit to 256M. | ||
For most standard PHP configurations, this means the memory limit will temporarily be raised. | ||
Ref: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#specifying-phpini-settings | ||
--> | ||
<ini name="memory_limit" value="256M"/> | ||
|
||
<!-- Strip the filepaths down to the relevant bit. --> | ||
<arg name="basepath" value="./"/> | ||
|
||
<!-- Check up to 20 files simultaneously. --> | ||
<arg name="parallel" value="20"/> | ||
|
||
<!-- Show sniff codes in all reports. --> | ||
<arg value="ps"/> | ||
|
||
<file>.</file> | ||
|
||
<rule ref="WordPress-Core"/> | ||
<rule ref="WordPress-Docs"/> | ||
<rule ref="WordPress.CodeAnalysis.EmptyStatement"/> | ||
|
||
<!-- Directories and third party library exclusions. --> | ||
<exclude-pattern>/vendor/*</exclude-pattern> | ||
|
||
<!-- Allow the WP DB Class and related tests for usage of direct database access functions. --> | ||
<rule ref="WordPress.DB.RestrictedClasses.mysql__PDO"> | ||
<exclude-pattern>/wp-includes/*.php</exclude-pattern> | ||
</rule> | ||
<rule ref="WordPress.DB.RestrictedFunctions"> | ||
<exclude-pattern>/wp-includes/*.php</exclude-pattern> | ||
</rule> | ||
</ruleset> |
20 changes: 20 additions & 0 deletions
20
...ound/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/phpunit.xml.dist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/9.2/phpunit.xsd" | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
colors="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
beStrictAboutOutputDuringTests="true" | ||
convertErrorsToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertDeprecationsToExceptions="true" | ||
> | ||
<testsuites> | ||
<!-- Default test suite to run all tests. --> | ||
<testsuite name="default"> | ||
<directory suffix=".php">tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
40 changes: 40 additions & 0 deletions
40
...playground/remote/public/wp-5.9/wp-content/plugins/sqlite-database-integration/readme.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
=== SQLite Database Integration === | ||
|
||
Contributors: wordpressdotorg, aristath | ||
Requires at least: 6.0 | ||
Tested up to: 6.1 | ||
Requires PHP: 5.6 | ||
Stable tag: 2.0 | ||
License: GPLv2 or later | ||
License URI: https://www.gnu.org/licenses/gpl-2.0.html | ||
Tags: performance, database | ||
|
||
SQLite-integration plugin from the WordPress Performance Team. | ||
|
||
== Description == | ||
|
||
The SQLite plugin is a community, feature plugin. The intent is to allow testing an SQLite integration with WordPress and gather feedback, with the goal of eventually landing it in WordPress core. | ||
|
||
This project is based on the original work of Kojima Toshiyasu and his SQLite Integration plugin, and the work of Evan Mattson and his WP SQLite DB plugin - See https://github.com/aaemnnosttv/wp-sqlite-db. | ||
|
||
It also includes code from the PHPMyAdmin project (specifically parts of the PHPMyAdmin/sql-parser library), licensed under the GPL v2 or later. More info on the PHPMyAdmin/sql-parser library can be found on [GitHub](https://github.com/phpmyadmin/sql-parser). | ||
|
||
== Frequently Asked Questions == | ||
|
||
= What is the purpose of this plugin? = | ||
|
||
The primary purpose of the SQLite plugin is to allow testing the use of an SQLite database, with the goal to eventually land in WordPress core. | ||
|
||
You can read the original proposal on the [Make blog](https://make.wordpress.org/core/2022/09/12/lets-make-wordpress-officially-support-sqlite/), as well as the [call for testing](https://make.wordpress.org/core/2022/12/20/help-us-test-the-sqlite-implementation/) for more context and useful information. | ||
|
||
= Can I use this plugin on my production site? = | ||
|
||
Per the primary purpose of the plugin (see above), it can mostly be considered a beta testing plugin. To a degree, it should be okay to use it in production. However, as with every plugin, you are doing so at your own risk. | ||
|
||
= Where can I submit my plugin feedback? = | ||
|
||
Feedback is encouraged and much appreciated, especially since this plugin is a future WordPress core feature. If you need help with troubleshooting or have a question, suggestions, or requests, you can [submit them as an issue in the SQLite GitHub repository](https://github.com/wordpress/sqlite-database-integration/issues/new). | ||
|
||
= How can I contribute to the plugin? = | ||
|
||
Contributions are always welcome! Learn more about how to get involved in the [Core Performance Team Handbook](https://make.wordpress.org/performance/handbook/get-involved/). |
24 changes: 24 additions & 0 deletions
24
...yground/remote/public/wp-6.0/wp-content/plugins/sqlite-database-integration/.editorconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
|
||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[{*.txt,wp-config-sample.php}] | ||
end_of_line = crlf |
7 changes: 7 additions & 0 deletions
7
...ground/remote/public/wp-6.0/wp-content/plugins/sqlite-database-integration/.gitattributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Omit during export. | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
composer.json export-ignore | ||
phpcs.xml.dist export-ignore | ||
tests/*.php export-ignore |
2 changes: 2 additions & 0 deletions
2
...playground/remote/public/wp-6.0/wp-content/plugins/sqlite-database-integration/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor/ | ||
composer.lock |
Oops, something went wrong.