It also binds the action to send data to WPCOM to Jetpack's XMLRPC client object.
 protected function result()
 {
     Jetpack::init();
     /** This action is documented in class.jetpack-sync-client.php */
     Jetpack_Sync_Actions::schedule_full_sync();
     return array('scheduled' => true);
 }
 static function init()
 {
     self::$client = Jetpack_Sync_Client::getInstance();
     // bind the do_sync process to shutdown
     add_action('shutdown', array(self::$client, 'do_sync'));
     // bind the sending process
     add_filter('jetpack_sync_client_send_data', array(__CLASS__, 'send_data'));
     // On jetpack registration
     add_action('jetpack_site_registered', array(__CLASS__, 'schedule_full_sync'));
 }
 protected function result()
 {
     require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php';
     require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php';
     $sync_module = Jetpack_Sync_Modules::get_module('full-sync');
     $sender = Jetpack_Sync_Sender::get_instance();
     $queue = $sender->get_sync_queue();
     $full_queue = $sender->get_full_sync_queue();
     return array_merge($sync_module->get_status(), array('is_scheduled' => Jetpack_Sync_Actions::is_scheduled_full_sync(), 'queue_size' => $queue->size(), 'queue_lag' => $queue->lag(), 'full_queue_size' => $full_queue->size(), 'full_queue_lag' => $full_queue->lag()));
 }
 protected function result()
 {
     require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-modules.php';
     require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-sender.php';
     $sync_module = Jetpack_Sync_Modules::get_module('full-sync');
     $sender = Jetpack_Sync_Sender::get_instance();
     $queue = $sender->get_sync_queue();
     $full_queue = $sender->get_full_sync_queue();
     $cron_timestamps = array_keys(_get_cron_array());
     $cron_age = microtime(true) - $cron_timestamps[0];
     return array_merge($sync_module->get_status(), array('is_scheduled' => Jetpack_Sync_Actions::is_scheduled_full_sync(), 'cron_size' => count($cron_timestamps), 'oldest_cron' => $cron_age, 'queue_size' => $queue->size(), 'queue_lag' => $queue->lag(), 'queue_next_sync' => $sender->get_next_sync_time('sync') - microtime(true), 'full_queue_size' => $full_queue->size(), 'full_queue_lag' => $full_queue->lag(), 'full_queue_next_sync' => $sender->get_next_sync_time('full_sync') - microtime(true)));
 }
 protected function result()
 {
     $args = $this->input();
     $modules = null;
     // convert list of modules in comma-delimited format into an array
     // of "$modulename => true"
     if (isset($args['modules']) && !empty($args['modules'])) {
         $modules = array_map('__return_true', array_flip(array_map('trim', explode(',', $args['modules']))));
     }
     foreach (array('posts', 'comments', 'users') as $module_name) {
         if ('users' === $module_name && isset($args[$module_name]) && 'initial' === $args[$module_name]) {
             $modules['users'] = 'initial';
         } elseif (isset($args[$module_name])) {
             $ids = explode(',', $args[$module_name]);
             if (count($ids) > 0) {
                 $modules[$module_name] = $ids;
             }
         }
     }
     if (empty($modules)) {
         $modules = null;
     }
     return array('started' => Jetpack_Sync_Actions::do_full_sync($modules));
 }
 static function initialize_sender()
 {
     require_once dirname(__FILE__) . '/class.jetpack-sync-sender.php';
     self::$sender = Jetpack_Sync_Sender::get_instance();
     // bind the sending process
     add_filter('jetpack_sync_send_data', array(__CLASS__, 'send_data'), 10, 4);
 }
 function test_initial_sync_doesnt_sync_subscribers()
 {
     $this->factory->user->create(array('user_login' => 'theauthor', 'role' => 'author'));
     $this->factory->user->create(array('user_login' => 'theadmin', 'role' => 'administrator'));
     foreach (range(1, 10) as $i) {
         $this->factory->user->create(array('role' => 'subscriber'));
     }
     $this->full_sync->start();
     $this->sender->do_full_sync();
     $this->assertEquals(13, $this->server_replica_storage->user_count());
     $this->server_replica_storage->reset();
     $this->assertEquals(0, $this->server_replica_storage->user_count());
     $user_ids = Jetpack_Sync_Modules::get_module('users')->get_initial_sync_user_config();
     $this->assertEquals(3, count($user_ids));
     $this->full_sync->start(array('users' => 'initial'));
     $this->sender->do_full_sync();
     $this->assertEquals(3, $this->server_replica_storage->user_count());
     // finally, let's make sure that the initial sync method actually invokes our initial sync user config
     Jetpack_Sync_Actions::do_initial_sync('4.2', '4.1');
     $expected_sync_config = array('options' => true, 'network_options' => true, 'functions' => true, 'constants' => true, 'users' => 'initial');
     $full_sync_status = $this->full_sync->get_status();
     $this->assertEquals($expected_sync_config, $full_sync_status['config']);
 }
 function test_filtered_schedule_full_sync_cron_bad_schedule_sanitized()
 {
     add_filter('jetpack_sync_full_sync_interval', array($this, '__return_nonexistent_schedule'));
     Jetpack_Sync_Actions::init_sync_cron_jobs();
     $this->assertEquals(Jetpack_Sync_Actions::DEFAULT_SYNC_CRON_INTERVAL_NAME, wp_get_schedule('jetpack_sync_full_cron'));
 }