/** * Destructor, removes pid-file * */ public function __destruct() { if ($pidFilePath = Configure::read('Queue.pidfilepath')) { if (function_exists('posix_getpid')) { $pid = posix_getpid(); } else { $pid = $this->QueuedTask->key(); } $file = $pidFilePath . 'queue_' . $pid . '.pid'; if (file_exists($file)) { unlink($file); } } }