/** * Update the database * * @return null */ public function update() { $this->connection = new \PDO($this->dsn, $this->user, $this->password); $files = array(); foreach (new \DirectoryIterator($this->deltaPath) as $fileInfo) { if ($fileInfo->isDot()) { continue; } if (preg_match("/.*\\.sql\$/", $fileInfo->getFilename())) { $files[] = $fileInfo->getPathname(); } } sort($files); $this->logger->log("Processing Deltas"); foreach ($files as $file) { if ($statements = $this->parseFile($file)) { $this->run($statements); $filename = basename($file); $this->writeChangelog($filename); } } $this->connection = null; }
protected function fail($message, $exitCode = 1) { $this->logger->log("Failed: " . $message, Logger::LEVEL_ERROR); exit($exitCode); }
/** * Exceptions are also sent to the defined logger. */ public function exceptionHandler($exception) { $this->logger->log($exception, \Piton\Log\DefaultLogger::LEVEL_ERROR); }