plugin-check
plugin-check copied to clipboard
Plugins Fail to Create Custom Tables in Database During Runtime Check
Describe the bug
I am encountering a persistent issue with both WooCommerce and Yoast SEO plugins. These plugins are expected to create custom tables in the WordPress database during installation or activation. However, I have noticed that sometimes, the tables are not being created, leading to "table not found" errors during runtime checks.
Steps to Reproduce
- Setup Plugin Checker in you local system using steps outline here
- Install and activate WooCommerce plugin
- Go to Admin Panel > Tools > Plugin Check
- Open The Browsers Network tab
- Select "WooCommerce" and click on "Check it!" button
- Check "enqueued_scripts_size" and "enqueued_styles_scope" check output in network tab.
Screenshots, screen recording, code snippet
Environment information
No response
WordPress information
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
cc. @felixarntz @spacedmonkey @eclarke1
Thanks @mukeshpanchal27, good catch. I think in order to find a way to fix it, we need to investigate how these two plugins add their custom database tables. For example is it in the plugin activation hook? Or in some other action in WP Admin? Or completely custom logic? Let's check that.
Hi @felixarntz, I've spent some time investigating how plugins add custom tables in WordPress, and I noticed that both plugins add their custom tables in the plugin activation hook. Specifically, I tried to activate the Yoast SEO plugin using activate_plugin('wordpress-seo/wp-seo.php');
and the WooCommerce plugin using activate_plugin('woocommerce/woocommerce.php');
, but unfortunately, they didn't add the custom tables in my dummy database.
I'm facing this issue and I'm not sure why it's happening. Could you please guide me on how to move forward and troubleshoot this problem? Your insights would be greatly appreciated! cc. @joemcgill
This also seems to happen for GatherPress, see https://github.com/GatherPress/gatherpress/blob/9cc072252d9b167793d97a7174ef1436b16eecf7/includes/core/classes/class-setup.php#L149 and https://github.com/GatherPress/gatherpress/actions/runs/10134308384/job/28020387857#step:8:214
[28-Jul-2024 19:49:47 UTC] WordPress database error Table 'wordpress.wp_pc_gatherpress_events' doesn't exist for query DELETE FROM `wp_pc_gatherpress_events` WHERE `post_id` = 7 made by include('phar:///usr/local/bin/wp/php/boot-phar.php'), include('phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php'), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, WordPress\Plugin_Check\CLI\Plugin_Check_Command->check, WordPress\Plugin_Check\Checker\Abstract_Check_Runner->run, WordPress\Plugin_Check\Checker\Preparations\Demo_Posts_Creation_Preparation->WordPress\Plugin_Check\Checker\Preparations\{closure}, wp_delete_post, do_action('delete_post'), WP_Hook->do_action, WP_Hook->apply_filters, GatherPress\Core\Event_Setup->delete_event