Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-2754
This commit is contained in:
9
gulliver/thirdparty/propel/Propel.php
vendored
9
gulliver/thirdparty/propel/Propel.php
vendored
@@ -602,11 +602,12 @@ class Propel {
|
||||
|
||||
foreach (self::$connectionMap as $cnn) {
|
||||
if (get_class($cnn) != "DBArrayConnection") {
|
||||
if (gettype($cnn->getResource()) == "resource" && $cnn->isConnected() && $cnn->lastQuery != $lastQuery) {
|
||||
$cnn->close();
|
||||
if(isset($cnn->lastQuery)){
|
||||
if (gettype($cnn->getResource()) == "resource" && $cnn->isConnected() && $cnn->lastQuery != $lastQuery) {
|
||||
$cnn->close();
|
||||
}
|
||||
$lastQuery = $cnn->lastQuery;
|
||||
}
|
||||
|
||||
$lastQuery = $cnn->lastQuery;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ CLI::taskOpt("multiple", "Restore from multiple compresed enumerated files.", "m
|
||||
CLI::taskOpt("workspace", "Select which workspace to restore if multiple workspaces are present in the archive.",
|
||||
"w:", "workspace=");
|
||||
CLI::taskOpt("lang", "You must specify language on which rebuild of the case cache list builder will be done; if you don't specify this, it will use 'en' by default", "l:","lang=");
|
||||
CLI::taskOpt("port", "You must specify mysql port.", "p:");
|
||||
CLI::taskRun("run_workspace_restore");
|
||||
|
||||
CLI::taskName('cacheview-repair');
|
||||
@@ -507,6 +508,7 @@ function run_workspace_restore($args, $opts) {
|
||||
}
|
||||
$info = array_key_exists("info", $opts);
|
||||
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
|
||||
$port = array_key_exists("port", $opts) ? $opts['port'] : '';
|
||||
if ($info) {
|
||||
workspaceTools::getBackupInfo($filename);
|
||||
} else {
|
||||
@@ -534,7 +536,7 @@ function run_workspace_restore($args, $opts) {
|
||||
CLI::error("Please, you should use -m parameter to restore them.\n");
|
||||
return;
|
||||
}
|
||||
workspaceTools::restore($filename, $workspace, $dstWorkspace, $overwrite, $lang);
|
||||
workspaceTools::restore($filename, $workspace, $dstWorkspace, $overwrite, $lang, $port );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -968,7 +968,7 @@ class Processes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($oData->taskExtraProperties)) {
|
||||
foreach ($oData->taskExtraProperties as $key => $value) {
|
||||
$record = $value;
|
||||
@@ -3642,8 +3642,12 @@ class Processes
|
||||
//Calculating the maximum length of file name
|
||||
$pathLength = strlen( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP );
|
||||
$length = strlen( $proTitle ) + $pathLength;
|
||||
if ($length >= 250) {
|
||||
$proTitle = myTruncate( $proTitle, 250 - $pathLength, '_', '' );
|
||||
$limit = 200;
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$limit = 150;
|
||||
}
|
||||
if ($length >= $limit) {
|
||||
$proTitle = $this->truncateName($proTitle);
|
||||
}
|
||||
$index = '';
|
||||
|
||||
@@ -3751,9 +3755,9 @@ class Processes
|
||||
}
|
||||
}
|
||||
|
||||
//For public files
|
||||
// for public files
|
||||
$PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP . $data->process['PRO_UID'];
|
||||
|
||||
|
||||
//Get WebEntry file names
|
||||
$arrayWebEntryFile = array();
|
||||
|
||||
@@ -4126,6 +4130,7 @@ class Processes
|
||||
$fsData = intval( fread( $fp, 9 ) ); //reading the size of $oData
|
||||
$contents = fread( $fp, $fsData ); //reading string $oData
|
||||
|
||||
|
||||
$path = PATH_DYNAFORM . $oData->process['PRO_UID'] . PATH_SEP;
|
||||
if (! is_dir( $path )) {
|
||||
G::verifyPath( $path, true );
|
||||
@@ -4245,7 +4250,7 @@ class Processes
|
||||
if ($fsContent > 0) {
|
||||
$fileContent = fread( $fp, $fsContent ); //reading string $XmlContent
|
||||
$newFileName = $pathPublic . $sFileName;
|
||||
|
||||
|
||||
if (in_array($sFileName, $arrayWebEntryFile)) {
|
||||
continue;
|
||||
}
|
||||
@@ -4262,6 +4267,7 @@ class Processes
|
||||
fclose( $fp );
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5161,6 +5167,18 @@ class Processes
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function truncateName($proTitle)
|
||||
{
|
||||
$proTitle = str_replace(".","_",$proTitle);
|
||||
$limit = 200;
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$limit = 150;
|
||||
}
|
||||
$excess = strlen($proTitle) - $limit;
|
||||
$proTitle = substr($proTitle,0,strlen($proTitle)-$excess);
|
||||
return $proTitle;
|
||||
}
|
||||
}
|
||||
//end class processes
|
||||
|
||||
|
||||
@@ -1371,6 +1371,8 @@ class workspaceTools
|
||||
mysql_select_db($database);
|
||||
$script = file_get_contents($filename);
|
||||
|
||||
//Replace TYPE by ENGINE
|
||||
$script = preg_replace('/\)TYPE\=|\)\sTYPE\=/', ')ENGINE=', $script);
|
||||
$lines = explode("\n", $script);
|
||||
$previous = null;
|
||||
$insert = false;
|
||||
@@ -1502,7 +1504,7 @@ class workspaceTools
|
||||
* @param string $newWorkspaceName if defined, supplies the name for the
|
||||
* workspace to restore to
|
||||
*/
|
||||
static public function restore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true, $lang = 'en')
|
||||
static public function restore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true, $lang = 'en', $port = '')
|
||||
{
|
||||
G::LoadThirdParty('pear/Archive', 'Tar');
|
||||
$backup = new Archive_Tar($filename);
|
||||
@@ -1621,6 +1623,9 @@ class workspaceTools
|
||||
CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
|
||||
}
|
||||
list ($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
|
||||
if($port != ''){
|
||||
$dbHost = $dbHost.$port;
|
||||
}
|
||||
$aParameters = array('dbHost'=>$dbHost,'dbUser'=>$dbUser,'dbPass'=>$dbPass);
|
||||
CLI::logging("> Connecting to system database in '$dbHost'\n");
|
||||
$link = mysql_connect($dbHost, $dbUser, $dbPass);
|
||||
@@ -2079,6 +2084,7 @@ class workspaceTools
|
||||
$data = $row;
|
||||
$data["DEL_INDEX"] = $row["APP_DEL_INDEX"];
|
||||
$listPaused = new ListPaused();
|
||||
$listPaused ->remove($row["APP_UID"],$row["APP_DEL_INDEX"],$data);
|
||||
$listPaused->setDeleted(false);
|
||||
$listPaused->create($data);
|
||||
}
|
||||
|
||||
@@ -32,10 +32,11 @@ try {
|
||||
}
|
||||
if (\BpmnProject::exists($_GET["pro_uid"])) {
|
||||
$exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(),false);
|
||||
|
||||
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $exporter->getProjectName() . "-*.pmx") + 1;
|
||||
$outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $exporter->getProjectName()), $version, "pmx");
|
||||
$exporter->saveExport($outputDir . $outputFilename);
|
||||
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$outputFilename = sprintf("%s-%s.%s", str_replace(" ","_",$getProjectName), $version, "pmx");
|
||||
$outputFilename = $exporter->saveExport($outputDir . $outputFilename);
|
||||
} else {
|
||||
$oProcess = new Processes();
|
||||
$proFields = $oProcess->serializeProcess($_GET["pro_uid"]);
|
||||
@@ -47,15 +48,15 @@ try {
|
||||
$response->file_hash = base64_encode($outputFilename);
|
||||
$response->success = true;
|
||||
|
||||
/* Render page */
|
||||
/* Render page */
|
||||
if (isset( $_REQUEST["processMap"] ) && $_REQUEST["processMap"] == 1) {
|
||||
$link = parse_url($result['FILENAME_LINK']);
|
||||
$result['FILENAME_LINK'] = $link['path'] . '?file_hash=' . $response->file_hash;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( "xmlform", "xmlform", "processes/processes_Export", "", $result );
|
||||
|
||||
G::RenderPage( "publish", "raw" );
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( "xmlform", "xmlform", "processes/processes_Export", "", $result );
|
||||
|
||||
G::RenderPage( "publish", "raw" );
|
||||
} else{
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
#loading{
|
||||
position:absolute;
|
||||
left:40%;
|
||||
left:45%;
|
||||
top:37%;
|
||||
padding:2px;
|
||||
z-index:20001;
|
||||
|
||||
@@ -246,31 +246,31 @@ class DataBaseConnection
|
||||
|
||||
// STEP 3 : Trying to connect to host
|
||||
$respTest['2'] = array();
|
||||
$respTest['2']['test'] = 'Trying to connect to host ' . $dataCon['DBS_SERVER'] . (($dataCon['DBS_PORT'] != '') ? ':'.$dataCon['DBS_PORT'] : '');
|
||||
$respTest['2']['test'] = 'Connecting to host ' . $dataCon['DBS_SERVER'] . (($dataCon['DBS_PORT'] != '') ? ':'.$dataCon['DBS_PORT'] : '');
|
||||
$Server->loginDbServer($dataCon['DBS_USERNAME'], $dataCon['DBS_PASSWORD']);
|
||||
$Server->setDataBase($dataCon['DBS_DATABASE_NAME'], $dataCon['DBS_PORT']);
|
||||
if ($Server->errno == 0) {
|
||||
$response = $Server->tryConnectServer($dataCon['DBS_TYPE']);
|
||||
if ($response->status != 'SUCCESS') {
|
||||
if ($returnArray) {
|
||||
$respTest['2']['error'] = "Error Testing Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
$respTest['2']['error'] = "Error Testing Connection: Connecting to host FAILED : " . $Server->error;
|
||||
} else {
|
||||
$resp['message'] = "Error Testing Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
$resp['message'] = "Error Testing Connection: Connecting to host FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($returnArray) {
|
||||
$respTest['2']['error'] = "Error Testing Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
$respTest['2']['error'] = "Error Testing Connection: Connecting to host FAILED : " . $Server->error;
|
||||
} else {
|
||||
$resp['message'] = "Error Testing Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
$resp['message'] = "Error Testing Connection: Connecting to host FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
|
||||
// STEP 4 : Trying to open database
|
||||
$respTest['3'] = array();
|
||||
$respTest['3']['test'] = 'Trying to open database [' . $dataCon['DBS_DATABASE_NAME'] . ']';
|
||||
$respTest['3']['test'] = 'Opening database [' . $dataCon['DBS_DATABASE_NAME'] . ']';
|
||||
$Server->loginDbServer($dataCon['DBS_USERNAME'], $dataCon['DBS_PASSWORD']);
|
||||
$Server->setDataBase($dataCon['DBS_DATABASE_NAME'], $dataCon['DBS_PORT']);
|
||||
if ($Server->errno == 0) {
|
||||
@@ -279,25 +279,25 @@ class DataBaseConnection
|
||||
$response = $Server->tryOpenDataBase($dataCon['DBS_TYPE']);
|
||||
if ($response->status != 'SUCCESS') {
|
||||
if ($returnArray) {
|
||||
$respTest['3']['error'] = "Error Testing Connection: Trying to open database FAILED : " . $Server->error;
|
||||
$respTest['3']['error'] = "Error Testing Connection: Opening database FAILED : " . $Server->error;
|
||||
} else {
|
||||
$resp['message'] = "Error Testing Connection: Trying to open database FAILED : " . $Server->error;
|
||||
$resp['message'] = "Error Testing Connection: Opening database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($returnArray) {
|
||||
$respTest['3']['error'] = "Error Testing Connection: Trying to open database FAILED : " . $Server->error;
|
||||
$respTest['3']['error'] = "Error Testing Connection: Opening database FAILED : " . $Server->error;
|
||||
} else {
|
||||
$resp['message'] = "Error Testing Connection: Trying to open database FAILED : " . $Server->error;
|
||||
$resp['message'] = "Error Testing Connection: Opening database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($returnArray) {
|
||||
$respTest['3']['error'] = "Error Testing Connection: Trying to open database FAILED : " . $Server->error;
|
||||
$respTest['3']['error'] = "Error Testing Connection: Opening database FAILED : " . $Server->error;
|
||||
} else {
|
||||
$resp['message'] = "Error Testing Connection: Trying to open database FAILED : " . $Server->error;
|
||||
$resp['message'] = "Error Testing Connection: Opening database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
@@ -374,4 +374,3 @@ class DataBaseConnection
|
||||
return $dbs_uid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,9 +127,13 @@ class XmlExporter extends Exporter
|
||||
if (! is_dir($parentDir)) {
|
||||
Util\Common::mk_dir($parentDir, 0775);
|
||||
}
|
||||
|
||||
|
||||
$outputFile = $this->Truncatename($outputFile);
|
||||
|
||||
file_put_contents($outputFile, $this->export());
|
||||
chmod($outputFile, 0755);
|
||||
|
||||
return basename($outputFile);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,4 +153,36 @@ class XmlExporter extends Exporter
|
||||
return $this->dom->createCDATASection($value);
|
||||
}
|
||||
}
|
||||
|
||||
public function truncateName($outputFile,$dirName = true)
|
||||
{
|
||||
$limit = 200;
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$limit = 150;
|
||||
}
|
||||
if($dirName) {
|
||||
if (strlen(basename($outputFile)) >= $limit) {
|
||||
$lastPos = strrpos(basename($outputFile),'.');
|
||||
$fileName = substr(basename($outputFile),0,$lastPos);
|
||||
$newFileName = str_replace(".","_",$fileName);
|
||||
$newFileName = str_replace(" ","_",$fileName);
|
||||
$excess = strlen($newFileName) - $limit;
|
||||
$newFileName = substr($newFileName,0,strlen($newFileName)-$excess);
|
||||
$newOutputFile = str_replace($fileName,$newFileName,$outputFile);
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$newOutputFile = str_replace("/", DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, $newOutputFile);
|
||||
}
|
||||
$outputFile = $newOutputFile;
|
||||
}
|
||||
} else {
|
||||
$outputFile = str_replace(".","_",$outputFile);
|
||||
$outputFile = str_replace(" ","_",$outputFile);
|
||||
if (strlen($outputFile) >= $limit) {
|
||||
$excess = strlen($outputFile) - $limit;
|
||||
$newFileName = substr($outputFile,0,strlen($outputFile)-$excess);
|
||||
$outputFile = $newFileName;
|
||||
}
|
||||
}
|
||||
return $outputFile;
|
||||
}
|
||||
}
|
||||
@@ -108,13 +108,14 @@ class Project extends Api
|
||||
public function export($prj_uid)
|
||||
{
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid);
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(),false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $exporter->getProjectName() . "-*.pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $exporter->getProjectName()), $version, "pmx");
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
$exporter->setMetadata("export_version", $version);
|
||||
$exporter->saveExport($outputFilename);
|
||||
$outputFilename = $outputDir . $exporter->saveExport($outputFilename);
|
||||
|
||||
$httpStream = new \ProcessMaker\Util\IO\HttpStream();
|
||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||
|
||||
@@ -558,7 +558,14 @@ function newProcess(params)
|
||||
width: 260,
|
||||
maskRe: /^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\...*)(\..+)?$)[^\x00-\x1f\\?*\";|/]+$/i,
|
||||
allowBlank: false,
|
||||
vtype: "textWithoutTags"
|
||||
vtype: "textWithoutTags",
|
||||
listeners: {
|
||||
'focus' : function(value){
|
||||
document.getElementById("PRO_TITLE").onpaste = function() {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
}, {
|
||||
id: 'PRO_DESCRIPTION',
|
||||
fieldLabel: _('ID_DESCRIPTION'),
|
||||
|
||||
Reference in New Issue
Block a user