@@ -229,6 +229,18 @@ EOT
|
||||
CLI::taskArg('workspace', true, true);
|
||||
CLI::taskRun("run_migrate_counters");
|
||||
|
||||
CLI::taskName('migrate-itee-to-dummytask');
|
||||
CLI::taskDescription(<<<EOT
|
||||
Migrate the Intermediate throw Email Event to Dummy task
|
||||
|
||||
Specify the workspaces, the processes in this workspace will be updated.
|
||||
|
||||
If no workspace is specified, the command will be run in all workspaces.
|
||||
EOT
|
||||
);
|
||||
CLI::taskArg('workspace', true, true);
|
||||
CLI::taskRun("run_migrate_itee_to_dummytask");
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
CLI::taskName("check-workspace-disabled-code");
|
||||
CLI::taskDescription(<<<EOT
|
||||
@@ -739,6 +751,22 @@ function verifyMigratedDataConsistency($args)
|
||||
return $inconsistentRecords;
|
||||
}
|
||||
|
||||
function run_migrate_itee_to_dummytask($args, $opts){
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
$opts = $filter->xssFilterHard($opts);
|
||||
$args = $filter->xssFilterHard($args);
|
||||
$arrayWorkspace = get_workspaces_from_args($args);
|
||||
foreach ($arrayWorkspace as $workspace) {
|
||||
try {
|
||||
$ws = new workspaceTools($workspace->name);
|
||||
$res = $ws->migrateIteeToDummytask($workspace->name);
|
||||
} catch (Exception $e) {
|
||||
echo "> Error: ".CLI::error($e->getMessage()) . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
function run_check_workspace_disabled_code($args, $opts)
|
||||
{
|
||||
|
||||
@@ -739,6 +739,7 @@ class workspaceTools
|
||||
$this->upgradeData();
|
||||
$this->checkRbacPermissions();//check or add new permissions
|
||||
$this->checkSequenceNumber();
|
||||
$this->migrateIteeToDummytask($this->name);
|
||||
|
||||
//There records in table "EMAIL_SERVER"
|
||||
$criteria = new Criteria("workflow");
|
||||
@@ -3197,6 +3198,7 @@ class workspaceTools
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
public function migrateContent($workspace, $lang = SYS_LANG) {
|
||||
if ((!class_exists('Memcache') || !class_exists('Memcached')) && !defined('MEMCACHED_ENABLED')) {
|
||||
define('MEMCACHED_ENABLED', false);
|
||||
@@ -3300,4 +3302,51 @@ class workspaceTools
|
||||
$this->migrateContentWorkspace($className, $fields, $lang);
|
||||
}
|
||||
}
|
||||
|
||||
public function migrateIteeToDummytask($workspaceName){
|
||||
$this->initPropel(true);
|
||||
if (!defined("SYS_SYS")) {
|
||||
define("SYS_SYS", $workspaceName);
|
||||
}
|
||||
if (!defined("PATH_DATA_SITE")) {
|
||||
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP);
|
||||
}
|
||||
if (!defined("PATH_DOCUMENT")) {
|
||||
define("PATH_DOCUMENT", PATH_DATA . 'sites' . DIRECTORY_SEPARATOR . $workspaceName . DIRECTORY_SEPARATOR . 'files');
|
||||
}
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspaceName);
|
||||
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
|
||||
|
||||
//Search All process
|
||||
$oCriteria = new Criteria("workflow");
|
||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
|
||||
$oCriteria->addSelectColumn( ProcessPeer::PRO_ITEE );
|
||||
$oCriteria->add(ProcessPeer::PRO_ITEE, '0', Criteria::EQUAL);
|
||||
$rsCriteria = ProcessPeer::doSelectRS($oCriteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$message = "-> Migrating the Intermediate Email Event \n";
|
||||
CLI::logging($message);
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
$prj_uid = $row['PRO_UID'];
|
||||
$bpmnProcess = new Process();
|
||||
if($bpmnProcess->isBpmnProcess($prj_uid)){
|
||||
$project = new \ProcessMaker\Project\Adapter\BpmnWorkflow();
|
||||
$diagram = $project->getStruct($prj_uid);
|
||||
$res = $project->updateFromStruct($prj_uid, $diagram);
|
||||
$bpmnProcess->setProUid($prj_uid);
|
||||
$oProcess = new Process();
|
||||
$aProcess['PRO_UID'] = $prj_uid;
|
||||
$aProcess['PRO_ITEE'] = '1';
|
||||
if ($oProcess->processExists($prj_uid)) {
|
||||
$oProcess->update($aProcess);
|
||||
}
|
||||
$message = " Process updated ".$bpmnProcess->getProTitle(). "\n";
|
||||
CLI::logging($message);
|
||||
}
|
||||
}
|
||||
$message = " Migrating Itee Done \n";
|
||||
CLI::logging($message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user