/** * Check if plugin is compatible with Pods install * * @return bool */ public static function is_compatible() { // See if compatible has been checked yet, if not, check it and set it if (null === self::$compatible) { // Default compatible is false self::$compatible = false; // Check if Pods is installed, that it's 2.4+, and that pods_view exists if (defined('PODS_VERSION') && version_compare('2.4', PODS_VERSION, '<=')) { // Set compatible to true for future reference self::$compatible = true; // Setup plugin if not yet setup if (PODS_JOBS_QUEUE_VERSION !== get_option('pods_jobs_queue_version')) { self::activate(); } } } return self::$compatible; }
/** * @param $job_id * * @return bool If job was deleted successfully */ public static function delete_job($job_id) { if (!Pods_Jobs_Queue::is_compatible()) { return false; } /** * @var $wpdb wpdb */ global $wpdb; $table = self::table(); $deleted = $wpdb->delete($table, array('id' => $job_id), array('%d')); $deleted = !empty($deleted); if ($deleted) { do_action('pods_jobs_queue_job_deleted', $job_id); } return $deleted; }