sprucely-designed / mainwp-discord-notifications

GNU General Public License v3.0
4 stars 1 forks source link

SQL error in cron job #5

Closed rwsiv closed 2 months ago

rwsiv commented 2 months ago

I was getting the following error:

WordPress database error Unknown column 'is_ignoreThemeUpgrades' in 'where clause' for query 
                SELECT
                    theme_upgrades
                FROM
                    wp_mainwp_wp wp
                WHERE
                    is_ignoreThemeUpgrades = 0
                 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, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array('mainwp_cronupdatescheck_action'), WP_Hook->do_action, WP_Hook->apply_filters, sprucely_mwpdn_check_for_updates, sprucely_mwpdn_check_for_theme_updates, W3TC\DbCache_WpdbNew->query, W3TC\DbCache_WpdbInjection_QueryCaching->query, W3TC\_CallUnderlying->query, W3TC\DbCache_WpdbNew->query, W3TC\DbCache_WpdbInjection->query, W3TC\DbCache_WpdbNew->default_query

The name is_ignoreThemeUpgrades does not appear to be a valid column name in the database. The correct name appears to be: is_ignoreThemeUpdates. Here is the diff that I applied to resolve this:

--- mainwp-discord-notifications.php.orig       2024-06-25 16:47:21.318130934 +0000
+++ mainwp-discord-notifications.php    2024-06-25 17:55:29.602102199 +0000
@@ -132,7 +132,7 @@
                                FROM
                                        {$wpdb->prefix}mainwp_wp wp
                                WHERE
-                                       is_ignoreThemeUpgrades = %d
+                                       is_ignoreThemeUpdates = %d
                                ",
                                0
                        )

-Bob

JosKlever commented 2 months ago

I've created a PR to fix this and a test was successful. https://github.com/sprucely-designed/mainwp-discord-notifications/pull/6

sisaacrussell commented 2 months ago

Thanks for the report @rwsiv and the PR @JosKlever! Merged into main and will update the release version.

rwsiv commented 2 months ago

Thank you @sisaacrussell and @JosKlever for the quick turn-around!