is_process_running() ) { // Background process already running. return; } if ( $this->is_queue_empty() ) { // No data to process. $this->clear_scheduled_event(); return; } $this->handle(); } /** * Schedule fallback event. */ protected function schedule_event() { if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) { wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier ); } } /** * Is the updater running? * * @return boolean */ public function is_updating() { return false === $this->is_queue_empty(); } /** * Task * * Override this method to perform any actions required on each * queue item. Return the modified item for further processing * in the next pass through. Or, return false to remove the * item from the queue. * * @param string $callback Update callback function. * * @return mixed */ protected function task( $callback ) { if ( ! defined( 'UR_UPDATING' ) ) { define( 'UR_UPDATING', true ); } include_once 'functions-ur-update.php'; if ( is_callable( $callback ) ) { call_user_func( $callback ); } return false; } /** * Complete * * Override if applicable, but ensure that the below actions are * performed, or, call parent::complete(). */ protected function complete() { UR_Install::update_db_version(); parent::complete(); } }