This commit is contained in:
Roly Rudy Gutierrez Pinto
2018-06-11 09:58:48 -04:00
parent 7052cae048
commit ea9c35c3d6
9 changed files with 67 additions and 32 deletions

View File

@@ -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('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('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::taskOpt('include_dyn_content', "Include the DYN_CONTENT_HISTORY value. Ex: --include_dyn_content", 'i', 'include_dyn_content');
/*----------------------------------********---------------------------------*/
CLI::taskRun("run_upgrade"); CLI::taskRun("run_upgrade");
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
CLI::taskName('unify-database'); CLI::taskName('unify-database');
@@ -109,7 +111,9 @@ function run_upgrade($command, $args)
$buildCacheView = array_key_exists('buildACV', $args); $buildCacheView = array_key_exists('buildACV', $args);
$flagUpdateXml = !array_key_exists('noxml', $args); $flagUpdateXml = !array_key_exists('noxml', $args);
$optionMigrateHistoryData = [ $optionMigrateHistoryData = [
/*----------------------------------********---------------------------------*/
'includeDynContent' => array_key_exists('include_dyn_content', $args) 'includeDynContent' => array_key_exists('include_dyn_content', $args)
/*----------------------------------********---------------------------------*/
]; ];
foreach ($workspaces as $index => $workspace) { foreach ($workspaces as $index => $workspace) {

View File

@@ -50,7 +50,9 @@ CLI::taskOpt("workspace", "Specify which workspace to restore if multiple worksp
Ex: -wworkflow.", "w:", "workspace="); 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("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("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::taskOpt('include_dyn_content', "Include the DYN_CONTENT_HISTORY value. Ex: --include_dyn_content", 'd', 'include_dyn_content');
/*----------------------------------********---------------------------------*/
CLI::taskRun("run_workspace_restore"); CLI::taskRun("run_workspace_restore");
CLI::taskName('cacheview-repair'); CLI::taskName('cacheview-repair');
@@ -343,6 +345,7 @@ EOT
CLI::taskArg('workspace'); CLI::taskArg('workspace');
CLI::taskRun("regenerate_pmtable_classes"); CLI::taskRun("regenerate_pmtable_classes");
/*----------------------------------********---------------------------------*/
/** /**
* Migrate the data from APP_HISTORY table to the new table APP_DATA_CHANGE_LOG. * Migrate the data from APP_HISTORY table to the new table APP_DATA_CHANGE_LOG.
*/ */
@@ -354,6 +357,7 @@ EOT
CLI::taskArg('workspace'); CLI::taskArg('workspace');
CLI::taskRun('migrate_history_data'); CLI::taskRun('migrate_history_data');
CLI::taskOpt('include_dyn_content', "Include the DYN_CONTENT_HISTORY value. Ex: --include_dyn_content", 'i', 'include_dyn_content'); CLI::taskOpt('include_dyn_content', "Include the DYN_CONTENT_HISTORY value. Ex: --include_dyn_content", 'i', 'include_dyn_content');
/*----------------------------------********---------------------------------*/
/** /**
* Function run_info * Function run_info
@@ -854,7 +858,9 @@ function run_workspace_restore($args, $opts)
$lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en';
$port = array_key_exists("port", $opts) ? $opts['port'] : ''; $port = array_key_exists("port", $opts) ? $opts['port'] : '';
$optionMigrateHistoryData = [ $optionMigrateHistoryData = [
/*----------------------------------********---------------------------------*/
'includeDynContent' => array_key_exists('include_dyn_content', $args) 'includeDynContent' => array_key_exists('include_dyn_content', $args)
/*----------------------------------********---------------------------------*/
]; ];
if ($info) { if ($info) {
WorkspaceTools::getBackupInfo($filename); 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. * This method migrates data from APP_HISTORY table to APP_DATA_CHANGE_LOG table.
* *
@@ -1324,3 +1331,4 @@ function migrate_history_data($args, $opts)
} }
} }
} }
/*----------------------------------********---------------------------------*/

View File

@@ -2,7 +2,9 @@
use ProcessMaker\BusinessModel\User as BusinessModelUser; use ProcessMaker\BusinessModel\User as BusinessModelUser;
use ProcessMaker\BusinessModel\WebEntryEvent; use ProcessMaker\BusinessModel\WebEntryEvent;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
@@ -900,7 +902,7 @@ class Cases
$aFieldsHistory['APP_DATA'] = serialize($FieldsDifference); $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference);
$appHistory->insertHistory($aFieldsHistory); $appHistory->insertHistory($aFieldsHistory);
/*----------------------------------********---------------------------------*/
$type = isset($Fields['OBJECT_TYPE']) ? $type = isset($Fields['OBJECT_TYPE']) ?
$Fields['OBJECT_TYPE'] : ChangeLog::getChangeLog()->getObjectNameById(ChangeLog::DYNAFORM); $Fields['OBJECT_TYPE'] : ChangeLog::getChangeLog()->getObjectNameById(ChangeLog::DYNAFORM);
ChangeLog::getChangeLog() ChangeLog::getChangeLog()
@@ -912,6 +914,7 @@ class Cases
->getTasIdByTasUid($Fields['TAS_UID']) ->getTasIdByTasUid($Fields['TAS_UID'])
->getObjectIdByUidAndObjType($Fields['CURRENT_DYNAFORM'], $type) ->getObjectIdByUidAndObjType($Fields['CURRENT_DYNAFORM'], $type)
->register(); ->register();
/*----------------------------------********---------------------------------*/
} }
} }
//End Save History //End Save History
@@ -3431,9 +3434,11 @@ class Cases
*/ */
public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array()) public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array())
{ {
/*----------------------------------********---------------------------------*/
ChangeLog::getChangeLog() ChangeLog::getChangeLog()
->setObjectUid($sStepUidObj) ->setObjectUid($sStepUidObj)
->getExecutedAtIdByTriggerType($sTriggerType); ->getExecutedAtIdByTriggerType($sTriggerType);
/*----------------------------------********---------------------------------*/
$aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType); $aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType);

View File

@@ -2,7 +2,9 @@
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Core\Installer; use ProcessMaker\Core\Installer;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Plugins\Adapters\PluginAdapter; use ProcessMaker\Plugins\Adapters\PluginAdapter;
@@ -341,12 +343,14 @@ class WorkspaceTools
$stop = microtime(true); $stop = microtime(true);
CLI::logging("<*> Migrating and populating plugin singleton data took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Migrating and populating plugin singleton data took " . ($stop - $start) . " seconds.\n");
/*----------------------------------********---------------------------------*/
$includeDynContent = isset($optionMigrateHistoryData['includeDynContent']) && $optionMigrateHistoryData['includeDynContent'] === true; $includeDynContent = isset($optionMigrateHistoryData['includeDynContent']) && $optionMigrateHistoryData['includeDynContent'] === true;
$start = microtime(true); $start = microtime(true);
CLI::logging("> Migrating history data...\n"); CLI::logging("> Migrating history data...\n");
$this->migrateAppHistoryToAppDataChangeLog(false, !$includeDynContent); $this->migrateAppHistoryToAppDataChangeLog(false, !$includeDynContent);
$stop = microtime(true); $stop = microtime(true);
CLI::logging("<*> Migrating history data took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Migrating history data took " . ($stop - $start) . " seconds.\n");
/*----------------------------------********---------------------------------*/
} }
/** /**
@@ -2062,12 +2066,14 @@ class WorkspaceTools
//Updating generated class files for PM Tables //Updating generated class files for PM Tables
passthru(PHP_BINARY . ' processmaker regenerate-pmtable-classes ' . $workspace->name); passthru(PHP_BINARY . ' processmaker regenerate-pmtable-classes ' . $workspace->name);
/*----------------------------------********---------------------------------*/
$includeDynContent = isset($optionMigrateHistoryData['includeDynContent']) && $optionMigrateHistoryData['includeDynContent'] === true; $includeDynContent = isset($optionMigrateHistoryData['includeDynContent']) && $optionMigrateHistoryData['includeDynContent'] === true;
$start = microtime(true); $start = microtime(true);
CLI::logging("> Migrating history data...\n"); CLI::logging("> Migrating history data...\n");
$workspace->migrateAppHistoryToAppDataChangeLog(false, !$includeDynContent); $workspace->migrateAppHistoryToAppDataChangeLog(false, !$includeDynContent);
$stop = microtime(true); $stop = microtime(true);
CLI::logging("<*> Migrating history data took " . ($stop - $start) . " seconds.\n"); CLI::logging("<*> Migrating history data took " . ($stop - $start) . " seconds.\n");
/*----------------------------------********---------------------------------*/
} }
CLI::logging("Removing temporary files\n"); CLI::logging("Removing temporary files\n");
@@ -4231,6 +4237,7 @@ class WorkspaceTools
} }
} }
/*----------------------------------********---------------------------------*/
/** /**
* Migrate the contents of table APP_HISTORY to table APP_DATA_CHANGE_LOG. * Migrate the contents of table APP_HISTORY to table APP_DATA_CHANGE_LOG.
* *
@@ -4389,4 +4396,5 @@ class WorkspaceTools
$conf->aConfig = ['updated' => true]; $conf->aConfig = ['updated' => true];
$conf->saveConfig('MIGRATED_APP_HISTORY', 'history'); $conf->saveConfig('MIGRATED_APP_HISTORY', 'history');
} }
/*----------------------------------********---------------------------------*/
} }

View File

@@ -1,7 +1,9 @@
<?php <?php
use ProcessMaker\BusinessModel\EmailServer; use ProcessMaker\BusinessModel\EmailServer;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
class WsBase class WsBase
@@ -2257,6 +2259,7 @@ class WsBase
} }
} }
/*----------------------------------********---------------------------------*/
ChangeLog::getChangeLog() ChangeLog::getChangeLog()
->setDate('now') ->setDate('now')
->setAppNumber($appData['APP_NUMBER']) ->setAppNumber($appData['APP_NUMBER'])
@@ -2266,6 +2269,7 @@ class WsBase
->setData(serialize($appData)) ->setData(serialize($appData))
->getExecutedAtIdByTriggerType($triggerType) ->getExecutedAtIdByTriggerType($triggerType)
->getObjectIdByUidAndObjType($stepUidObj, $stepType); ->getObjectIdByUidAndObjType($stepUidObj, $stepType);
/*----------------------------------********---------------------------------*/
return $varTriggers; return $varTriggers;
} }

View File

@@ -1,7 +1,10 @@
<?php <?php
use ProcessMaker\BusinessModel\Cases as BmCases; use ProcessMaker\BusinessModel\Cases as BmCases;
use ProcessMaker\BusinessModel\Cases\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLogResult; use ProcessMaker\ChangeLog\ChangeLogResult;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
if (!isset($_SESSION['USER_LOGGED'])) { if (!isset($_SESSION['USER_LOGGED'])) {
@@ -780,13 +783,26 @@ class Ajax
$appUid = $idHistoryArray[1]; $appUid = $idHistoryArray[1];
$tasUid = $idHistoryArray[2]; $tasUid = $idHistoryArray[2];
$changeLog = new ChangeLogResult(); /*----------------------------------********---------------------------------*/
$result = $changeLog->setAppUid($appUid) if (true) {
->setUserLogged($_SESSION['USER_LOGGED']) //In enterprise version this snippet of code should be always be executed
->setProUid($proUid) //In community version this snippet of code is deleted and is executed the next snippet of code
->setTasUid($tasUid) $changeLog = new ChangeLogResult();
->getLogs(); $result = $changeLog->setAppUid($appUid)
echo json_encode($result); ->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() public function changeLogTab()

View File

@@ -25,7 +25,9 @@ use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
use ProcessMaker\BusinessModel\Lists; use ProcessMaker\BusinessModel\Lists;
use ProcessMaker\BusinessModel\Task as BusinessModelTask; use ProcessMaker\BusinessModel\Task as BusinessModelTask;
use ProcessMaker\BusinessModel\User as BusinessModelUser; use ProcessMaker\BusinessModel\User as BusinessModelUser;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Core\RoutingScreen; use ProcessMaker\Core\RoutingScreen;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Services\Api\Project\Activity\Step as ActivityStep; use ProcessMaker\Services\Api\Project\Activity\Step as ActivityStep;
@@ -601,8 +603,10 @@ class Light
$tasks $tasks
); );
/*----------------------------------********---------------------------------*/
ChangeLog::getChangeLog() ChangeLog::getChangeLog()
->register(); ->register();
/*----------------------------------********---------------------------------*/
$array = json_decode(json_encode($fields), true); $array = json_decode(json_encode($fields), true);
$array['message'] = trim(strip_tags($array['message'])); $array['message'] = trim(strip_tags($array['message']));

View File

@@ -3,7 +3,9 @@ namespace ProcessMaker\Services\OAuth2;
use Luracast\Restler\iAuthenticate; use Luracast\Restler\iAuthenticate;
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
class Server implements iAuthenticate class Server implements iAuthenticate
@@ -374,6 +376,7 @@ class Server implements iAuthenticate
$_SESSION['USR_TIME_ZONE'] = $userTimeZone; $_SESSION['USR_TIME_ZONE'] = $userTimeZone;
} }
/*----------------------------------********---------------------------------*/
ChangeLog::getChangeLog() ChangeLog::getChangeLog()
->setUsrId(is_null($user) ? 0 : $user->getUsrId()) ->setUsrId(is_null($user) ? 0 : $user->getUsrId())
->setSkin(SYS_SKIN) ->setSkin(SYS_SKIN)
@@ -386,6 +389,7 @@ class Server implements iAuthenticate
ChangeLog::getChangeLog() ChangeLog::getChangeLog()
->setSourceId(ChangeLog::FromWeb); ->setSourceId(ChangeLog::FromWeb);
} }
/*----------------------------------********---------------------------------*/
return $allowed; return $allowed;
} }

View File

@@ -1,29 +1,9 @@
<?php <?php
/**
* Bootstrap.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. BaseCaseTrackerObjectPeerSee the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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 Illuminate\Foundation\Http\Kernel;
/*----------------------------------********---------------------------------*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
/*----------------------------------********---------------------------------*/
use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Plugins\PluginRegistry;
/** /**
@@ -1102,11 +1082,13 @@ if (!defined('EXECUTE_BY_CRON')) {
} else { } else {
//NewRelic Snippet - By JHL //NewRelic Snippet - By JHL
transactionLog($phpFile); transactionLog($phpFile);
/*----------------------------------********---------------------------------*/
ChangeLog::getChangeLog() ChangeLog::getChangeLog()
->setSourceId(ChangeLog::FromWeb) ->setSourceId(ChangeLog::FromWeb)
->setSkin(SYS_SKIN) ->setSkin(SYS_SKIN)
->setLanguage(SYS_LANG) ->setLanguage(SYS_LANG)
->getUsrIdByUsrUid(empty($_SESSION['USER_LOGGED']) ? '' : $_SESSION['USER_LOGGED']); ->getUsrIdByUsrUid(empty($_SESSION['USER_LOGGED']) ? '' : $_SESSION['USER_LOGGED']);
/*----------------------------------********---------------------------------*/
require_once $phpFile; require_once $phpFile;
} }