/** * Disable a schedule * * @param string $name * * @return bool * @throws \Comodojo\Exception\DatabaseException * @throws \Exception */ public static final function disableSchedule($name) { if (empty($name)) { throw new Exception("Invalid or empty job name"); } try { $db = new EnhancedDatabase(EXTENDER_DATABASE_MODEL, EXTENDER_DATABASE_HOST, EXTENDER_DATABASE_PORT, EXTENDER_DATABASE_NAME, EXTENDER_DATABASE_USER, EXTENDER_DATABASE_PASS); $result = $db->tablePrefix(EXTENDER_DATABASE_PREFIX)->table(EXTENDER_DATABASE_TABLE_JOBS)->keys("enabled")->values(array(false))->where("name", "=", $name)->update(); } catch (DatabaseException $de) { throw $de; } Cache::purge(); Planner::release(); return $result->getAffectedRows() == 1 ? true : false; }
/** * Delete all status file after exit() called * */ public final function shutdown($force = false) { if ($this->parent_pid == posix_getpid()) { $this->logger->info("Shutdown in progress, cleaning environment"); Lock::release(); Status::release(); Queue::release(); Planner::release(); } if ($force === true) { $this->logger->info("Shutdown in progress, cleaning environment"); Status::release(); Queue::release(); Planner::release(); } }
public function testRelease() { $result = \Comodojo\Extender\Planner::release(); $this->assertTrue($result); }