Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 protected function fail($message, $exitCode = 1)
 {
     $this->logger->log("Failed: " . $message, Logger::LEVEL_ERROR);
     exit($exitCode);
 }
Exemplo n.º 3
0
 /**
  * Exceptions are also sent to the defined logger.
  */
 public function exceptionHandler($exception)
 {
     $this->logger->log($exception, \Piton\Log\DefaultLogger::LEVEL_ERROR);
 }