diff options
author | 2017-12-26 04:12:07 -0500 | |
---|---|---|
committer | 2017-12-26 04:12:07 -0500 | |
commit | 818606f5cc969538a23e2029312685b36f79eac7 (patch) | |
tree | 527f0f70e376f562aaa624551c9e32fba63e3bcd | |
parent | Update jetpack 5.6.1 (diff) | |
download | blogs-gentoo-818606f5cc969538a23e2029312685b36f79eac7.tar.gz blogs-gentoo-818606f5cc969538a23e2029312685b36f79eac7.tar.bz2 blogs-gentoo-818606f5cc969538a23e2029312685b36f79eac7.zip |
Update akismet 4.0.2
-rw-r--r-- | plugins/akismet/akismet.php | 4 | ||||
-rw-r--r-- | plugins/akismet/class.akismet-admin.php | 22 | ||||
-rw-r--r-- | plugins/akismet/class.akismet.php | 8 | ||||
-rw-r--r-- | plugins/akismet/readme.txt | 10 | ||||
-rw-r--r-- | plugins/akismet/views/notice.php | 2 |
5 files changed, 36 insertions, 10 deletions
diff --git a/plugins/akismet/akismet.php b/plugins/akismet/akismet.php index c29057e2..9e249017 100644 --- a/plugins/akismet/akismet.php +++ b/plugins/akismet/akismet.php @@ -6,7 +6,7 @@ Plugin Name: Akismet Anti-Spam Plugin URI: https://akismet.com/ Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. -Version: 4.0.1 +Version: 4.0.2 Author: Automattic Author URI: https://automattic.com/wordpress-plugins/ License: GPLv2 or later @@ -37,7 +37,7 @@ if ( !function_exists( 'add_action' ) ) { exit; } -define( 'AKISMET_VERSION', '4.0.1' ); +define( 'AKISMET_VERSION', '4.0.2' ); define( 'AKISMET__MINIMUM_WP_VERSION', '4.0' ); define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'AKISMET_DELETE_LIMIT', 100000 ); diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php index 926b3c7a..42e884f9 100644 --- a/plugins/akismet/class.akismet-admin.php +++ b/plugins/akismet/class.akismet-admin.php @@ -725,9 +725,23 @@ class Akismet_Admin { return self::check_server_connectivity( $cache_timeout ); } - public static function get_number_spam_waiting() { - global $wpdb; - return (int) $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); + /** + * Find out whether any comments in the Pending queue have not yet been checked by Akismet. + * + * @return bool + */ + public static function are_any_comments_waiting_to_be_checked() { + return !! get_comments( array( + // Exclude comments that are not pending. This would happen if someone manually approved or spammed a comment + // that was waiting to be checked. The akismet_error meta entry will eventually be removed by the cron recheck job. + 'status' => 'hold', + + // This is the commentmeta that is saved when a comment couldn't be checked. + 'meta_key' => 'akismet_error', + + // We only need to know whether at least one comment is waiting for a check. + 'number' => 1, + ) ); } public static function get_page_url( $page = 'config' ) { @@ -814,7 +828,7 @@ class Akismet_Admin { public static function display_spam_check_warning() { Akismet::fix_scheduled_recheck(); - if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::get_number_spam_waiting() > 0 ) { + if ( wp_next_scheduled('akismet_schedule_cron_recheck') > time() && self::are_any_comments_waiting_to_be_checked() ) { $link_text = apply_filters( 'akismet_spam_check_warning_link_text', sprintf( __( 'Please check your <a href="%s">Akismet configuration</a> and contact your web host if problems persist.', 'akismet'), esc_url( self::get_page_url() ) ) ); Akismet::view( 'notice', array( 'type' => 'spam-check', 'link_text' => $link_text ) ); } diff --git a/plugins/akismet/class.akismet.php b/plugins/akismet/class.akismet.php index 32b23ea8..867430fc 100644 --- a/plugins/akismet/class.akismet.php +++ b/plugins/akismet/class.akismet.php @@ -701,7 +701,13 @@ class Akismet { foreach ( (array) $comment_errors as $comment_id ) { // if the comment no longer exists, or is too old, remove the meta entry from the queue to avoid getting stuck $comment = get_comment( $comment_id ); - if ( !$comment || strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) ) { + + if ( + ! $comment // Comment has been deleted + || strtotime( $comment->comment_date_gmt ) < strtotime( "-15 days" ) // Comment is too old. + || $comment->comment_approved !== "0" // Comment is no longer in the Pending queue + ) { + echo "Deleting"; delete_comment_meta( $comment_id, 'akismet_error' ); delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); continue; diff --git a/plugins/akismet/readme.txt b/plugins/akismet/readme.txt index 0280880a..40ca6aef 100644 --- a/plugins/akismet/readme.txt +++ b/plugins/akismet/readme.txt @@ -2,8 +2,8 @@ Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer Tags: akismet, comments, spam, antispam, anti-spam, anti spam, comment moderation, comment spam, contact form spam, spam comments Requires at least: 4.0 -Tested up to: 4.9 -Stable tag: 4.0.1 +Tested up to: 4.9.1 +Stable tag: 4.0.2 License: GPLv2 or later Akismet checks your comments and contact form submissions against our global database of spam to protect you and your site from malicious content. @@ -30,6 +30,12 @@ Upload the Akismet plugin to your blog, Activate it, then enter your [Akismet.co == Changelog == += 4.0.2 = +*Release Date - 18 December 2017* + +* Fixed a bug that could cause Akismet to recheck a comment that has already been manually approved or marked as spam. +* Fixed a bug that could cause Akismet to claim that some comments are still waiting to be checked when no comments are waiting to be checked. + = 4.0.1 = *Release Date - 6 November 2017* diff --git a/plugins/akismet/views/notice.php b/plugins/akismet/views/notice.php index 3b6236da..4f65b840 100644 --- a/plugins/akismet/views/notice.php +++ b/plugins/akismet/views/notice.php @@ -13,7 +13,7 @@ </form> </div> <?php elseif ( $type == 'spam-check' ) :?> -<div id="akismet-warning" class="updated fade"> +<div class="notice notice-warning"> <p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p> <p><?php printf( __( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ) ); ?></p> <?php if ( $link_text ) { ?> |