diff options
Diffstat (limited to 'plugins/jetpack/sync/class.jetpack-sync-module.php')
-rw-r--r-- | plugins/jetpack/sync/class.jetpack-sync-module.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/plugins/jetpack/sync/class.jetpack-sync-module.php b/plugins/jetpack/sync/class.jetpack-sync-module.php index ed9ef753..619b36d7 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module.php @@ -65,11 +65,11 @@ abstract class Jetpack_Sync_Module { $where_sql = '1 = 1'; } - $items_per_page = 1000; - $page = 1; - $chunk_count = 0; - $previous_max_id = $state ? $state : '~0'; - $listener = Jetpack_Sync_Listener::get_instance(); + $items_per_page = 1000; + $page = 1; + $chunk_count = 0; + $previous_max_id = $state ? $state : '~0'; + $listener = Jetpack_Sync_Listener::get_instance(); // count down from max_id to min_id so we get newest posts/comments/etc first while ( $ids = $wpdb->get_col( "SELECT {$id_field} FROM {$table_name} WHERE {$where_sql} AND {$id_field} < {$previous_max_id} ORDER BY {$id_field} DESC LIMIT {$items_per_page}" ) ) { @@ -79,7 +79,7 @@ abstract class Jetpack_Sync_Module { // if we hit our row limit, process and return if ( $chunk_count + count( $chunked_ids ) >= $max_items_to_enqueue ) { $remaining_items_count = $max_items_to_enqueue - $chunk_count; - $remaining_items = array_slice( $chunked_ids, 0, $remaining_items_count ); + $remaining_items = array_slice( $chunked_ids, 0, $remaining_items_count ); $listener->bulk_enqueue_full_sync_actions( $action_name, $remaining_items ); @@ -89,8 +89,8 @@ abstract class Jetpack_Sync_Module { $listener->bulk_enqueue_full_sync_actions( $action_name, $chunked_ids ); - $chunk_count += count( $chunked_ids ); - $page += 1; + $chunk_count += count( $chunked_ids ); + $page += 1; $previous_max_id = end( $ids ); } @@ -110,9 +110,10 @@ abstract class Jetpack_Sync_Module { return array_map( array( $this, 'unserialize_meta' ), $wpdb->get_results( - "SELECT $id, meta_key, meta_value, meta_id FROM $table WHERE $id IN ( " . implode( ',', wp_parse_id_list( $ids ) ) . ' )'. - " AND meta_key IN ( $private_meta_whitelist_sql ) " - , OBJECT ) + "SELECT $id, meta_key, meta_value, meta_id FROM $table WHERE $id IN ( " . implode( ',', wp_parse_id_list( $ids ) ) . ' )' . + " AND meta_key IN ( $private_meta_whitelist_sql ) ", + OBJECT + ) ); } @@ -145,7 +146,7 @@ abstract class Jetpack_Sync_Module { } $objects = array(); - foreach( (array) $ids as $id ) { + foreach ( (array) $ids as $id ) { $object = $this->get_object_by_id( $object_type, $id ); // Only add object if we have the object. |