|
@@ 56-69 (lines=14) @@
|
| 53 |
|
} |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
private function enqueue_all_posts() { |
| 57 |
|
global $wpdb; |
| 58 |
|
|
| 59 |
|
// I hope this is never bigger than RAM... |
| 60 |
|
$post_ids = $wpdb->get_col( "SELECT id FROM $wpdb->posts"); |
| 61 |
|
|
| 62 |
|
// Request posts in groups of N for efficiency |
| 63 |
|
$chunked_post_ids = array_chunk( $post_ids, self::$array_chunk_size ); |
| 64 |
|
|
| 65 |
|
// Send each chunk as an array of objects |
| 66 |
|
foreach ( $chunked_post_ids as $chunk ) { |
| 67 |
|
$posts = get_posts( array( 'post__in' => $chunk, 'post_status' => 'any' ) ); |
| 68 |
|
do_action( 'jp_full_sync_posts', $posts ); |
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
private function enqueue_all_comments() { |
|
@@ 72-82 (lines=11) @@
|
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
private function enqueue_all_comments() { |
| 73 |
|
global $wpdb; |
| 74 |
|
|
| 75 |
|
$comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments"); |
| 76 |
|
$chunked_comment_ids = array_chunk( $comment_ids, self::$array_chunk_size ); |
| 77 |
|
|
| 78 |
|
foreach ( $chunked_comment_ids as $chunk ) { |
| 79 |
|
$comments = get_comments( array( 'comment__in' => $chunk ) ); |
| 80 |
|
do_action( 'jp_full_sync_comments', $comments ); |
| 81 |
|
} |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
} |