|
@@ 37-50 (lines=14) @@
|
| 34 |
|
$client->force_sync_callables(); |
| 35 |
|
} |
| 36 |
|
|
| 37 |
|
private function enqueue_all_posts() { |
| 38 |
|
global $wpdb; |
| 39 |
|
|
| 40 |
|
// I hope this is never bigger than RAM... |
| 41 |
|
$post_ids = $wpdb->get_col( "SELECT id FROM $wpdb->posts"); |
| 42 |
|
|
| 43 |
|
// Request posts in groups of N for efficiency |
| 44 |
|
$chunked_post_ids = array_chunk( $post_ids, self::$array_chunk_size ); |
| 45 |
|
|
| 46 |
|
// Send each chunk as an array of objects |
| 47 |
|
foreach ( $chunked_post_ids as $chunk ) { |
| 48 |
|
$posts = get_posts( array( 'post__in' => $chunk, 'post_status' => 'any' ) ); |
| 49 |
|
do_action( 'jp_full_sync_posts', $posts ); |
| 50 |
|
} |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
private function enqueue_all_comments() { |
|
@@ 53-63 (lines=11) @@
|
| 50 |
|
} |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
private function enqueue_all_comments() { |
| 54 |
|
global $wpdb; |
| 55 |
|
|
| 56 |
|
$comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments"); |
| 57 |
|
$chunked_comment_ids = array_chunk( $comment_ids, self::$array_chunk_size ); |
| 58 |
|
|
| 59 |
|
foreach ( $chunked_comment_ids as $chunk ) { |
| 60 |
|
$comments = get_comments( array( 'comment__in' => $chunk ) ); |
| 61 |
|
do_action( 'jp_full_sync_comments', $comments ); |
| 62 |
|
} |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
} |