function set_defaults() { $this->sync_queue = new Jetpack_Sync_Queue('sync'); $this->full_sync_queue = new Jetpack_Sync_Queue('full_sync'); $this->codec = new Jetpack_Sync_JSON_Deflate_Array_Codec(); // saved settings Jetpack_Sync_Settings::set_importing(null); $settings = Jetpack_Sync_Settings::get_settings(); $this->set_dequeue_max_bytes($settings['dequeue_max_bytes']); $this->set_upload_max_bytes($settings['upload_max_bytes']); $this->set_upload_max_rows($settings['upload_max_rows']); $this->set_sync_wait_time($settings['sync_wait_time']); $this->set_sync_wait_time($settings['enqueue_wait_time']); $this->set_sync_wait_threshold($settings['sync_wait_threshold']); $this->set_max_dequeue_time(Jetpack_Sync_Defaults::get_max_sync_execution_time()); }
public function posts_checksum() { global $wpdb; $post_type_sql = Jetpack_Sync_Defaults::get_blacklisted_post_types_sql(); $query = <<<ENDSQL \t\t\tSELECT CONV(BIT_XOR(CRC32(CONCAT(ID,post_modified))), 10, 16) \t\t\t\tFROM {$wpdb->posts} \t\t\t\tWHERE {$post_type_sql} ENDSQL; return $wpdb->get_var($query); }
private function enqueue_all_posts() { global $wpdb; $this->set_status('posts', 0); $post_type_sql = Jetpack_Sync_Defaults::get_blacklisted_post_types_sql(); $this->enqueue_all_ids_as_action('jetpack_full_sync_posts', $wpdb->posts, 'ID', $post_type_sql, 'posts'); $this->set_status('posts', 100); }
function test_default_value_for_max_execution_time() { // test with strings, non-strings, 0 and null ini_set('max_execution_time', '30'); $this->assertEquals(10, Jetpack_Sync_Defaults::get_max_sync_execution_time()); ini_set('max_execution_time', 65); $this->assertEquals(21, Jetpack_Sync_Defaults::get_max_sync_execution_time()); ini_set('max_execution_time', '0'); $this->assertEquals(20, Jetpack_Sync_Defaults::get_max_sync_execution_time()); ini_set('max_execution_time', null); $this->assertEquals(20, Jetpack_Sync_Defaults::get_max_sync_execution_time()); }