コード例 #1
0
 private function get_client()
 {
     if (!$this->client) {
         $this->client = Jetpack_Sync_Client::getInstance();
     }
     return $this->client;
 }
コード例 #2
0
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #3
0
 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'));
 }
コード例 #4
0
 public function setUp()
 {
     parent::setUp();
     $this->client = Jetpack_Sync_Client::getInstance();
     $this->client->set_dequeue_max_bytes(5000000);
     // process 5MB of items at a time
     $this->client->set_sync_wait_time(0);
     // disable rate limiting
     $server = new Jetpack_Sync_Server();
     $this->server = $server;
     // bind the client to the server
     remove_all_filters('jetpack_sync_client_send_data');
     add_filter('jetpack_sync_client_send_data', array($this, 'serverReceive'));
     // bind the two storage systems to the server events
     $this->server_replica_storage = new Jetpack_Sync_Test_Replicastore();
     $this->server_replicator = new Jetpack_Sync_Server_Replicator($this->server_replica_storage);
     $this->server_replicator->init();
     $this->server_event_storage = new Jetpack_Sync_Server_Eventstore();
     $this->server_event_storage->init();
 }
コード例 #5
0
 protected function result()
 {
     $client = Jetpack_Sync_Client::getInstance();
     return $client->get_settings();
 }
コード例 #6
0
 function full_sync_status()
 {
     $client = Jetpack_Sync_Client::getInstance();
     return $client->get_full_sync_client()->get_complete_status();
 }