PM-3132 "Designer > BPMN Designer: Al aplicar el..." SOLVED

Issue:
    Designer > BPMN Designer: Al aplicar el hotfix 3.0.0.7 los templates de Action By Email no se pueden editar en
    los procesos antiguos
Cause:
    En algunos procesos los files de action-by-email no tienen su registro en la base de datos
Solution:
    Se crea el metodo que registra los files faltantes en la base de datos, esto con las siguientes acciones:
        - Al ejecutar el comando "upgrade"
        - Al importar un proceso
This commit is contained in:
Victor Saisa Lopez
2015-07-21 15:55:20 -04:00
parent 1ca3c42425
commit 5acab1bd0a
4 changed files with 182 additions and 71 deletions

View File

@@ -111,70 +111,18 @@ class workspaceTools
$final = $stop - $start;
CLI::logging("<*> Backup log files Process took $final seconds.\n");
CLI::logging("> Updating Files Manager...\n\n");
$this->upgradeFilesManager($workSpace);
$start = microtime(true);
CLI::logging("> Migrate new lists...\n");
$this->migrateList($workSpace);
$stop = microtime(true);
$final = $stop - $start;
CLI::logging("<*> Migrate new lists Process took $final seconds.\n");
}
/**
* Function upgradeFilesManager
* access public
*/
public function upgradeFilesManager($workSpace) {
$this->initPropel(true);
$con = Propel::getConnection("root");
$stmt = $con->createStatement();
$sDirectory = glob(PATH_DATA . "sites/" . $workSpace . "/" . "mailTemplates/*");
$sDirectoryPublic = glob(PATH_DATA . "sites/" . $workSpace . "/" . "public/*");
$files = array();
foreach($sDirectory as $mailTemplate) {
if (is_dir($mailTemplate)) {
$inner_files = listFiles($mailTemplate);
if (is_array($inner_files)) $files = array_merge($files, $inner_files);
}
if (is_file($mailTemplate)) {
array_push($files, $mailTemplate);
}
}
foreach($sDirectoryPublic as $publicFile) {
if (is_dir($publicFile)) {
$inner_files = listFiles($publicFile);
if (is_array($inner_files)) $files = array_merge($files, $inner_files);
}
if (is_file($publicFile)) {
array_push($files, $publicFile);
}
}
$sDir = PATH_DATA . "sites/" . $workSpace . "/" . "mailTemplates/";
$sDirPublic = PATH_DATA . "sites/" . $workSpace . "/" . "public/";
foreach ($files as $aFile) {
if (strpos($aFile, $sDir) !== false){
$processUid = current(explode("/", str_replace($sDir,'',$aFile)));
} else {
$processUid = current(explode("/", str_replace($sDirPublic,'',$aFile)));
}
$sql = "SELECT PROCESS_FILES.PRF_PATH FROM PROCESS_FILES WHERE PROCESS_FILES.PRF_PATH='" . $aFile ."'";
$appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
$fileUid = '';
foreach ($appRows as $row) {
$fileUid = $row["PRF_PATH"];
}
if ($fileUid !== $aFile) {
$sPkProcessFiles = G::generateUniqueID();
$sDate = date('Y-m-d H:i:s');
$sql = "INSERT INTO PROCESS_FILES (PRF_UID, PRO_UID, USR_UID, PRF_UPDATE_USR_UID,
PRF_PATH, PRF_TYPE, PRF_EDITABLE, PRF_CREATE_DATE, PRF_UPDATE_DATE)
VALUES ('".$sPkProcessFiles."', '".$processUid."', '00000000000000000000000000000001', '',
'".$aFile."', 'file', 'true', '".$sDate."', NULL)";
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
}
}
$start = microtime(true);
CLI::logging("> Updating Files Manager...\n");
$this->processFilesUpgrade();
$stop = microtime(true);
CLI::logging("<*> Updating Files Manager took " . ($stop - $start) . " seconds.\n");
}
/**
@@ -1564,10 +1512,10 @@ class workspaceTools
$version = explode('-', $version);
$versionPresent = ( isset($version[0])) ? $version[0] : '';
CLI::logging(CLI::warning("
Warning: A workspace from a newer version of ProcessMaker can NOT be restored in an older version of
ProcessMaker. For example, restoring from v.3.0 to v.2.5 will not work. However, it may be possible
to restore a workspace from an older version to an newer version of ProcessMaker, although error
messages may be displayed during the restore process. Make sure to run the \"processmaker cacheview-repair\"
Warning: A workspace from a newer version of ProcessMaker can NOT be restored in an older version of
ProcessMaker. For example, restoring from v.3.0 to v.2.5 will not work. However, it may be possible
to restore a workspace from an older version to an newer version of ProcessMaker, although error
messages may be displayed during the restore process. Make sure to run the \"processmaker cacheview-repair\"
and \"processmaker migrate-new-cases-lists\" commands after restoring a workspace.") . "\n");
foreach ($metaFiles as $metaFile) {
@@ -2226,5 +2174,31 @@ class workspaceTools
throw $e;
}
}
/**
* Process-Files upgrade
*
* return void
*/
public function processFilesUpgrade()
{
try {
if (!defined("PATH_DATA_MAILTEMPLATES")) {
define("PATH_DATA_MAILTEMPLATES", PATH_DATA_SITE . "mailTemplates" . PATH_SEP);
}
if (!defined("PATH_DATA_PUBLIC")) {
define("PATH_DATA_PUBLIC", PATH_DATA_SITE . "public" . PATH_SEP);
}
$this->initPropel(true);
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
$filesManager->processFilesUpgrade();
} catch (Exception $e) {
throw $e;
}
}
}