summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/akismet/class.akismet-admin.php')
-rw-r--r--plugins/akismet/class.akismet-admin.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/akismet/class.akismet-admin.php b/plugins/akismet/class.akismet-admin.php
index 08d67701..c9e82eb0 100644
--- a/plugins/akismet/class.akismet-admin.php
+++ b/plugins/akismet/class.akismet-admin.php
@@ -366,6 +366,12 @@ class Akismet_Admin {
}
$moderation = $wpdb->get_results( "SELECT * FROM {$wpdb->comments} WHERE comment_approved = '0'{$paginate}", ARRAY_A );
+ $result_counts = array(
+ 'spam' => 0,
+ 'ham' => 0,
+ 'error' => 0,
+ );
+
foreach ( (array) $moderation as $c ) {
$c['user_ip'] = $c['comment_author_IP'];
$c['user_agent'] = $c['comment_agent'];
@@ -392,14 +398,15 @@ class Akismet_Admin {
delete_comment_meta( $c['comment_ID'], 'akismet_error' );
delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-spam' );
-
+ ++$result_counts['spam'];
} elseif ( 'false' == $response[1] ) {
update_comment_meta( $c['comment_ID'], 'akismet_result', 'false' );
delete_comment_meta( $c['comment_ID'], 'akismet_error' );
delete_comment_meta( $c['comment_ID'], 'akismet_delayed_moderation_email' );
Akismet::update_comment_history( $c['comment_ID'], '', 'recheck-ham' );
- // abnormal result: error
+ ++$result_counts['ham'];
} else {
+ // abnormal result: error
update_comment_meta( $c['comment_ID'], 'akismet_result', 'error' );
Akismet::update_comment_history(
$c['comment_ID'],
@@ -407,6 +414,7 @@ class Akismet_Admin {
'recheck-error',
array( 'response' => substr( $response[1], 0, 50 ) )
);
+ ++$result_counts['error'];
}
delete_comment_meta( $c['comment_ID'], 'akismet_rechecking' );
@@ -414,6 +422,7 @@ class Akismet_Admin {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
wp_send_json( array(
'processed' => count((array) $moderation),
+ 'counts' => $result_counts,
));
}
else {