ecksum() { $store = new Replicastore(); do_action( 'jetpack_sync_checksum', $store->checksum_all() ); } /** * Reset the incremental sync queue. * * @access public */ public function reset_sync_queue() { $this->sync_queue->reset(); } /** * Reset the full sync queue. * * @access public */ public function reset_full_sync_queue() { $this->full_sync_queue->reset(); } /** * Set the maximum bytes to checkout without exceeding the memory limit. * * @access public * * @param int $size Maximum bytes to checkout. */ public function set_dequeue_max_bytes( $size ) { $this->dequeue_max_bytes = $size; } /** * Set the maximum bytes in a single encoded item. * * @access public * * @param int $max_bytes Maximum bytes in a single encoded item. */ public function set_upload_max_bytes( $max_bytes ) { $this->upload_max_bytes = $max_bytes; } /** * Set the maximum number of sync items in a single action. * * @access public * * @param int $max_rows Maximum number of sync items. */ public function set_upload_max_rows( $max_rows ) { $this->upload_max_rows = $max_rows; } /** * Set the sync wait time (in seconds). * * @access public * * @param int $seconds Sync wait time. */ public function set_sync_wait_time( $seconds ) { $this->sync_wait_time = $seconds; } /** * Get current sync wait time (in seconds). * * @access public * * @return int Sync wait time. */ public function get_sync_wait_time() { return $this->sync_wait_time; } /** * Set the enqueue wait time (in seconds). * * @access public * * @param int $seconds Enqueue wait time. */ public function set_enqueue_wait_time( $seconds ) { $this->enqueue_wait_time = $seconds; } /** * Get current enqueue wait time (in seconds). * * @access public * * @return int Enqueue wait time. */ public function get_enqueue_wait_time() { return $this->enqueue_wait_time; } /** * Set the sync wait threshold (in seconds). * * @access public * * @param int $seconds Sync wait threshold. */ public function set_sync_wait_threshold( $seconds ) { $this->sync_wait_threshold = $seconds; } /** * Get current sync wait threshold (in seconds). * * @access public * * @return int Sync wait threshold. */ public function get_sync_wait_threshold() { return $this->sync_wait_threshold; } /** * Set the maximum time for perfirming a checkout of items from the queue (in seconds). * * @access public * * @param int $seconds Maximum dequeue time. */ public function set_max_dequeue_time( $seconds ) { $this->max_dequeue_time = $seconds; } /** * Initialize the sync queues, codec and set the default settings. * * @access public */ public function set_defaults() { $this->sync_queue = new Queue( 'sync' ); $this->full_sync_queue = new Queue( 'full_sync' ); $this->set_codec(); // Saved settings. Settings::set_importing( null ); $settings = 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_enqueue_wait_time( $settings['enqueue_wait_time'] ); $this->set_sync_wait_threshold( $settings['sync_wait_threshold'] ); $this->set_max_dequeue_time( Defaults::get_max_sync_execution_time() ); } /** * Reset sync queues, modules and settings. * * @access public */ public function reset_data() { $this->reset_sync_queue(); $this->reset_full_sync_queue(); foreach ( Modules::get_modules() as $module ) { $module->reset_data(); } // Reset Sync locks without unlocking queues since we already reset those. Actions::reset_sync_locks( false ); Settings::reset_data(); } /** * Perform cleanup at the event of plugin uninstallation. * * @access public */ public function uninstall() { // Lets delete all the other fun stuff like transient and option and the sync queue. $this->reset_data(); // Delete the full sync status. delete_option( 'jetpack_full_sync_status' ); // Clear the sync cron. wp_clear_scheduled_hook( 'jetpack_sync_cron' ); wp_clear_scheduled_hook( 'jetpack_sync_full_cron' ); } }