recheck_queue_portion example

if ( ! ( isset( $_GET['recheckqueue'] ) || ( isset( $_REQUEST['action'] ) && 'akismet_recheck_queue' == $_REQUEST['action'] ) ) ) {
            return;
        }
        
        if ( ! wp_verify_nonce( $_POST['nonce'], 'akismet_check_for_spam' ) ) {
            wp_send_json( array(
                'error' => __( 'You don’t have permission to do that.', 'akismet' ),
            ));
            return;
        }

        $result_counts = self::recheck_queue_portion( empty( $_POST['offset'] ) ? 0 : $_POST['offset']empty( $_POST['limit'] ) ? 100 : $_POST['limit'] );

        if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
            wp_send_json( array(
                'counts' => $result_counts,
            ));
        }
        else {
            $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url( 'edit-comments.php' );
            wp_safe_redirect( $redirect_to );
            exit;
        }
    }

    public function recheck_queue() {
        $batch_size = 100;
        $start = 0;
        
        $total_counts = array();
        
        do {
            $result_counts = Akismet_Admin::recheck_queue_portion( $start$batch_size );
            
            if ( $result_counts['processed'] > 0 ) {
                foreach ( $result_counts as $key => $count ) {
                    if ( ! isset( $total_counts[ $key ] ) ) {
                        $total_counts[ $key ] = $count;
                    }
                    else {
                        $total_counts[ $key ] += $count;
                    }
                }
                $start += $batch_size;
                
Home | Imprint | This part of the site doesn't use cookies.