private function load_next_posts_from_db() { $next_batch_post_ids = array_splice($this->ids_left, 0, $this->limit); $in_post_ids_sql = _wp_export_build_IN_condition('ID', $next_batch_post_ids); $this->results = $this->db->get_results("SELECT * FROM {$this->db->posts} WHERE {$in_post_ids_sql}"); if (!$this->results) { if ($this->db->last_error) { throw new WP_Iterator_Exception('Database error: ' . $this->db->last_error); } else { return false; } } return true; }
private function attachments_for_specific_post_types($post_ids) { global $wpdb; if (!$this->filters['post_type']) { return array(); } $attachment_ids = array(); while ($batch_of_post_ids = array_splice($post_ids, 0, self::QUERY_CHUNK)) { $post_parent_condition = _wp_export_build_IN_condition('post_parent', $batch_of_post_ids); $attachment_ids = array_merge($attachment_ids, (array) $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND {$post_parent_condition}")); } return array_map('intval', $attachment_ids); }