From 2327b76190da824c7328cd9644955d94489da65e Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Fri, 26 Sep 2014 13:00:16 -0400 Subject: [PATCH 1/5] PM-365 Upgrade de ls PM2.5 + enterprise 2.0.17 puede dar conflictos SOLVED - The enterprise plugin files cause conflicts. - A validation was added in function upgrade moving the files to the shared. --- workflow/engine/bin/tasks/cliAddons.php | 6 +- workflow/engine/classes/class.wsTools.php | 61 +++++++++++++++++++ .../methods/enterprise/addonsStoreAction.php | 2 +- .../engine/templates/cases/casesListSetup.js | 2 +- 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/workflow/engine/bin/tasks/cliAddons.php b/workflow/engine/bin/tasks/cliAddons.php index 2a618b8f4..eae7ce857 100644 --- a/workflow/engine/bin/tasks/cliAddons.php +++ b/workflow/engine/bin/tasks/cliAddons.php @@ -12,7 +12,7 @@ if (CLI2) { Download and install an addon EOT ); - CLI::taskRun(run_addon_install); + CLI::taskRun(run_addon_core_install); } else { pake_desc("install addon"); pake_task("addon-install"); @@ -28,8 +28,8 @@ CLI::taskArg('workspace', false); CLI::taskArg('hash', false); CLI::taskRun("change_hash"); -//function run_addon_install($args, $opts) { -function run_addon_install($args) +//function run_addon_core_install($args, $opts) { +function run_addon_core_install($args) { try { if (!extension_loaded("mysql")) { diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 82e481500..842fec218 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -62,6 +62,13 @@ class workspaceTools */ public function upgrade($first = false, $buildCacheView = false, $workSpace = SYS_SYS, $onedb = false, $lang = 'en') { + $start = microtime(true); + CLI::logging("> Verify enterprise old...\n"); + $this->verifyEnterprise($workSpace); + $stop = microtime(true); + $final = $stop - $start; + CLI::logging("<*> Verify took $final seconds.\n"); + $start = microtime(true); CLI::logging("> Updating database...\n"); $this->upgradeDatabase($onedb); @@ -1630,5 +1637,59 @@ class workspaceTools G::LoadClass("enterprise"); enterpriseClass::setHashPassword($response); } + + public function verifyEnterprise ($workspace) + { + $this->initPropel( true ); + $pathBackup = PATH_DATA . 'backups'; + if (!file_exists($pathBackup)) { + G::mk_dir($pathBackup, 0777); + } + $pathNewFile = PATH_DATA . 'backups' . PATH_SEP . 'enterpriseBackup'; + $pathDirectoryEnterprise = PATH_CORE . 'plugins' . PATH_SEP . 'enterprise'; + $pathFileEnterprise = PATH_CORE . 'plugins' . PATH_SEP . 'enterprise.php'; + + if (!file_exists($pathDirectoryEnterprise) && !file_exists(PATH_PLUGIN . 'enterprise.php')) { + CLI::logging(" Without changes... \n"); + return true; + } + CLI::logging(" Migrating version Enterprise Core...\n"); + if (!file_exists($pathNewFile)) { + CLI::logging(" Creating folder in $pathNewFile\n"); + G::mk_dir($newDiretory, 0777); + } + $shared_stat = stat(PATH_DATA); + if (file_exists($pathDirectoryEnterprise)) { + CLI::logging(" Copying Directory Enterprise to $pathNewFile...\n"); + + if ($shared_stat !== false) { + workspaceTools::dirPerms($pathDirectoryEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']); + } else { + CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n"); + } + if (G::recursive_copy($pathDirectoryEnterprise, $pathNewFile . PATH_SEP. 'enterprise')) { + CLI::logging(" Removing $pathDirectoryEnterprise...\n"); + G::rm_dir($pathDirectoryEnterprise); + } else { + CLI::logging(CLI::error(" Error: Failure at coping from $pathDirectoryEnterprise...\n")); + } + if (file_exists($pathDirectoryEnterprise)) { + CLI::logging(CLI::info(" Remove manually $pathDirectoryEnterprise...\n")); + } + } + if (file_exists($pathFileEnterprise)) { + CLI::logging(" Copying file Enterprise.php to $pathNewFile...\n"); + if ($shared_stat !== false) { + workspaceTools::dirPerms($pathFileEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']); + } else { + CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n"); + } + CLI::logging(" Removing $pathFileEnterprise...\n"); + copy($pathFileEnterprise , $pathNewFile. PATH_SEP . 'enterprise.php'); + if (file_exists($pathFileEnterprise)) { + CLI::logging(CLI::info(" Remove manually $pathFileEnterprise...\n")); + } + } + } } diff --git a/workflow/engine/methods/enterprise/addonsStoreAction.php b/workflow/engine/methods/enterprise/addonsStoreAction.php index b04ed67c7..ec0b59622 100644 --- a/workflow/engine/methods/enterprise/addonsStoreAction.php +++ b/workflow/engine/methods/enterprise/addonsStoreAction.php @@ -27,7 +27,7 @@ function runBgProcessmaker($task, $log) $elem = array_shift($data); //delete first element - run_addon_install($data); + run_addon_core_install($data); } try { diff --git a/workflow/engine/templates/cases/casesListSetup.js b/workflow/engine/templates/cases/casesListSetup.js index e03e791af..b9f2b8631 100644 --- a/workflow/engine/templates/cases/casesListSetup.js +++ b/workflow/engine/templates/cases/casesListSetup.js @@ -374,7 +374,7 @@ Ext.onReady(function () { renderer: function (value, metaData, record, rowIndex, colIndex, store) { var arrayMatch = []; - var newValue = value; + var newValue = _(value); if ((arrayMatch = /^\*\*(.+)\*\*$/.exec(value))) { newValue = _(arrayMatch[1]); From 1bb1cabfad841d512a5334752c04888431cf84b5 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Fri, 26 Sep 2014 14:15:59 -0400 Subject: [PATCH 2/5] PM-365 Upgrade de ls PM2.5 + enterprise 2.0.17 puede dar conflictos IMPROVEMENT - The enterprise plugin files cause conflicts. - A validation was added in function upgrade moving the files to the shared. --- workflow/engine/classes/class.wsTools.php | 1 + 1 file changed, 1 insertion(+) diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 842fec218..95749c69a 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -1686,6 +1686,7 @@ class workspaceTools } CLI::logging(" Removing $pathFileEnterprise...\n"); copy($pathFileEnterprise , $pathNewFile. PATH_SEP . 'enterprise.php'); + G::rm_dir($pathDirectoryEnterprise); if (file_exists($pathFileEnterprise)) { CLI::logging(CLI::info(" Remove manually $pathFileEnterprise...\n")); } From db80e8a0faf8ea5d45c1b2efcce204d3ae3e8221 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Fri, 26 Sep 2014 14:18:59 -0400 Subject: [PATCH 3/5] PM-365 Upgrade de ls PM2.5 + enterprise 2.0.17 puede dar conflictos IMPROVEMENT - The enterprise plugin files cause conflicts. - A validation was added in function upgrade moving the files to the shared. --- workflow/engine/classes/class.wsTools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 95749c69a..cd5213f59 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -1686,7 +1686,7 @@ class workspaceTools } CLI::logging(" Removing $pathFileEnterprise...\n"); copy($pathFileEnterprise , $pathNewFile. PATH_SEP . 'enterprise.php'); - G::rm_dir($pathDirectoryEnterprise); + G::rm_dir($pathFileEnterprise); if (file_exists($pathFileEnterprise)) { CLI::logging(CLI::info(" Remove manually $pathFileEnterprise...\n")); } From aafd2d260cf9dcefc9bc67ba29d3b8cade7003af Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Mon, 29 Sep 2014 11:38:08 -0400 Subject: [PATCH 4/5] PM-365 Upgrade de ls PM2.5 + enterprise 2.0.17 puede dar conflictos IMPROVEMENT - The enterprise plugin files cause conflicts. - A validation was added in function upgrade moving the files to the shared. --- workflow/engine/classes/class.wsTools.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index cd5213f59..cdc4aeb6a 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -1653,36 +1653,36 @@ class workspaceTools CLI::logging(" Without changes... \n"); return true; } - CLI::logging(" Migrating version Enterprise Core...\n"); + CLI::logging(" Migrating Enterprise Core version...\n"); if (!file_exists($pathNewFile)) { CLI::logging(" Creating folder in $pathNewFile\n"); G::mk_dir($newDiretory, 0777); } $shared_stat = stat(PATH_DATA); if (file_exists($pathDirectoryEnterprise)) { - CLI::logging(" Copying Directory Enterprise to $pathNewFile...\n"); + CLI::logging(" Copying Enterprise Directory to $pathNewFile...\n"); if ($shared_stat !== false) { workspaceTools::dirPerms($pathDirectoryEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']); } else { - CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n"); + CLI::logging(CLI::error("Could not get shared folder permissions, workspace permissions couldn't be changed") . "\n"); } if (G::recursive_copy($pathDirectoryEnterprise, $pathNewFile . PATH_SEP. 'enterprise')) { CLI::logging(" Removing $pathDirectoryEnterprise...\n"); G::rm_dir($pathDirectoryEnterprise); } else { - CLI::logging(CLI::error(" Error: Failure at coping from $pathDirectoryEnterprise...\n")); + CLI::logging(CLI::error(" Error: Failure to copy from $pathDirectoryEnterprise...\n")); } if (file_exists($pathDirectoryEnterprise)) { CLI::logging(CLI::info(" Remove manually $pathDirectoryEnterprise...\n")); } } if (file_exists($pathFileEnterprise)) { - CLI::logging(" Copying file Enterprise.php to $pathNewFile...\n"); + CLI::logging(" Copying Enterprise.php file to $pathNewFile...\n"); if ($shared_stat !== false) { workspaceTools::dirPerms($pathFileEnterprise, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']); } else { - CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n"); + CLI::logging(CLI::error("Could not get shared folder permissions, workspace permissions couldn't be changed") . "\n"); } CLI::logging(" Removing $pathFileEnterprise...\n"); copy($pathFileEnterprise , $pathNewFile. PATH_SEP . 'enterprise.php'); From 4dbcf0fe0e2ec18350047594c9d6b4687ffac582 Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Mon, 29 Sep 2014 13:47:48 -0400 Subject: [PATCH 5/5] BUG 378 "Upgrading plugins error. The version..." SOLVED - Upgrading plugins error. The version never changes. The code is already updated. - Problema resuelto, en la actualizacion de un plugins, en el listado que se mustra en la columna Version, se mostrara la version del plugins actualizado. Disponible para la version 2.8 de ProcessMaker. --- .../engine/classes/model/AddonsManager.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/workflow/engine/classes/model/AddonsManager.php b/workflow/engine/classes/model/AddonsManager.php index fa3f9f69e..dd815066b 100644 --- a/workflow/engine/classes/model/AddonsManager.php +++ b/workflow/engine/classes/model/AddonsManager.php @@ -27,7 +27,7 @@ class AddonsManager extends BaseAddonsManager */ public function getDownloadFilename() - { + { $filename = $this->getAddonDownloadFilename(); if (!isset($filename) || empty($filename)) { $filename = "download.tar"; @@ -37,7 +37,7 @@ class AddonsManager extends BaseAddonsManager } public function getDownloadDirectory() - { + { $dir = PATH_DATA . "upgrade/{$this->getStoreId()}_{$this->getAddonName()}"; if (!file_exists($dir)) { mkdir($dir, 0777, true); @@ -52,7 +52,7 @@ class AddonsManager extends BaseAddonsManager * if file exists but md5 for the download is not available. */ public function checkDownload() - { + { $filename = $this->getDownloadFilename(); if (!file_exists($filename)) { return false; @@ -70,7 +70,7 @@ class AddonsManager extends BaseAddonsManager * @return bool true if is of type 'plugin', false otherwise */ public function isPlugin() - { + { return ($this->getAddonType() == 'plugin'); } @@ -166,17 +166,17 @@ class AddonsManager extends BaseAddonsManager return (null); } - /////// + $oPluginRegistry = &PMPluginRegistry::getSingleton(); + $details = $oPluginRegistry->getPluginDetails($this->getAddonName() . ".php"); + $v = (!($details == null))? $details->iVersion : null; + + if ($v != "") { + return ($v); + } + if (file_exists(PATH_PLUGINS . $this->getAddonName() . PATH_SEP . "VERSION")) { return (trim(file_get_contents(PATH_PLUGINS . $this->getAddonName() . PATH_SEP . "VERSION"))); } - - /////// - $oPluginRegistry = &PMPluginRegistry::getSingleton(); - $details = $oPluginRegistry->getPluginDetails($this->getAddonName() . ".php"); - - $v = (!($details == null))? $details->iVersion : null; - return ($v); } else { if ($this->getAddonType() == "core") { throw new Exception("Addon type \"" . $this->getAddonType() . "\" unsupported");