diff --git a/workflow/engine/bin/tasks/cliUpgrade.php b/workflow/engine/bin/tasks/cliUpgrade.php index c1762bbbf..10ef35328 100644 --- a/workflow/engine/bin/tasks/cliUpgrade.php +++ b/workflow/engine/bin/tasks/cliUpgrade.php @@ -8,7 +8,9 @@ CLI::taskDescription("Upgrade workspaces.\n\n This command should be run after u CLI::taskOpt('buildACV', 'If this option is enabled, the Cache View is built.', 'ACV', 'buildACV'); CLI::taskOpt('noxml', 'If this option is enabled, the XML files translation is not built.', 'NoXml', 'no-xml'); +/*----------------------------------********---------------------------------*/ CLI::taskOpt('include_dyn_content', "Include the DYN_CONTENT_HISTORY value. Ex: --include_dyn_content", 'i', 'include_dyn_content'); +/*----------------------------------********---------------------------------*/ CLI::taskRun("run_upgrade"); /*----------------------------------********---------------------------------*/ CLI::taskName('unify-database'); @@ -109,7 +111,9 @@ function run_upgrade($command, $args) $buildCacheView = array_key_exists('buildACV', $args); $flagUpdateXml = !array_key_exists('noxml', $args); $optionMigrateHistoryData = [ + /*----------------------------------********---------------------------------*/ 'includeDynContent' => array_key_exists('include_dyn_content', $args) + /*----------------------------------********---------------------------------*/ ]; foreach ($workspaces as $index => $workspace) { diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index b91fcece2..4c60f9918 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -50,7 +50,9 @@ CLI::taskOpt("workspace", "Specify which workspace to restore if multiple worksp Ex: -wworkflow.", "w:", "workspace="); CLI::taskOpt("lang", "Specify the language which will be used to rebuild the case cache list. If this option isn't included, then 'en' (English) will be used by default.", "l:", "lang="); CLI::taskOpt("port", "Specify the port number used by MySQL. If not specified, then the port 3306 will be used by default.", "p:"); +/*----------------------------------********---------------------------------*/ CLI::taskOpt('include_dyn_content', "Include the DYN_CONTENT_HISTORY value. Ex: --include_dyn_content", 'd', 'include_dyn_content'); +/*----------------------------------********---------------------------------*/ CLI::taskRun("run_workspace_restore"); CLI::taskName('cacheview-repair'); @@ -343,6 +345,7 @@ EOT CLI::taskArg('workspace'); CLI::taskRun("regenerate_pmtable_classes"); +/*----------------------------------********---------------------------------*/ /** * Migrate the data from APP_HISTORY table to the new table APP_DATA_CHANGE_LOG. */ @@ -354,6 +357,7 @@ EOT CLI::taskArg('workspace'); CLI::taskRun('migrate_history_data'); CLI::taskOpt('include_dyn_content', "Include the DYN_CONTENT_HISTORY value. Ex: --include_dyn_content", 'i', 'include_dyn_content'); +/*----------------------------------********---------------------------------*/ /** * Function run_info @@ -854,7 +858,9 @@ function run_workspace_restore($args, $opts) $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; $port = array_key_exists("port", $opts) ? $opts['port'] : ''; $optionMigrateHistoryData = [ + /*----------------------------------********---------------------------------*/ 'includeDynContent' => array_key_exists('include_dyn_content', $args) + /*----------------------------------********---------------------------------*/ ]; if ($info) { WorkspaceTools::getBackupInfo($filename); @@ -1285,6 +1291,7 @@ function regenerate_pmtable_classes($args, $opts) } } +/*----------------------------------********---------------------------------*/ /** * This method migrates data from APP_HISTORY table to APP_DATA_CHANGE_LOG table. * @@ -1324,3 +1331,4 @@ function migrate_history_data($args, $opts) } } } +/*----------------------------------********---------------------------------*/ diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index a132834d5..bd1645d79 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -2,7 +2,9 @@ use ProcessMaker\BusinessModel\User as BusinessModelUser; use ProcessMaker\BusinessModel\WebEntryEvent; +/*----------------------------------********---------------------------------*/ use ProcessMaker\ChangeLog\ChangeLog; +/*----------------------------------********---------------------------------*/ use ProcessMaker\Core\System; use ProcessMaker\Plugins\PluginRegistry; @@ -900,7 +902,7 @@ class Cases $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference); $appHistory->insertHistory($aFieldsHistory); - + /*----------------------------------********---------------------------------*/ $type = isset($Fields['OBJECT_TYPE']) ? $Fields['OBJECT_TYPE'] : ChangeLog::getChangeLog()->getObjectNameById(ChangeLog::DYNAFORM); ChangeLog::getChangeLog() @@ -912,6 +914,7 @@ class Cases ->getTasIdByTasUid($Fields['TAS_UID']) ->getObjectIdByUidAndObjType($Fields['CURRENT_DYNAFORM'], $type) ->register(); + /*----------------------------------********---------------------------------*/ } } //End Save History @@ -3431,9 +3434,11 @@ class Cases */ public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array()) { + /*----------------------------------********---------------------------------*/ ChangeLog::getChangeLog() ->setObjectUid($sStepUidObj) ->getExecutedAtIdByTriggerType($sTriggerType); + /*----------------------------------********---------------------------------*/ $aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType); diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 8a56249d6..81c727c48 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -2,7 +2,9 @@ use Illuminate\Database\QueryException; use Illuminate\Support\Facades\DB; +/*----------------------------------********---------------------------------*/ use ProcessMaker\ChangeLog\ChangeLog; +/*----------------------------------********---------------------------------*/ use ProcessMaker\Core\Installer; use ProcessMaker\Core\System; use ProcessMaker\Plugins\Adapters\PluginAdapter; @@ -341,12 +343,14 @@ class WorkspaceTools $stop = microtime(true); CLI::logging("<*> Migrating and populating plugin singleton data took " . ($stop - $start) . " seconds.\n"); + /*----------------------------------********---------------------------------*/ $includeDynContent = isset($optionMigrateHistoryData['includeDynContent']) && $optionMigrateHistoryData['includeDynContent'] === true; $start = microtime(true); CLI::logging("> Migrating history data...\n"); $this->migrateAppHistoryToAppDataChangeLog(false, !$includeDynContent); $stop = microtime(true); CLI::logging("<*> Migrating history data took " . ($stop - $start) . " seconds.\n"); + /*----------------------------------********---------------------------------*/ } /** @@ -2062,12 +2066,14 @@ class WorkspaceTools //Updating generated class files for PM Tables passthru(PHP_BINARY . ' processmaker regenerate-pmtable-classes ' . $workspace->name); + /*----------------------------------********---------------------------------*/ $includeDynContent = isset($optionMigrateHistoryData['includeDynContent']) && $optionMigrateHistoryData['includeDynContent'] === true; $start = microtime(true); CLI::logging("> Migrating history data...\n"); $workspace->migrateAppHistoryToAppDataChangeLog(false, !$includeDynContent); $stop = microtime(true); CLI::logging("<*> Migrating history data took " . ($stop - $start) . " seconds.\n"); + /*----------------------------------********---------------------------------*/ } CLI::logging("Removing temporary files\n"); @@ -4230,7 +4236,8 @@ class WorkspaceTools $this->setLastContentMigrateTable(true); } } - + + /*----------------------------------********---------------------------------*/ /** * Migrate the contents of table APP_HISTORY to table APP_DATA_CHANGE_LOG. * @@ -4389,4 +4396,5 @@ class WorkspaceTools $conf->aConfig = ['updated' => true]; $conf->saveConfig('MIGRATED_APP_HISTORY', 'history'); } + /*----------------------------------********---------------------------------*/ } diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php index 1fa01e505..ad0be6952 100644 --- a/workflow/engine/classes/WsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -1,7 +1,9 @@ setDate('now') ->setAppNumber($appData['APP_NUMBER']) @@ -2266,6 +2269,7 @@ class WsBase ->setData(serialize($appData)) ->getExecutedAtIdByTriggerType($triggerType) ->getObjectIdByUidAndObjType($stepUidObj, $stepType); + /*----------------------------------********---------------------------------*/ return $varTriggers; } diff --git a/workflow/engine/methods/cases/ajaxListener.php b/workflow/engine/methods/cases/ajaxListener.php index e43c6b05f..fdebc716e 100644 --- a/workflow/engine/methods/cases/ajaxListener.php +++ b/workflow/engine/methods/cases/ajaxListener.php @@ -1,7 +1,10 @@ setAppUid($appUid) - ->setUserLogged($_SESSION['USER_LOGGED']) - ->setProUid($proUid) - ->setTasUid($tasUid) - ->getLogs(); - echo json_encode($result); + /*----------------------------------********---------------------------------*/ + if (true) { + //In enterprise version this snippet of code should be always be executed + //In community version this snippet of code is deleted and is executed the next snippet of code + $changeLog = new ChangeLogResult(); + $result = $changeLog->setAppUid($appUid) + ->setUserLogged($_SESSION['USER_LOGGED']) + ->setProUid($proUid) + ->setTasUid($tasUid) + ->getLogs(); + echo G::json_encode($result); + } else { + /*----------------------------------********---------------------------------*/ + $start = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0; + $limit = isset($_REQUEST['limit']) ? (int) $_REQUEST['limit'] : 15; + $changeLog = new ChangeLog(); + echo G::json_encode($changeLog->getChangeLog($appUid, $proUid, $tasUid, $start, $limit)); + /*----------------------------------********---------------------------------*/ + } + /*----------------------------------********---------------------------------*/ } public function changeLogTab() diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index ed86a0b66..eaeba18ec 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -25,7 +25,9 @@ use ProcessMaker\BusinessModel\Cases as BusinessModelCases; use ProcessMaker\BusinessModel\Lists; use ProcessMaker\BusinessModel\Task as BusinessModelTask; use ProcessMaker\BusinessModel\User as BusinessModelUser; +/*----------------------------------********---------------------------------*/ use ProcessMaker\ChangeLog\ChangeLog; +/*----------------------------------********---------------------------------*/ use ProcessMaker\Core\RoutingScreen; use ProcessMaker\Core\System; use ProcessMaker\Services\Api\Project\Activity\Step as ActivityStep; @@ -601,8 +603,10 @@ class Light $tasks ); + /*----------------------------------********---------------------------------*/ ChangeLog::getChangeLog() ->register(); + /*----------------------------------********---------------------------------*/ $array = json_decode(json_encode($fields), true); $array['message'] = trim(strip_tags($array['message'])); diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php index da7712590..28fbc6a64 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php @@ -3,7 +3,9 @@ namespace ProcessMaker\Services\OAuth2; use Luracast\Restler\iAuthenticate; use Luracast\Restler\RestException; +/*----------------------------------********---------------------------------*/ use ProcessMaker\ChangeLog\ChangeLog; +/*----------------------------------********---------------------------------*/ use ProcessMaker\Core\System; class Server implements iAuthenticate @@ -373,7 +375,8 @@ class Server implements iAuthenticate $_SESSION['USR_TIME_ZONE'] = $userTimeZone; } - + + /*----------------------------------********---------------------------------*/ ChangeLog::getChangeLog() ->setUsrId(is_null($user) ? 0 : $user->getUsrId()) ->setSkin(SYS_SKIN) @@ -386,6 +389,7 @@ class Server implements iAuthenticate ChangeLog::getChangeLog() ->setSourceId(ChangeLog::FromWeb); } + /*----------------------------------********---------------------------------*/ return $allowed; } diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 40ad96e81..3af122478 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -1,29 +1,9 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ use Illuminate\Foundation\Http\Kernel; +/*----------------------------------********---------------------------------*/ use ProcessMaker\ChangeLog\ChangeLog; +/*----------------------------------********---------------------------------*/ use ProcessMaker\Plugins\PluginRegistry; /** @@ -1102,11 +1082,13 @@ if (!defined('EXECUTE_BY_CRON')) { } else { //NewRelic Snippet - By JHL transactionLog($phpFile); + /*----------------------------------********---------------------------------*/ ChangeLog::getChangeLog() ->setSourceId(ChangeLog::FromWeb) ->setSkin(SYS_SKIN) ->setLanguage(SYS_LANG) ->getUsrIdByUsrUid(empty($_SESSION['USER_LOGGED']) ? '' : $_SESSION['USER_LOGGED']); + /*----------------------------------********---------------------------------*/ require_once $phpFile; }