Explicitly load the sqlite-database-integration/php-polyfills.php file#8
Explicitly load the sqlite-database-integration/php-polyfills.php file#8
sqlite-database-integration/php-polyfills.php file#8Conversation
|
@fredrikekelund, the fix by loading polyfills explicitly looks valid, and it fixes the issue for me. Are |
| if ( ! Import::get_sqlite_plugin_version() ) { | ||
| WP_CLI::error( 'The SQLite integration plugin is not installed or activated.' ); | ||
| } |
There was a problem hiding this comment.
I realized the SQLiteDatabaseIntegrationLoader::load_plugin() method already performs an equivalent check. No need to duplicate that logic.
| * @throws WP_CLI\ExitException | ||
| */ | ||
| protected function load_dependencies() { | ||
| public static function load_plugin() { |
There was a problem hiding this comment.
After discussing the initial changes in this PR with @wojtekn, we concluded that this method could also be static, and there's really no reason for the command classes to extend this class. Hence, I took the opportunity to make this into a standalone class with only static methods.
wojtekn
left a comment
There was a problem hiding this comment.
Works as expected. Thanks for the cleanup!
Fixes https://github.com/Automattic/dotcom-forge/issues/10054
In https://github.com/Automattic/dotcom-forge/issues/10054, we discovered that exports are currently broken in Studio when running PHP <8. This happens because
str_ends_withis used in thesqlite-database-integrationcodebase, but that function only became part of PHP's stdlib in version 8. The crux is thatsqlite-database-integrationactually has a polyfill for this function, but that polyfill isn't loaded. This happens because we use thebefore_wp_loadhook for the WP-CLI commands in this project, short-circuiting WP's regular logic for loading mu-plugins. Instead, we manually require files fromsqlite-database-integration, but we hadn't previously includedphp-polyfills.php. This PR fixes that.Testing instructions
composer install --no-dev --optimize-autoloader --ignore-platform-reqsin this repowp-files/sqlite-commandin the Studio repo with a symlink to your localwp-cli-sqlite-commandreponpm start