Merge remote branch 'upstream/master' into PM-2790

This commit is contained in:
dheeyi
2015-05-27 15:06:36 -04:00
2 changed files with 42 additions and 15 deletions

View File

@@ -1357,13 +1357,27 @@ class workspaceTools
}
if ( !$flag && !is_null($flagFunction) ) {
$command = 'mysql'
. ' --host=' . $parameters['dbHost']
. ' --user=' . $parameters['dbUser']
. ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($parameters['dbPass'])))//no change! supports the type passwords: .\+*?[^]($)'"\"'
. ' --database=' . mysql_real_escape_string($database)
. ' --default_character_set utf8'
. ' --execute="SOURCE '.$filename.'"';
$aHost = explode(':',$parameters['dbHost']);
$dbHost = $aHost[0];
if(isset($aHost[1])){
$dbPort = $aHost[1];
$command = 'mysql'
. ' --host=' . $dbHost
. ' --port=' . $dbPort
. ' --user=' . $parameters['dbUser']
. ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($parameters['dbPass'])))//no change! supports the type passwords: .\+*?[^]($)'"\"'
. ' --database=' . mysql_real_escape_string($database)
. ' --default_character_set utf8'
. ' --execute="SOURCE '.$filename.'"';
}else{
$command = 'mysql'
. ' --host=' . $dbHost
. ' --user=' . $parameters['dbUser']
. ' --password=' . str_replace('"', '\"', str_replace("'", "\'", quotemeta($parameters['dbPass'])))//no change! supports the type passwords: .\+*?[^]($)'"\"'
. ' --database=' . mysql_real_escape_string($database)
. ' --default_character_set utf8'
. ' --execute="SOURCE '.$filename.'"';
}
shell_exec($command);
} else {
//If the safe mode of the server is actived
@@ -1624,7 +1638,7 @@ class workspaceTools
}
list ($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
if($port != ''){
$dbHost = $dbHost.$port;
$dbHost = $dbHost.$port; //127.0.0.1:3306
}
$aParameters = array('dbHost'=>$dbHost,'dbUser'=>$dbUser,'dbPass'=>$dbPass);
CLI::logging("> Connecting to system database in '$dbHost'\n");

View File

@@ -21,7 +21,7 @@ class Variable
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
$this->existsName($processUid, $arrayData["VAR_NAME"]);
$this->existsName($processUid, $arrayData["VAR_NAME"], "");
$this->throwExceptionFieldDefinition($arrayData);
@@ -142,7 +142,8 @@ class Variable
if ($variable->validate()) {
$cnn->begin();
if (isset($arrayData["VAR_NAME"])) {
$this->existsName($processUid, $arrayData["VAR_NAME"]);
$this->existsName($processUid, $arrayData["VAR_NAME"], $variableUid);
$variable->setVarName($arrayData["VAR_NAME"]);
}
if (isset($arrayData["VAR_FIELD_TYPE"])) {
@@ -428,18 +429,30 @@ class Variable
* @param string $variableName Name
*
*/
public function existsName($processUid, $variableName)
public function existsName($processUid, $variableName, $variableUidToExclude = "")
{
try {
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME);
if ($variableUidToExclude != "") {
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUidToExclude, \Criteria::NOT_EQUAL);
}
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL);
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
if ($rsCriteria->getRow()) {
throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
if ($variableName == $row["VAR_NAME"]) {
throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
}
}
} catch (\Exception $e) {
throw $e;
@@ -517,7 +530,7 @@ class Variable
$field = $pmDynaform->searchField($arrayVariable["dyn_uid"], $arrayVariable["field_id"]);
$variableDbConnectionUid = $field !== null ? $field->dbConnection : "";
$variableSql = $field !== null ? $field->sql : "";
//Get data
$_SESSION["PROCESS"] = $processUid;