33
44use WP_CLI ;
55
6- class Base {
6+ final class SQLiteDatabaseIntegrationLoader {
77
88 /**
99 * Get the version of the SQLite integration plugin if it is installed
1010 * and activated.
1111 *
1212 * @return false|string The version of the SQLite integration plugin or false if not found/activated.
1313 */
14- public static function get_sqlite_plugin_version () {
14+ public static function get_plugin_version () {
1515 // Check if there is a db.php file in the wp-content directory.
1616 if ( ! file_exists ( ABSPATH . '/wp-content/db.php ' ) ) {
1717 return false ;
@@ -62,13 +62,13 @@ protected static function get_plugin_directory() {
6262 * @return void
6363 * @throws WP_CLI\ExitException
6464 */
65- protected function load_dependencies () {
65+ public static function load_plugin () {
6666 $ plugin_directory = self ::get_plugin_directory ();
6767 if ( ! $ plugin_directory ) {
6868 WP_CLI ::error ( 'Could not locate the SQLite integration plugin. ' );
6969 }
7070
71- $ sqlite_plugin_version = self ::get_sqlite_plugin_version ();
71+ $ sqlite_plugin_version = self ::get_plugin_version ();
7272 if ( ! $ sqlite_plugin_version ) {
7373 WP_CLI ::error ( 'Could not determine the version of the SQLite integration plugin. ' );
7474 }
@@ -83,6 +83,7 @@ protected function load_dependencies() {
8383 }
8484
8585 // We also need to selectively load the necessary classes from the plugin.
86+ require_once $ plugin_directory . '/php-polyfills.php ' ;
8687 require_once $ plugin_directory . '/constants.php ' ;
8788 require_once $ plugin_directory . '/wp-includes/sqlite/class-wp-sqlite-lexer.php ' ;
8889 require_once $ plugin_directory . '/wp-includes/sqlite/class-wp-sqlite-query-rewriter.php ' ;
0 commit comments