AnsPress_Admin_Ajax::recount_flags( integer $current, integer $offset )
Description #
Recount flags of posts.
Parameters #
- $currentinteger (Required) Current index.
- $offsetinteger (Required) Current offset.
Source #
File: admin/ajax.php
public static function recount_flags( $current, $offset ) { global $wpdb; $ids = $wpdb->get_col( "SELECT SQL_CALC_FOUND_ROWS ID FROM {$wpdb->posts} WHERE post_type IN ('question', 'answer') LIMIT {$offset},50" ); // @codingStandardsIgnoreLine. $total_found = $wpdb->get_var( 'SELECT FOUND_ROWS()' ); // DB call okay, Db cache okay. foreach ( (array) $ids as $id ) { ap_update_flags_count( $id ); } $action = 'continue'; if ( count( $ids ) < 50 ) { $action = 'success'; } wp_send_json( [ 'action' => $action, 'total' => $total_found, 'processed' => count( $ids ), ] ); }
Expand full source code Collapse full source code View on GitHub: admin/ajax.php:374
Add your comment