PM-773 Unify DB no unifica cuando la bd tiene nombre distinto al ws.

PROBLEMA:
Cuando la BD tiene un nombre distinto al WS el unify no funciona bien, creando una nueva bd con el nombre del ws.

SOLUCION:
Se recupera el nombre correcto de la bd y ya no se usa el nombre del ws para hacer el unify, ademas se agrego una validacion en la funcion resetDBInfoCallback() que solo aplica cuando se esta corriendo el unify, para q solo se cambie los prefijos de la configuracion del archivo db.php y nada mas.
This commit is contained in:
jennylee
2014-10-27 18:14:16 -04:00
parent 39b386d5f2
commit 282c8b304c
2 changed files with 14 additions and 4 deletions

View File

@@ -250,7 +250,16 @@ class workspaceTools
/* Change the database name to the new workspace, following the standard
* of prefix (either wf_, rp_, rb_) and the workspace name.
*/
$dbName = $dbPrefix[$key] . $this->name;
if($this->unify){
$nameDb = explode("_", $value);
if(!isset($nameDb[1])){
$dbName = $value;
} else {
$dbName = $dbPrefix[$key] . $nameDb[1];
}
}else {
$dbName = $dbPrefix[$key] . $this->name;
}
} else {
$dbName = $value;
}
@@ -273,7 +282,7 @@ class workspaceTools
* @param bool $resetDBNames if true, also reset all database names
* @return array contains the new database names as values
*/
public function resetDBInfo($newHost, $resetDBNames = true, $onedb = false)
public function resetDBInfo($newHost, $resetDBNames = true, $onedb = false, $unify = false)
{
if (count(explode(":", $newHost)) < 2) {
$newHost .= ':3306';
@@ -282,6 +291,7 @@ class workspaceTools
$this->resetDBNames = $resetDBNames;
$this->resetDBDiff = array();
$this->onedb = $onedb;
$this->unify = $unify;
if (!$this->workspaceExists()) {
throw new Exception("Could not find db.php in the workspace");