Exemple #1
0
/**
 * Get jobs for the specified site.
 *
 * @param int|stdClass $site Site ID or object (from {@see get_blog_details}) to get jobs for. Null for current site.
 * @return Job[] List of jobs on the site.
 */
function get_jobs($site = null)
{
    global $wpdb;
    if (empty($site)) {
        $site = get_current_blog_id();
    }
    return Job::get_by_site($site);
}
 /**
  * Run a job.
  *
  * ## OPTIONS
  *
  * <id>
  * : ID of the job to run.
  *
  * @synopsis <id>
  */
 public function run($args, $assoc_args)
 {
     $job = Job::get($args[0]);
     if (empty($job)) {
         WP_CLI::error('Invalid job ID');
     }
     /**
      * Fires scheduled events.
      *
      * @ignore
      *
      * @param string $hook Name of the hook that was scheduled to be fired.
      * @param array  $args The arguments to be passed to the hook.
      */
     do_action_ref_array($job->hook, $job->args);
 }