|
@@ 113-134 (lines=22) @@
|
| 110 |
|
$this->set_status("options", 100); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
private function enqueue_all_posts() { |
| 114 |
|
$this->set_status("posts", 0); |
| 115 |
|
global $wpdb; |
| 116 |
|
|
| 117 |
|
// I hope this is never bigger than RAM... |
| 118 |
|
$post_ids = $wpdb->get_col( "SELECT id FROM $wpdb->posts"); |
| 119 |
|
|
| 120 |
|
// Request posts in groups of N for efficiency |
| 121 |
|
$chunked_post_ids = array_chunk( $post_ids, self::$array_chunk_size ); |
| 122 |
|
|
| 123 |
|
$counter = 0; |
| 124 |
|
$total = count( $chunked_post_ids ); |
| 125 |
|
|
| 126 |
|
// Send each chunk as an array of objects |
| 127 |
|
foreach ( $chunked_post_ids as $chunk ) { |
| 128 |
|
$this->set_status( "posts", ( $counter / $total ) * 100 ); |
| 129 |
|
do_action( 'jetpack_full_sync_posts', $chunk ); |
| 130 |
|
$counter += 1; |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
$this->set_status("posts", 100); |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
public function expand_post_ids( $args ) { |
| 137 |
|
$post_ids = $args[0]; |
|
@@ 156-174 (lines=19) @@
|
| 153 |
|
); |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
private function enqueue_all_comments() { |
| 157 |
|
$this->set_status("comments", 0); |
| 158 |
|
|
| 159 |
|
global $wpdb; |
| 160 |
|
|
| 161 |
|
$comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments"); |
| 162 |
|
$chunked_comment_ids = array_chunk( $comment_ids, self::$array_chunk_size ); |
| 163 |
|
|
| 164 |
|
$counter = 0; |
| 165 |
|
$total = count( $chunked_comment_ids ); |
| 166 |
|
|
| 167 |
|
foreach ( $chunked_comment_ids as $chunk ) { |
| 168 |
|
$this->set_status( "comments", ( $counter / $total ) * 100 ); |
| 169 |
|
do_action( 'jetpack_full_sync_comments', $chunk); |
| 170 |
|
$counter += 1; |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
$this->set_status("comments", 100); |
| 174 |
|
} |
| 175 |
|
|
| 176 |
|
public function expand_comment_ids( $args ) { |
| 177 |
|
$comment_ids = $args[0]; |