Merged in bugfix/PMCORE-2286 (pull request #7549)
PMCORE-2286 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\BusinessModel\WebEntry;
|
||||
use ProcessMaker\Core\JobsManager;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Validation\MySQL57;
|
||||
@@ -428,6 +429,16 @@ EOT
|
||||
CLI::taskArg('fontFileName', false);
|
||||
CLI::taskRun('documents_remove_font');
|
||||
|
||||
/**
|
||||
* Convert Web Entries v1.0 to v2.0 for BPMN processes in order to deprecate the old version.
|
||||
*/
|
||||
CLI::taskName('convert-old-web-entries');
|
||||
CLI::taskDescription(<<<EOT
|
||||
Convert Web Entries v1.0 to v2.0 for BPMN processes in order to deprecate the old version.
|
||||
EOT
|
||||
);
|
||||
CLI::taskRun('convert_old_web_entries');
|
||||
|
||||
/**
|
||||
* Function run_info
|
||||
*
|
||||
@@ -1606,3 +1617,41 @@ function documents_remove_font($args)
|
||||
CLI::logging($e->getMessage() . PHP_EOL . PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Web Entries v1.0 to v2.0 for BPMN processes in order to deprecate the old version.
|
||||
*
|
||||
* @param array $args
|
||||
*/
|
||||
function convert_old_web_entries($args)
|
||||
{
|
||||
try {
|
||||
if (!empty($args)) {
|
||||
// Print initial message
|
||||
$start = microtime(true);
|
||||
CLI::logging("> Converting Web Entries v1.0 to v2.0 for BPMN processes...\n");
|
||||
|
||||
// Set workspace constants and initialize DB connection
|
||||
Bootstrap::setConstantsRelatedWs($args[0]);
|
||||
Propel::init(PATH_CONFIG . 'databases.php');
|
||||
|
||||
// Convert Web Entries
|
||||
WebEntry::convertFromV1ToV2();
|
||||
|
||||
// Print last message
|
||||
$stop = microtime(true);
|
||||
CLI::logging("<*> Converting Web Entries v1.0 to v2.0 for BPMN processes data took " . ($stop - $start) . " seconds.\n");
|
||||
} else {
|
||||
// If a workspace is not specified, get all available workspaces in the server
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
|
||||
// Execute the command for each workspace
|
||||
foreach ($workspaces as $workspace) {
|
||||
passthru(PHP_BINARY . ' processmaker convert-old-web-entries ' . $workspace->name);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Display the error message
|
||||
CLI::logging($e->getMessage() . PHP_EOL . PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use ProcessMaker\BusinessModel\Process as BmProcess;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\ChangeLog\ChangeLog;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\BusinessModel\WebEntry;
|
||||
use ProcessMaker\Core\Installer;
|
||||
use ProcessMaker\Core\ProcessesManager;
|
||||
use ProcessMaker\Core\System;
|
||||
@@ -364,6 +365,13 @@ class WorkspaceTools
|
||||
$start = microtime(true);
|
||||
$this->updateTriggers(true, $lang);
|
||||
CLI::logging("* End updating MySQL triggers...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
|
||||
CLI::logging("* Start Converting Web Entries v1.0 to v2.0 for BPMN processes...\n");
|
||||
$start = microtime(true);
|
||||
Bootstrap::setConstantsRelatedWs($workspace);
|
||||
Propel::init(PATH_CONFIG . 'databases.php');
|
||||
WebEntry::convertFromV1ToV2();
|
||||
CLI::logging("* End converting Web Entries v1.0 to v2.0 for BPMN processes...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2209,6 +2217,13 @@ class WorkspaceTools
|
||||
$start = microtime(true);
|
||||
$workspace->updateTriggers(true, $lang);
|
||||
CLI::logging("* End updating MySQL triggers...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
|
||||
CLI::logging("* Start Converting Web Entries v1.0 to v2.0 for BPMN processes...\n");
|
||||
$start = microtime(true);
|
||||
Bootstrap::setConstantsRelatedWs($workspace);
|
||||
Propel::init(PATH_CONFIG . 'databases.php');
|
||||
WebEntry::convertFromV1ToV2();
|
||||
CLI::logging("* End converting Web Entries v1.0 to v2.0 for BPMN processes...(" . (microtime(true) - $start) . " seconds)\n");
|
||||
}
|
||||
|
||||
CLI::logging("> Start To Verify License Enterprise...\n");
|
||||
|
||||
@@ -1168,5 +1168,26 @@ class WebEntry
|
||||
return $appNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Web Entries v1.0 to v2.0
|
||||
*/
|
||||
public static function convertFromV1ToV2()
|
||||
{
|
||||
// Build query
|
||||
$sql = "UPDATE
|
||||
`WEB_ENTRY`
|
||||
LEFT JOIN
|
||||
`BPMN_PROCESS`
|
||||
ON
|
||||
(`WEB_ENTRY`.`PRO_UID` = `BPMN_PROCESS`.`PRJ_UID`)
|
||||
SET
|
||||
`WEB_ENTRY`.`DYN_UID` = '', `WEB_ENTRY`.`WE_TYPE` = 'MULTIPLE'
|
||||
WHERE
|
||||
`WE_TYPE` = 'SINGLE' AND `WE_AUTHENTICATION` = 'ANONYMOUS' AND
|
||||
`WE_CALLBACK` = 'PROCESSMAKER' AND `BPMN_PROCESS`.`PRJ_UID` IS NOT NULL";
|
||||
|
||||
// Execute query
|
||||
DB::connection('workflow')->statement($sql);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user