Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Wendy Nestor
2014-09-10 08:55:14 -04:00
2 changed files with 27 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ G::LoadClass("TaskUser");
abstract class patch abstract class patch
{ {
static protected $isPathchable = false; static protected $isPathchable = false;
static public $dbAdapter = 'mysql';
abstract static public function isApplicable(); abstract static public function isApplicable();
abstract static public function execute(); abstract static public function execute();
} }

View File

@@ -686,16 +686,34 @@ class workspaceTools
{ {
G::LoadClass("patch"); G::LoadClass("patch");
$this->initPropel( true ); $this->initPropel( true );
p11835::$dbAdapter = $this->dbAdapter;
p11835::isApplicable(); p11835::isApplicable();
$systemSchema = System::getSystemSchema(); $systemSchema = System::getSystemSchema($this->dbAdapter);
$systemSchemaRbac = System::getSystemSchemaRbac();// obtiene el Schema de Rbac $systemSchemaRbac = System::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema
$this->upgradeSchema( $systemSchema ); $this->upgradeSchema( $systemSchema );
$this->upgradeSchema( $systemSchemaRbac, false, true, $onedb ); // Hace Upgrade de Rbac $this->upgradeSchema( $systemSchemaRbac, false, true, $onedb ); // perform Upgrade to Rbac
$this->upgradeData(); $this->upgradeData();
p11835::execute(); p11835::execute();
return true; return true;
} }
private function setFormatRows()
{
switch ($this->dbAdapter) {
case 'mysql':
$this->assoc = MYSQL_ASSOC;
$this->num = MYSQL_NUM;
break;
case 'sqlsrv':
$this->assoc = SQLSRV_FETCH_ASSOC;
$this->num = SQLSRV_FETCH_NUMERIC;
break;
default:
throw new Exception("Unknown adapter hae been set for associate fetch index row format.");
break;
}
}
/** /**
* Upgrade this workspace database from a schema * Upgrade this workspace database from a schema
* *
@@ -712,12 +730,14 @@ class workspaceTools
throw new Exception("Only MySQL is supported"); throw new Exception("Only MySQL is supported");
} }
$this->setFormatRows();
$workspaceSchema = $this->getSchema($rbac); $workspaceSchema = $this->getSchema($rbac);
$oDataBase = $this->getDatabase($rbac); $oDataBase = $this->getDatabase($rbac);
if (!$onedb) { if (!$onedb) {
if($rbac){ if($rbac){
$rename = System::verifyRbacSchema($workspaceSchema); $rename = System::verifyRbacSchema($workspaceSchema);
if (count($rename) > 0) { if (count($rename) > 0) {
foreach ($rename as $tableName) { foreach ($rename as $tableName) {
@@ -735,12 +755,12 @@ class workspaceTools
if ($changed) { if ($changed) {
return $changes; return $changes;
} else { } else {
CLI::logging("-> Nothing to change in the data base structure (" . ($rbac ? 'RBAC' : 'WORKFLOW') . ")\n"); CLI::logging("-> Nothing to change in the data base structure of " . (($rbac == true)?"RBAC":"WORKFLOW") . "\n");
return $changed; return $changed;
} }
} }
$oDataBase->iFetchType = MYSQL_NUM; $oDataBase->iFetchType = $this->num;
$oDataBase->logQuery(count($changes)); $oDataBase->logQuery(count($changes));