Amazon_S3_And_CloudFront::clear_scheduled_event PHP Method

clear_scheduled_event() public method

Wrapper for clearing scheduled events for a specific cron job
public clear_scheduled_event ( string $hook )
$hook string
    public function clear_scheduled_event($hook)
    {
        $timestamp = wp_next_scheduled($hook);
        if ($timestamp) {
            wp_unschedule_event($timestamp, $hook);
        }
        if (is_multisite()) {
            // Always clear schedule events on primary blog
            $this->switch_to_blog();
            $timestamp = wp_next_scheduled($hook);
            if ($timestamp) {
                wp_unschedule_event($timestamp, $hook);
            }
            $this->restore_current_blog();
        }
    }

Usage Example

 /**
  * Pause upgrade
  */
 function action_pause_update()
 {
     if (!isset($_GET['update']) || $this->upgrade_name !== sanitize_key($_GET['update'])) {
         return;
     }
     $this->as3cf->clear_scheduled_event($this->cron_hook);
     $this->change_status_request(self::STATUS_PAUSED);
 }
All Usage Examples Of Amazon_S3_And_CloudFront::clear_scheduled_event
Amazon_S3_And_CloudFront