Exemplo n.º 1
0
 /**
  * exports this workspace database to the specified path
  *
  * This function is used mainly for backup purposes.
  *
  * @param string $path the directory where to create the sql files
  */
 public function exportDatabase($path)
 {
     $dbInfo = $this->getDBInfo();
     $databases = array("wf", "rp", "rb");
     $dbNames = array();
     foreach ($databases as $db) {
         $dbInfo = $this->getDBCredentials($db);
         $oDbMaintainer = new DataBaseMaintenance($dbInfo["host"], $dbInfo["user"], $dbInfo["pass"]);
         CLI::logging("Saving database {$dbInfo["name"]}\n");
         $oDbMaintainer->connect($dbInfo["name"]);
         $oDbMaintainer->lockTables();
         $oDbMaintainer->setTempDir($path . "/");
         $oDbMaintainer->backupDataBase($oDbMaintainer->getTempDir() . $dbInfo["name"] . ".sql");
         $oDbMaintainer->unlockTables();
         $dbNames[] = $dbInfo;
     }
     return $dbNames;
 }