~canonical-sysadmins/wordpress/4.1.3

« back to all changes in this revision

Viewing changes to wp-content/plugins/akismet/class.akismet.php

  • Committer: Nick Moffitt
  • Date: 2015-01-15 11:05:37 UTC
  • mfrom: (1.1.1 wp4-upstream)
  • Revision ID: nick.moffitt@canonical.com-20150115110537-8bp1y42eyg0jsa7c
Tags: 4.1
MergeĀ upstreamĀ versionĀ 4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
        public static function delete_old_comments() {
257
257
                global $wpdb;
258
258
 
259
 
                while( $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_id FROM {$wpdb->comments} WHERE DATE_SUB(NOW(), INTERVAL 15 DAY) > comment_date_gmt AND comment_approved = 'spam' LIMIT %d", defined( 'AKISMET_DELETE_LIMIT' ) ? AKISMET_DELETE_LIMIT : 10000 ) ) ) {
 
259
                /**
 
260
                 * Determines how many comments will be deleted in each batch.
 
261
                 *
 
262
                 * @param int The default, as defined by AKISMET_DELETE_LIMIT.
 
263
                 */
 
264
                $delete_limit = apply_filters( 'akismet_delete_comment_limit', defined( 'AKISMET_DELETE_LIMIT' ) ? AKISMET_DELETE_LIMIT : 10000 );
 
265
                $delete_limit = max( 1, intval( $delete_limit ) );
 
266
 
 
267
                /**
 
268
                 * Determines how many days a comment will be left in the Spam queue before being deleted.
 
269
                 *
 
270
                 * @param int The default number of days.
 
271
                 */
 
272
                $delete_interval = apply_filters( 'akismet_delete_comment_interval', 15 );
 
273
                $delete_interval = max( 1, intval( $delete_interval ) );
 
274
 
 
275
                while ( $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_id FROM {$wpdb->comments} WHERE DATE_SUB(NOW(), INTERVAL %d DAY) > comment_date_gmt AND comment_approved = 'spam' LIMIT %d", $delete_interval, $delete_limit ) ) ) {
260
276
                        if ( empty( $comment_ids ) )
261
277
                                return;
262
278
 
263
279
                        $wpdb->queries = array();
264
280
 
265
 
                        do_action( 'delete_comment', $comment_ids );
 
281
                        foreach ( $comment_ids as $comment_id ) {
 
282
                                do_action( 'delete_comment', $comment_id );
 
283
                        }
266
284
 
267
285
                        $comma_comment_ids = implode( ', ', array_map('intval', $comment_ids) );
268
286
 
926
944
                return _http_build_query( $args, '', '&' );
927
945
        }
928
946
 
 
947
        /**
 
948
         * Log debugging info to the error log.
 
949
         *
 
950
         * Enabled when WP_DEBUG_LOG is enabled, but can be disabled via the akismet_debug_log filter.
 
951
         *
 
952
         * @param mixed $akismet_debug The data to log.
 
953
         */
929
954
        public static function log( $akismet_debug ) {
930
 
                if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG )
931
 
                        error_log( print_r( compact( 'akismet_debug' ), 1 ) ); //send message to debug.log when in debug mode
 
955
                if ( apply_filters( 'akismet_debug_log', defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) ) {
 
956
                        error_log( print_r( compact( 'akismet_debug' ), true ) );
 
957
                }
932
958
        }
933
959
}
 
 
b'\\ No newline at end of file'