• Resolved Rhapsody348

    (@rhapsody348)


    I have AIOWPS installed on both stand alone and multisite (subdomain) installation. Running PHP 8.0 and WordPress 5.9.3.

    The following error log entry is created on the multisite installations:

    [22-Apr-2022 09:31:15 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616275' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    [22-Apr-2022 09:31:17 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616277' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    [22-Apr-2022 09:31:18 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616278' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    [22-Apr-2022 09:31:19 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616279' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    [22-Apr-2022 09:31:21 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616281' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    [22-Apr-2022 09:31:22 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616282' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    [22-Apr-2022 09:40:09 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616809' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    [22-Apr-2022 09:40:53 UTC] WordPress database error Unknown column 'option_name' in 'where clause' for query SELECT * FROM wp_sitemeta WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < '1650616853' made by do_action_ref_array('aiowps_hourly_cron_event'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Cronjob_Handler->aiowps_hourly_cron_event_handler, do_action('aiowps_perform_db_cleanup_tasks'), WP_Hook->do_action, WP_Hook->apply_filters, AIOWPSecurity_Backup->aiowps_scheduled_db_cleanup_handler, AIOWPSecurity_Utility::delete_expired_captcha_options
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Rhapsody348

    (@rhapsody348)

    An update for this. I used phpMyAdmin to look at the table wp_sitemeta on a multisite installation. The column names in wp_sitemeta are meta_key and meta_value. It is NOT option_name and option_value as used in the wp_options table for single site installs and what is causing the error log generation.

    This is the code in file /wp-content/plugins/all-in-one-wp-security-and-firewall/classes/wp-security-utility.php starting at line 524. I believe this needs additional logic to detect multisite and change option_name and option_value to meta_key and meta_value in the query statement.

    	/**
    	 * Delete expired captcha info option
    	 *
    	 * Note: A unique instance these option is created everytime the login page is loaded with captcha enabled
    	 * This function will help prune the options table of old expired entries.
    	 *
    	 * @global wpdb $wpdb
    	 */
    		public static function delete_expired_captcha_options() {
    			global $wpdb;
    			$current_unix_time = current_time('timestamp', true);
    			$previous_hour = $current_unix_time - 3600;
    			AIOWPSecurity_Utility::is_multisite_install() ? $tbl = $wpdb->sitemeta : $tbl = $wpdb->prefix . 'options';
    			$query = $wpdb->prepare("SELECT * FROM {$tbl} WHERE option_name LIKE 'aiowps_captcha_string_info_time_%' AND option_value < %s", $previous_hour);
    			$res = $wpdb->get_results($query, ARRAY_A);
    			if (!empty($res)) {
    				foreach ($res as $item) {
    					$option_name = $item['option_name'];
    					if (AIOWPSecurity_Utility::is_multisite_install()) {
    						delete_site_option($option_name);
    						delete_site_option(str_replace('time_', '', $option_name));
    					} else {
    						delete_option($option_name);
    						delete_option(str_replace('time_', '', $option_name));
    					}
    				}
    			}
    		}
    
    Plugin Support vupdraft

    (@vupdraft)

    Thank you for this, I will pass this onto our development team.

    Plugin Contributor Prashant Baldha

    (@pmbaldha)

    @rhapsody348 @vupdraft We are fixing the issue in our development version. It will be fixed in the next release of the AIOWPS plugin.

    @pmbaldha Is there any timing for the next release which fixes that error?

    As I can see, that bug does not only flood the php-error.log, it also seems do leave old captcha data in the sitemeta tables, which are also flooded by that.

    So I feel it is quiet urgent to fix that. Maybe by a minor release.

    Hi, do we have an update on this please? My site is multisite, WP V6.0, and AIOWPS V4.4.12.
    thanks ??

    https://gist.github.com/cweagans/e9af2462d56aaba203c6b71fba69709f is a quick fix for this problem. Not sure if it’s the right thing though. If you’re using Composer to manage your WordPress installation, you can add the patch to your composer.json, require cweagans/composer-patches, and have the patch applies when you do a composer install. It’s a small enough patch that you can probably just make the changes manually if needed as well.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Cron Job on Multisite Creates Error Log Entry’ is closed to new replies.