Пример #1
0
 /**
  * Create new patch.
  *
  * @param string id Id of the patch.
  */
 public function __construct($id)
 {
     parent::__construct($id);
     clearstatcache();
 }
Пример #2
0
 /**
  * Revert the patch.
  *
  * @return boolean <code>true</code> if patching was successful, <code>false</code> if not.
  */
 public function undo()
 {
     if ($this->isOpen()) {
         return true;
     }
     $sm = \ZMRuntime::getDatabase()->getSchemaManager();
     foreach ($this->getTables() as $table) {
         $sm->dropTable($table);
     }
     if (isset($this->sqlUndoFiles)) {
         $baseDir = $this->patchRoot;
         $status = true;
         foreach ($this->sqlUndoFiles as $file) {
             $sql = file($baseDir . $file);
             $status |= $this->runSQL($sql);
         }
         return $status;
     }
     return parent::undo();
 }