|
@@ 93-114 (lines=22) @@
|
| 90 |
|
$this->set_status("options", 100); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
private function enqueue_all_posts() { |
| 94 |
|
$this->set_status("posts", 0); |
| 95 |
|
global $wpdb; |
| 96 |
|
|
| 97 |
|
// I hope this is never bigger than RAM... |
| 98 |
|
$post_ids = $wpdb->get_col( "SELECT id FROM $wpdb->posts"); |
| 99 |
|
|
| 100 |
|
// Request posts in groups of N for efficiency |
| 101 |
|
$chunked_post_ids = array_chunk( $post_ids, self::$array_chunk_size ); |
| 102 |
|
|
| 103 |
|
$counter = 0; |
| 104 |
|
$total = count( $chunked_post_ids ); |
| 105 |
|
|
| 106 |
|
// Send each chunk as an array of objects |
| 107 |
|
foreach ( $chunked_post_ids as $chunk ) { |
| 108 |
|
$this->set_status( "posts", ( $counter / $total ) * 100 ); |
| 109 |
|
do_action( 'jetpack_full_sync_posts', $chunk ); |
| 110 |
|
$counter += 1; |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
$this->set_status("posts", 100); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
private function enqueue_all_comments() { |
| 117 |
|
$this->set_status("comments", 0); |
|
@@ 116-134 (lines=19) @@
|
| 113 |
|
$this->set_status("posts", 100); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
private function enqueue_all_comments() { |
| 117 |
|
$this->set_status("comments", 0); |
| 118 |
|
|
| 119 |
|
global $wpdb; |
| 120 |
|
|
| 121 |
|
$comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments"); |
| 122 |
|
$chunked_comment_ids = array_chunk( $comment_ids, self::$array_chunk_size ); |
| 123 |
|
|
| 124 |
|
$counter = 0; |
| 125 |
|
$total = count( $chunked_comment_ids ); |
| 126 |
|
|
| 127 |
|
foreach ( $chunked_comment_ids as $chunk ) { |
| 128 |
|
$this->set_status( "comments", ( $counter / $total ) * 100 ); |
| 129 |
|
do_action( 'jetpack_full_sync_comments', $chunk); |
| 130 |
|
$counter += 1; |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
$this->set_status("comments", 100); |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
// TODO: |
| 137 |
|
private function enqueue_all_theme_info() { |