/** * Cleans old jobs in the table according to the configured lifetime of successful and failed jobs. */ protected function purge() { if ($this->options->getBuriedLifetime() > static::LIFETIME_UNLIMITED) { $buriedLifetime = $this->parseOptionsToDateTime(array('delay' => -($this->options->getBuriedLifetime() * 60))); $delete = 'DELETE FROM ' . $this->options->getTableName() . ' ' . 'WHERE finished < ? AND status = ? AND queue = ? AND finished IS NOT NULL'; $this->connection->executeUpdate($delete, array($buriedLifetime, static::STATUS_BURIED, $this->getName()), array(Type::DATETIME, Type::INTEGER, Type::STRING)); } if ($this->options->getDeletedLifetime() > static::LIFETIME_UNLIMITED) { $deletedLifetime = $this->parseOptionsToDateTime(array('delay' => -($this->options->getDeletedLifetime() * 60))); $delete = 'DELETE FROM ' . $this->options->getTableName() . ' ' . 'WHERE finished < ? AND status = ? AND queue = ? AND finished IS NOT NULL'; $this->connection->executeUpdate($delete, array($deletedLifetime, static::STATUS_DELETED, $this->getName()), array(Type::DATETIME, Type::INTEGER, Type::STRING)); } }