Created
June 26, 2022 18:05
-
-
Save cweagans/e9af2462d56aaba203c6b71fba69709f to your computer and use it in GitHub Desktop.
Temporary fix for https://wordpress.org/support/topic/cron-job-on-multisite-creates-error-log-entry/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/classes/wp-security-utility.php b/classes/wp-security-utility.php | |
index e1c53dc..4f203ef 100644 | |
--- a/classes/wp-security-utility.php | |
+++ b/classes/wp-security-utility.php | |
@@ -534,7 +534,9 @@ class AIOWPSecurity_Utility { | |
$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); | |
+ AIOWPSecurity_Utility::is_multisite_install() ? $name_col = 'meta_key' : $name_col = 'option_name'; | |
+ AIOWPSecurity_Utility::is_multisite_install() ? $val_col = 'meta_value' : $val_col = 'option_value'; | |
+ $query = $wpdb->prepare("SELECT * FROM {$tbl} WHERE {$name_col} LIKE 'aiowps_captcha_string_info_time_%' AND {$val_col} < %s", $previous_hour); | |
$res = $wpdb->get_results($query, ARRAY_A); | |
if (!empty($res)) { | |
foreach ($res as $item) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment