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..cdc4aeb6a 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,60 @@ 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 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 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 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 to copy from $pathDirectoryEnterprise...\n")); + } + if (file_exists($pathDirectoryEnterprise)) { + CLI::logging(CLI::info(" Remove manually $pathDirectoryEnterprise...\n")); + } + } + if (file_exists($pathFileEnterprise)) { + 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 shared folder permissions, workspace permissions couldn't be changed") . "\n"); + } + CLI::logging(" Removing $pathFileEnterprise...\n"); + copy($pathFileEnterprise , $pathNewFile. PATH_SEP . 'enterprise.php'); + G::rm_dir($pathFileEnterprise); + 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]);