Merged in bugfix/HOR-3784 (pull request #6090)

HOR-3784

Approved-by: Roly <gproly@gmail.com>
Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Paula Quispe
2017-10-23 18:58:45 +00:00
committed by Julio Cesar Laura Avendaño
3 changed files with 247 additions and 89 deletions

View File

@@ -315,6 +315,17 @@ CLI::taskOpt("lang", "", "lLANG", "lang=LANG");
CLI::taskArg('workspace');
CLI::taskRun("cliListIds");
/**
* Upgrade the CONTENT table
*/
CLI::taskName('upgrade-content');
CLI::taskDescription(<<<EOT
Upgrade the content table
EOT
);
CLI::taskArg('workspace');
CLI::taskRun("run_upgrade_content");
/**
*
*/
@@ -376,6 +387,56 @@ function run_workspace_upgrade($args, $opts)
}
}
/**
* We will upgrade the CONTENT table
* If we apply the command for all workspaces, we will need to execute one by one by redefining the constants
* @param string $args, workspaceName that we need to apply the upgrade-content
* @param string $opts
*
* @return void
*/
function run_upgrade_content($args, $opts)
{
//Check if the command is executed by a specific workspace
if (count($args) === 1) {
upgradeContent($args, $opts);
} else {
$workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) {
passthru('./processmaker upgrade-content ' . $workspace->name);
}
}
}
/**
* This function will upgrade the CONTENT table for a workspace
* This function is executed only for one workspace
* @param array $args, workspaceName that we will to apply the command
* @param array $opts, we can send additional parameters
*
* @return void
*/
function upgradeContent($args, $opts)
{
try {
//Load the attributes for the workspace
$arrayWorkspace = get_workspaces_from_args($args);
//Loop, read all the attributes related to the one workspace
$wsName = $arrayWorkspace[key($arrayWorkspace)]->name;
Bootstrap::setConstantsRelatedWs($wsName);
$workspaces = get_workspaces_from_args($args);
foreach ($workspaces as $workspace) {
try {
G::outRes("Upgrading content for " . pakeColor::colorize($workspace->name, "INFO") . "\n");
$workspace->upgradeContent($workspace->name, true);
} catch (Exception $e) {
G::outRes("Errors upgrading content of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n");
}
}
} catch (Exception $e) {
G::outRes(CLI::error($e->getMessage()) . "\n");
}
}
/**
* We will repair the translation in the languages defined in the workspace
* Verify if we need to execute an external program for each workspace

File diff suppressed because it is too large Load Diff

View File

@@ -61566,7 +61566,8 @@ INSERT INTO CONFIGURATION (CFG_UID,OBJ_UID,CFG_VALUE,PRO_UID,USR_UID,APP_UID) VA
('MIGRATED_LIST','list','true','list','list','list'),
('MIGRATED_LIST_UNASSIGNED','list','true','list','list','list'),
('SKIN_CRON','','s:10:"neoclassic";','','',''),
('AUDIT_LOG','log','s:5:"false";','','','');
('AUDIT_LOG','log','s:5:"false";','','',''),
('MIGRATED_CONTENT', 'content', 'a:12:{i:0;s:7:"Groupwf";i:1;s:7:"Process";i:2;s:10:"Department";i:3;s:4:"Task";i:4;s:13:"InputDocument";i:5;s:11:"Application";i:6;s:11:"AppDocument";i:7;s:8:"Dynaform";i:8;s:14:"OutputDocument";i:9;s:11:"ReportTable";i:10;s:8:"Triggers";i:11;s:41:"\\ProcessMaker\\BusinessModel\\WebEntryEvent";}', '', '', '');
INSERT INTO CATALOG (CAT_UID, CAT_LABEL_ID, CAT_TYPE, CAT_FLAG, CAT_OBSERVATION, CAT_CREATE_DATE, CAT_UPDATE_DATE) VALUES
('10','ID_BARS','GRAPHIC','','','2015-03-04','2015-03-04'),