+ public static function recheck_comment( $id, $recheck_reason = 'recheck_queue' ) {
+ add_comment_meta( $id, 'akismet_rechecking', true );
+
+ $api_response = self::check_db_comment( $id, $recheck_reason );
+
+ delete_comment_meta( $id, 'akismet_rechecking' );
+
+ if ( is_wp_error( $api_response ) ) {
+ // Invalid comment ID.
+ }
+ else if ( 'true' === $api_response ) {
+ wp_set_comment_status( $id, 'spam' );
+ update_comment_meta( $id, 'akismet_result', 'true' );
+ delete_comment_meta( $id, 'akismet_error' );
+ delete_comment_meta( $id, 'akismet_delayed_moderation_email' );
+ Akismet::update_comment_history( $id, '', 'recheck-spam' );
+ }
+ elseif ( 'false' === $api_response ) {
+ update_comment_meta( $id, 'akismet_result', 'false' );
+ delete_comment_meta( $id, 'akismet_error' );
+ delete_comment_meta( $id, 'akismet_delayed_moderation_email' );
+ Akismet::update_comment_history( $id, '', 'recheck-ham' );
+ }
+ else {
+ // abnormal result: error
+ update_comment_meta( $id, 'akismet_result', 'error' );
+ Akismet::update_comment_history(
+ $id,
+ '',
+ 'recheck-error',
+ array( 'response' => substr( $api_response, 0, 50 ) )
+ );
+ }
+
+ return $api_response;
+ }