PM-2693 "WebEntry: Cuando importas un proceso que tiene..." SOLVED
Issue:
WebEntry: Cuando importas un proceso que tiene webEntry's configurados no se eliminan.
Cause:
Nuevo requerimiento de funciones para los antiguos procesos (.pm)
Solution:
- Al exportar un proceso con extension ".pm", no se exportan los WebEntries
- Al importar un proceso con extension ".pm", si este ya tiene WebEntries, estos no son importados
This commit is contained in:
@@ -3739,9 +3739,25 @@ 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();
|
||||
|
||||
if (is_dir($PUBLIC_ROOT_PATH)) {
|
||||
if ($dirh = opendir($PUBLIC_ROOT_PATH)) {
|
||||
while (($file = readdir($dirh)) !== false) {
|
||||
if (preg_match("/^(.+)Post\.php$/", $file, $arrayMatch)) {
|
||||
$arrayWebEntryFile[] = $arrayMatch[1] . ".php";
|
||||
$arrayWebEntryFile[] = $arrayMatch[1] . "Post.php";
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dirh);
|
||||
}
|
||||
}
|
||||
|
||||
//if this process have any mailfile
|
||||
if (is_dir( $PUBLIC_ROOT_PATH )) {
|
||||
//get mail files list from this directory
|
||||
@@ -3749,6 +3765,10 @@ class Processes
|
||||
foreach ($file_list as $filename) {
|
||||
// verify if this filename is a valid file, because it could be . or .. on *nix systems
|
||||
if ($filename != '.' && $filename != '..') {
|
||||
if (in_array($filename, $arrayWebEntryFile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (@is_readable( $PUBLIC_ROOT_PATH . PATH_SEP . $filename )) {
|
||||
$sFileName = $PUBLIC_ROOT_PATH . PATH_SEP . $filename;
|
||||
if (file_exists( $sFileName )) {
|
||||
@@ -4094,7 +4114,6 @@ 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 );
|
||||
@@ -4180,6 +4199,28 @@ class Processes
|
||||
}
|
||||
|
||||
if (trim( $sIdentifier ) == 'PUBLIC') {
|
||||
//Get WebEntry file names
|
||||
$arrayWebEntryFile = array();
|
||||
|
||||
$fh = fopen($pmFilename, "rb");
|
||||
$contents = fread($fh, intval(fread($fh, 9))); //Reading string $oData
|
||||
|
||||
while (!feof($fh)) {
|
||||
$fsFileName = intval(fread($fh, 9)); //Reading the size of $filename
|
||||
|
||||
if ($fsFileName > 0) {
|
||||
$sFileName = fread($fh, $fsFileName); //Reading filename string
|
||||
|
||||
if (preg_match("/^(.+)Post\.php$/", $sFileName, $arrayMatch)) {
|
||||
$arrayWebEntryFile[] = $arrayMatch[1] . ".php";
|
||||
$arrayWebEntryFile[] = $arrayMatch[1] . "Post.php";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fh);
|
||||
|
||||
//Public files
|
||||
$sIdentifier = 1;
|
||||
while (! feof( $fp ) && is_numeric( $sIdentifier )) {
|
||||
$sIdentifier = fread( $fp, 9 ); //reading the size of $filename
|
||||
@@ -4192,6 +4233,11 @@ class Processes
|
||||
if ($fsContent > 0) {
|
||||
$fileContent = fread( $fp, $fsContent ); //reading string $XmlContent
|
||||
$newFileName = $pathPublic . $sFileName;
|
||||
|
||||
if (in_array($sFileName, $arrayWebEntryFile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$bytesSaved = @file_put_contents( $newFileName, $fileContent );
|
||||
if ($bytesSaved != $fsContent) {
|
||||
throw (new Exception( 'Error writing Public file in directory : ' . $pathPublic ));
|
||||
@@ -4204,7 +4250,6 @@ class Processes
|
||||
fclose( $fp );
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user