From fc92f308edfff2ebad286c8b63aa98d8d53753eb Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Thu, 18 Aug 2016 12:21:29 -0400 Subject: [PATCH] HOR-1624 database-upgrade . --- gulliver/system/class.g.php | 7 ++++--- workflow/engine/classes/class.configuration.php | 4 ++-- workflow/engine/classes/class.wsTools.php | 15 +++++++++++++++ workflow/engine/data/mysql/insert.sql | 3 ++- workflow/engine/menus/setup.php | 4 ++-- workflow/engine/methods/setup/auditLogConfig.php | 9 +++------ .../engine/methods/setup/auditLogConfigAjax.php | 13 ++++++------- 7 files changed, 34 insertions(+), 21 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 09c30a190..e7e16f6bb 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5433,12 +5433,13 @@ class G public static function auditLog($actionToLog, $valueToLog = "") { $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; - $oServerConf = & serverConf::getSingleton(); - $sflagAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', $workspace ); + $conf = new Configurations(); + $sflag = $conf->getConfiguration('AUDIT_LOG', 'log'); + $sflagAudit = $sflag == 'true' ? true : false; $ipClient = G::getIpAddress(); /*----------------------------------********---------------------------------*/ - $licensedFeatures = PMLicensedFeatures::getSingleton(); + $licensedFeatures = PMLicensedFeatures::getSingleton(); if ($sflagAudit && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { $username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User'; $fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-'; diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index 0bfae0d5e..67b721c7a 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -88,9 +88,9 @@ class Configurations // extends Configuration } } - public function exists($cfgID) + public function exists($cfgID,$objID='') { - return $this->Configuration->exists($cfgID,"",'','',''); + return $this->Configuration->exists($cfgID,$objID,'','',''); } /** diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 814cf8177..e487aa9c9 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -763,6 +763,9 @@ class workspaceTools $this->checkSequenceNumber(); $this->migrateIteeToDummytask($this->name); $this->upgradeConfiguration(); + /*----------------------------------********---------------------------------*/ + $this->upgradeAuditLog($this->name); + /*----------------------------------********---------------------------------*/ //There records in table "EMAIL_SERVER" $criteria = new Criteria("workflow"); @@ -3274,4 +3277,16 @@ class workspaceTools $conf->saveConfig('SKIN_CRON', ''); } + public function upgradeAuditLog($workspace){ + G::LoadClass("configuration"); + $conf = new Configurations(); + if (!$conf->exists('AUDIT_LOG','log')) { + CLI::logging("> Updating Auditlog Config \n"); + $oServerConf = &serverConf::getSingleton(); + $sAudit = $oServerConf->getAuditLogProperty('AL_OPTION', $workspace); + $conf->aConfig = ($sAudit == 1) ? 'true' : 'false'; + $conf->saveConfig('AUDIT_LOG', 'log'); + } + } + } diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index b9a5697f9..10ca8bb22 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -61526,7 +61526,8 @@ INSERT INTO CONFIGURATION (CFG_UID,OBJ_UID,CFG_VALUE,PRO_UID,USR_UID,APP_UID) VA ('ENVIRONMENT_SETTINGS','','a:1:{s:18:"directoryStructure";i:2;}','','',''), ('MIGRATED_LIST','list','true','list','list','list'), ('MIGRATED_LIST_UNASSIGNED','list','true','list','list','list'), -('SKIN_CRON','','s:10:"neoclassic";','','',''); +('SKIN_CRON','','s:10:"neoclassic";','','',''), +('AUDIT_LOG','log','s:5:"false";','','',''); 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'), diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php index 999ddcd44..b30304596 100755 --- a/workflow/engine/menus/setup.php +++ b/workflow/engine/menus/setup.php @@ -27,8 +27,8 @@ global $RBAC; $partnerFlag = (defined('PARTNER_FLAG')) ? PARTNER_FLAG : false; /*----------------------------------********---------------------------------*/ -$oServerConf = &serverConf::getSingleton(); -$sAudit = $oServerConf->getAuditLogProperty('AL_OPTION', SYS_SYS); +$conf = new Configurations(); +$sAudit = $conf->getConfiguration('AUDIT_LOG', 'log'); $licensedFeatures = &PMLicensedFeatures::getSingleton(); /*----------------------------------********---------------------------------*/ if ($RBAC->userCanAccess('PM_SETUP') === 1) { diff --git a/workflow/engine/methods/setup/auditLogConfig.php b/workflow/engine/methods/setup/auditLogConfig.php index 829d5c778..5467025da 100644 --- a/workflow/engine/methods/setup/auditLogConfig.php +++ b/workflow/engine/methods/setup/auditLogConfig.php @@ -3,13 +3,10 @@ global $RBAC; $RBAC->requirePermissions( 'PM_SETUP' ); -$oHeadPublisher = & headPublisher::getSingleton(); -G::LoadClass( 'serverConfiguration' ); +$conf = new Configurations(); +$sflag = $conf->getConfiguration('AUDIT_LOG', 'log'); -$oServerConf = & serverConf::getSingleton(); - -$sflag = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); -$auditLogChecked = $sflag == 1 ? true : false; +$auditLogChecked = $sflag == 'true' ? true : false; $oHeadPublisher->addExtJsScript( 'setup/auditLogConfig', true ); //adding a javascript file .js $oHeadPublisher->assign( 'auditLogChecked', $auditLogChecked ); diff --git a/workflow/engine/methods/setup/auditLogConfigAjax.php b/workflow/engine/methods/setup/auditLogConfigAjax.php index fb29cc22d..fa34814df 100644 --- a/workflow/engine/methods/setup/auditLogConfigAjax.php +++ b/workflow/engine/methods/setup/auditLogConfigAjax.php @@ -7,22 +7,21 @@ switch ($_GET['action']) { G::LoadClass( 'serverConfiguration' ); $oServerConf = & serverConf::getSingleton(); $response = new $oServerConf; + G::LoadClass("configuration"); + $conf = new Configurations(); /*you can use SYS_TEMP or SYS_SYS ON AUDIT_LOG_CONF to save for each workspace*/ - $oServerConf->unsetAuditLogProperty( 'AL_TYPE', SYS_SYS ); if (isset( $_POST['acceptAL'] )) { - $oServerConf->setAuditLogProperty( 'AL_OPTION', 1, SYS_SYS ); - $oServerConf->unsetAuditLogProperty( 'AL_NEXT_DATE', SYS_SYS ); + $conf->aConfig = 'true'; + $conf->saveConfig('AUDIT_LOG', 'log'); $response->enable = true; G::auditLog("EnableAuditLog"); } else { G::auditLog("DisableAuditLog"); - $oServerConf->setAuditLogProperty( 'AL_OPTION', 0, SYS_SYS ); - $oServerConf->unsetAuditLogProperty( 'AL_NEXT_DATE', SYS_SYS ); - $oServerConf->setAuditLogProperty( 'AL_TYPE', 'endaudit', SYS_SYS ); + $conf->aConfig = 'false'; + $conf->saveConfig('AUDIT_LOG', 'log'); $response->enable = false; } $response->success = true; - } catch (Exception $e) { $response->success = false; $response->msg = $e->getMessage();