This commit is contained in:
Julio Cesar Laura Avendaño
2019-02-22 13:02:21 -04:00
parent acc5f38c55
commit 9a50b8cfb5
5 changed files with 110 additions and 138 deletions

View File

@@ -12,7 +12,7 @@ return [
'log' => env('APP_LOG', 'single'), 'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'), 'log_level' => env('APP_LOG_LEVEL', 'debug'),
'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60),
'timezone' => 'UTC',
'providers' => [ 'providers' => [
FilesystemServiceProvider::class, FilesystemServiceProvider::class,
CacheServiceProvider::class, CacheServiceProvider::class,

View File

@@ -3,6 +3,7 @@
namespace Maveriks; namespace Maveriks;
use Bootstrap; use Bootstrap;
use Exception;
use G; use G;
use Illuminate\Foundation\Http\Kernel; use Illuminate\Foundation\Http\Kernel;
use Luracast\Restler\Format\UploadFormat; use Luracast\Restler\Format\UploadFormat;
@@ -426,6 +427,16 @@ class WebApplication
); );
} }
/**
* Define constants, setup configuration and initialize Laravel
*
* @param string $workspace
* @return bool
* @throws Exception
*
* @see run()
* @see workflow/engine/bin/cli.php
*/
public function loadEnvironment($workspace = "") public function loadEnvironment($workspace = "")
{ {
define("PATH_SEP", DIRECTORY_SEPARATOR); define("PATH_SEP", DIRECTORY_SEPARATOR);
@@ -467,24 +478,11 @@ class WebApplication
define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP); define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP);
define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . PATH_SEP); define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . PATH_SEP);
G::defineConstants();
$arraySystemConfiguration = System::getSystemConfiguration();
ini_set('date.timezone', $arraySystemConfiguration['time_zone']); //Set Time Zone
// set include path
set_include_path(
PATH_CORE . PATH_SEPARATOR .
PATH_THIRDPARTY . PATH_SEPARATOR .
PATH_THIRDPARTY . "pear" . PATH_SEPARATOR .
PATH_RBAC_CORE . PATH_SEPARATOR .
get_include_path()
);
/* /*
* Setting Up Workspace * Setting Up Workspace
*/ */
if (!file_exists(FILE_PATHS_INSTALLED)) { if (!file_exists(FILE_PATHS_INSTALLED)) {
throw new \Exception("Can't locate system file: " . FILE_PATHS_INSTALLED); throw new Exception("Can't locate system file: " . FILE_PATHS_INSTALLED);
} }
// include the server installed configuration // include the server installed configuration
@@ -496,17 +494,58 @@ class WebApplication
define("PATH_TEMPORAL", PATH_C . "dynEditor/"); define("PATH_TEMPORAL", PATH_C . "dynEditor/");
define("PATH_DB", PATH_DATA . "sites" . PATH_SEP); define("PATH_DB", PATH_DATA . "sites" . PATH_SEP);
// set include path
set_include_path(
PATH_CORE . PATH_SEPARATOR .
PATH_THIRDPARTY . PATH_SEPARATOR .
PATH_THIRDPARTY . "pear" . PATH_SEPARATOR .
PATH_RBAC_CORE . PATH_SEPARATOR .
get_include_path()
);
G::defineConstants();
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace);
//In community version the default value is 0
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']);
define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('SYS_SKIN', $arraySystemConfiguration['default_skin']);
define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']);
define('TIME_ZONE',
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']);
// Change storage path // Change storage path
app()->useStoragePath(realpath(PATH_DATA)); app()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap(); app()->make(Kernel::class)->bootstrap();
restore_error_handler(); restore_error_handler();
error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED);
//Overwrite with the Processmaker env.ini configuration used in production environments
//@todo: move env.ini configuration to .env
ini_set('display_errors', $arraySystemConfiguration['display_errors']);
ini_set('error_reporting', $arraySystemConfiguration['error_reporting']);
ini_set('short_open_tag', 'On'); //??
ini_set('default_charset', 'UTF-8'); //??
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
date_default_timezone_set(TIME_ZONE);
config(['app.timezone' => TIME_ZONE]);
Bootstrap::setLanguage(); Bootstrap::setLanguage();
Bootstrap::LoadTranslationObject((defined("SYS_LANG")) ? SYS_LANG : "en"); Bootstrap::LoadTranslationObject((defined("SYS_LANG")) ? SYS_LANG : "en");
if (empty($workspace)) { if (empty($workspace)) {
// If the workspace is empty the function should be return the control to the previous file
return true; return true;
} }
@@ -520,24 +559,6 @@ class WebApplication
exit(0); exit(0);
} }
$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
//Do not change any of these settings directly, use env.ini instead
ini_set('display_errors', $arraySystemConfiguration['display_errors']);
ini_set('error_reporting', $arraySystemConfiguration['error_reporting']);
ini_set('short_open_tag', 'On'); //??
ini_set('default_charset', 'UTF-8'); //??
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']);
define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('SYS_SKIN', $arraySystemConfiguration['default_skin']);
define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']);
require_once(PATH_DB . config("system.workspace") . "/db.php"); require_once(PATH_DB . config("system.workspace") . "/db.php");
// defining constant for workspace shared directory // defining constant for workspace shared directory
@@ -591,17 +612,6 @@ class WebApplication
\Propel::init(PATH_CONFIG . "databases.php"); \Propel::init(PATH_CONFIG . "databases.php");
//Set Time Zone
/*----------------------------------********---------------------------------*/
if (\PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1;
}
/*----------------------------------********---------------------------------*/
ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']); //Set Time Zone
define('TIME_ZONE', ini_get('date.timezone'));
$oPluginRegistry = PluginRegistry::loadSingleton(); $oPluginRegistry = PluginRegistry::loadSingleton();
$attributes = $oPluginRegistry->getAttributes(); $attributes = $oPluginRegistry->getAttributes();
Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attributes); Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attributes);
@@ -626,7 +636,7 @@ class WebApplication
} }
return (isset($arrayConfig["api"]["version"]))? $arrayConfig["api"]["version"] : "1.0"; return (isset($arrayConfig["api"]["version"]))? $arrayConfig["api"]["version"] : "1.0";
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }

View File

@@ -90,6 +90,9 @@ try {
$e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all; $e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all;
$e_all = ($arraySystemConfiguration['debug'])? $e_all : $e_all & ~E_NOTICE; $e_all = ($arraySystemConfiguration['debug'])? $e_all : $e_all & ~E_NOTICE;
//In community version the default value is 0
$systemUtcTimeZone = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
app()->useStoragePath(realpath(PATH_DATA)); app()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap(); app()->make(Kernel::class)->bootstrap();
restore_error_handler(); restore_error_handler();
@@ -100,14 +103,18 @@ try {
ini_set('default_charset', 'UTF-8'); ini_set('default_charset', 'UTF-8');
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']); ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
ini_set('date.timezone', $arraySystemConfiguration['time_zone']); ini_set('date.timezone', $systemUtcTimeZone ? 'UTC' : $arraySystemConfiguration['time_zone']);
define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']);
define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('TIME_ZONE', ini_get('date.timezone')); define('TIME_ZONE', ini_get('date.timezone'));
date_default_timezone_set(TIME_ZONE);
config(['app.timezone' => TIME_ZONE]);
//CRON command options //CRON command options
$arrayCommandOption = [ $arrayCommandOption = [
@@ -162,9 +169,7 @@ try {
try { try {
$cronSinglePath = PATH_CORE . 'bin' . PATH_SEP . 'cron_single.php'; $cronSinglePath = PATH_CORE . 'bin' . PATH_SEP . 'cron_single.php';
$workspace = ''; $workspace = '';
$dateSystem = date('Y-m-d H:i:s');
$date = ''; $date = '';
$argvx = ''; $argvx = '';
@@ -192,8 +197,6 @@ try {
if (!empty($date) && preg_match('/^' . '[1-9]\d{3}\-(?:0[1-9]|1[0-2])\-(?:0[1-9]|[12][0-9]|3[01])' . '(?:\s' . '(?:[0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d' . ')?$/', $date)) { if (!empty($date) && preg_match('/^' . '[1-9]\d{3}\-(?:0[1-9]|1[0-2])\-(?:0[1-9]|[12][0-9]|3[01])' . '(?:\s' . '(?:[0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d' . ')?$/', $date)) {
eprintln('[Applying date filter: ' . $date . ']'); eprintln('[Applying date filter: ' . $date . ']');
} else {
$date = $dateSystem;
} }
$counterw = 0; $counterw = 0;
@@ -207,7 +210,7 @@ try {
if (file_exists(PATH_DB . $entry . PATH_SEP . 'db.php')) { if (file_exists(PATH_DB . $entry . PATH_SEP . 'db.php')) {
$counterw++; $counterw++;
passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $entry . ' "' . $dateSystem . '" "' . $date . '" ' . $argvx); passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $entry . ' "' . $date . '" ' . $argvx);
} }
} }
} }
@@ -219,7 +222,7 @@ try {
$counterw++; $counterw++;
passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $workspace . ' "' . $dateSystem . '" "' . $date . '" ' . $argvx); passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $workspace . ' "' . $date . '" ' . $argvx);
} }
eprintln('Finished ' . $counterw . ' workspaces processed'); eprintln('Finished ' . $counterw . ' workspaces processed');

View File

@@ -31,7 +31,7 @@ ini_set('memory_limit', '512M');
try { try {
//Verify data //Verify data
if (count($argv) < 8) { if (count($argv) < 7) {
throw new Exception('Error: Invalid number of arguments'); throw new Exception('Error: Invalid number of arguments');
} }
@@ -51,8 +51,7 @@ try {
$pathOutTrunk = $argv[3]; $pathOutTrunk = $argv[3];
$cronName = $argv[4]; $cronName = $argv[4];
$workspace = $argv[5]; $workspace = $argv[5];
$dateSystem = $argv[6]; $now = $argv[6]; //date
$sNow = $argv[7]; //date
//Defines constants //Defines constants
define('PATH_SEP', ($osIsLinux) ? '/' : '\\'); define('PATH_SEP', ($osIsLinux) ? '/' : '\\');
@@ -84,6 +83,9 @@ try {
$e_all = (defined('E_STRICT')) ? $e_all & ~E_STRICT : $e_all; $e_all = (defined('E_STRICT')) ? $e_all & ~E_STRICT : $e_all;
$e_all = ($arraySystemConfiguration['debug']) ? $e_all : $e_all & ~E_NOTICE; $e_all = ($arraySystemConfiguration['debug']) ? $e_all : $e_all & ~E_NOTICE;
//In community version the default value is 0
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
app()->useStoragePath(realpath(PATH_DATA)); app()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap(); app()->make(Kernel::class)->bootstrap();
restore_error_handler(); restore_error_handler();
@@ -93,13 +95,18 @@ try {
ini_set('short_open_tag', 'On'); ini_set('short_open_tag', 'On');
ini_set('default_charset', 'UTF-8'); ini_set('default_charset', 'UTF-8');
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
ini_set('date.timezone', $arraySystemConfiguration['time_zone']); ini_set('date.timezone', $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] ? 'UTC' : $arraySystemConfiguration['time_zone']);
define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']);
define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('TIME_ZONE', ini_get('date.timezone'));
date_default_timezone_set(TIME_ZONE);
config(['app.timezone' => TIME_ZONE]);
spl_autoload_register(['Bootstrap', 'autoloadClass']); spl_autoload_register(['Bootstrap', 'autoloadClass']);
@@ -230,23 +237,9 @@ try {
define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', '')); define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', ''));
} }
//Set Time Zone $dateSystem = date('Y-m-d H:i:s');
$systemUtcTimeZone = false; if (empty($now)) {
$now = $dateSystem;
/*----------------------------------********---------------------------------*/
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
$systemUtcTimeZone = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1;
}
/*----------------------------------********---------------------------------*/
ini_set('date.timezone', ($systemUtcTimeZone) ? 'UTC' : $arraySystemConfiguration['time_zone']); //Set Time Zone
define('TIME_ZONE', ini_get('date.timezone'));
//UTC time zone
if ($systemUtcTimeZone) {
$sNow = convertToSystemUtcTimeZone($sNow);
$dateSystem = convertToSystemUtcTimeZone($dateSystem);
} }
//Processing //Processing
@@ -276,7 +269,7 @@ try {
case 'timereventcron': case 'timereventcron':
$timerEvent = new \ProcessMaker\BusinessModel\TimerEvent(); $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
$timerEvent->startContinueCaseByTimerEvent($sNow, true); $timerEvent->startContinueCaseByTimerEvent($now, true);
break; break;
case 'sendnotificationscron': case 'sendnotificationscron':
sendNotifications(); sendNotifications();
@@ -334,7 +327,7 @@ function processWorkspace()
function resendEmails() function resendEmails()
{ {
global $argvx; global $argvx;
global $sNow; global $now;
global $dateSystem; global $dateSystem;
if ($argvx != "" && strpos($argvx, "emails") === false) { if ($argvx != "" && strpos($argvx, "emails") === false) {
@@ -344,9 +337,9 @@ function resendEmails()
setExecutionMessage("Resending emails"); setExecutionMessage("Resending emails");
try { try {
$dateResend = $sNow; $dateResend = $now;
if ($sNow == $dateSystem) { if ($now == $dateSystem) {
$arrayDateSystem = getdate(strtotime($dateSystem)); $arrayDateSystem = getdate(strtotime($dateSystem));
$mktDateSystem = mktime( $mktDateSystem = mktime(
@@ -399,7 +392,7 @@ function resendEmails()
function unpauseApplications() function unpauseApplications()
{ {
global $argvx; global $argvx;
global $sNow; global $now;
if ($argvx != "" && strpos($argvx, "unpause") === false) { if ($argvx != "" && strpos($argvx, "unpause") === false) {
return false; return false;
@@ -409,7 +402,7 @@ function unpauseApplications()
try { try {
$oCases = new Cases(); $oCases = new Cases();
$oCases->ThrowUnpauseDaemon($sNow, 1); $oCases->ThrowUnpauseDaemon($now, 1);
setExecutionResultMessage('DONE'); setExecutionResultMessage('DONE');
saveLog('unpauseApplications', 'action', 'Unpausing Applications'); saveLog('unpauseApplications', 'action', 'Unpausing Applications');
@@ -543,10 +536,10 @@ function calculateAppDuration()
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
function executeEvents($sLastExecution, $sNow = null) function executeEvents($sLastExecution, $now = null)
{ {
global $argvx; global $argvx;
global $sNow; global $now;
$log = array(); $log = array();
@@ -559,15 +552,15 @@ function executeEvents($sLastExecution, $sNow = null)
try { try {
$oAppEvent = new AppEvent(); $oAppEvent = new AppEvent();
saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $sNow "); saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $now ");
$n = $oAppEvent->executeEvents($sNow, false, $log, 1); $n = $oAppEvent->executeEvents($now, false, $log, 1);
foreach ($log as $value) { foreach ($log as $value) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$arrayCron["processcTimeStart"] = time(); $arrayCron["processcTimeStart"] = time();
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
saveLog('executeEvents', 'action', "Execute Events : $value, $sNow "); saveLog('executeEvents', 'action', "Execute Events : $value, $now ");
} }
setExecutionMessage("|- End Execution events"); setExecutionMessage("|- End Execution events");
@@ -579,11 +572,11 @@ function executeEvents($sLastExecution, $sNow = null)
} }
} }
function executeScheduledCases($sNow = null) function executeScheduledCases($now = null)
{ {
try { try {
global $argvx; global $argvx;
global $sNow; global $now;
$log = array(); $log = array();
if ($argvx != "" && strpos($argvx, "scheduler") === false) { if ($argvx != "" && strpos($argvx, "scheduler") === false) {
@@ -594,7 +587,7 @@ function executeScheduledCases($sNow = null)
setExecutionResultMessage('PROCESSING'); setExecutionResultMessage('PROCESSING');
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
$oCaseScheduler->caseSchedulerCron($sNow, $log, 1); $oCaseScheduler->caseSchedulerCron($now, $log, 1);
foreach ($log as $value) { foreach ($log as $value) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
@@ -611,35 +604,6 @@ function executeScheduledCases($sNow = null)
} }
} }
function convertToSystemUtcTimeZone($sNow)
{
global $arraySystemConfiguration;
$runDate = isset($sNow) ? $sNow : date('Y-m-d H:i:s');
$systemUtcTimeZone = false;
/*----------------------------------********---------------------------------*/
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
$systemUtcTimeZone = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1;
}
/*----------------------------------********---------------------------------*/
if ($systemUtcTimeZone) {
if (isset($sNow)) {
//as the $sNow param that comes from the command line doesn't specicy a time zone
//we assume that the user set this time using the server time zone so we use the gmdate
//function to convert it
$currentTimeZone = date_default_timezone_get();
date_default_timezone_set($arraySystemConfiguration['time_zone']);
$runDate = gmdate('Y-m-d H:i:s', strtotime($sNow));
date_default_timezone_set($currentTimeZone);
} else {
$runDate = gmdate('Y-m-d H:i:s');
}
}
return $runDate;
}
function executeUpdateAppTitle() function executeUpdateAppTitle()
{ {
try { try {

View File

@@ -301,10 +301,11 @@ if (!(array_key_exists('REMOTE_USER', $_SERVER) && (string)($_SERVER['REMOTE_USE
ini_set('session.cookie_httponly', 1); ini_set('session.cookie_httponly', 1);
ini_set('session.cookie_secure', 1); ini_set('session.cookie_secure', 1);
} }
//$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL;
//$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all; //Set Time Zone
//$e_all = $config['debug'] ? $e_all : $e_all & ~ E_NOTICE; /*----------------------------------********---------------------------------*/
//$e_all = E_ALL & ~ E_DEPRECATED & ~ E_STRICT & ~ E_NOTICE & ~E_WARNING; $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1;
/*----------------------------------********---------------------------------*/
// Do not change any of these settings directly, use env.ini instead // Do not change any of these settings directly, use env.ini instead
ini_set('display_errors', $config['display_errors']); ini_set('display_errors', $config['display_errors']);
@@ -313,7 +314,8 @@ ini_set('short_open_tag', 'On');
ini_set('default_charset', "UTF-8"); ini_set('default_charset', "UTF-8");
ini_set('memory_limit', $config['memory_limit']); ini_set('memory_limit', $config['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
ini_set('date.timezone', $config['time_zone']); //Set Time Zone ini_set('date.timezone',
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone
define('DEBUG_SQL_LOG', $config['debug_sql']); define('DEBUG_SQL_LOG', $config['debug_sql']);
define('DEBUG_SQL', $config['debug']); define('DEBUG_SQL', $config['debug']);
@@ -321,9 +323,7 @@ define('DEBUG_TIME_LOG', $config['debug_time']);
define('DEBUG_CALENDAR_LOG', $config['debug_calendar']); define('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
define('MEMCACHED_ENABLED', $config['memcached']); define('MEMCACHED_ENABLED', $config['memcached']);
define('MEMCACHED_SERVER', $config['memcached_server']); define('MEMCACHED_SERVER', $config['memcached_server']);
define('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf'); define('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf');
define('LOAD_HEADERS_IE', $config['load_headers_ie']); define('LOAD_HEADERS_IE', $config['load_headers_ie']);
define('LEAVE_CASE_WARNING', $config['leave_case_warning']); define('LEAVE_CASE_WARNING', $config['leave_case_warning']);
define('REDIRECT_TO_MOBILE', $config['redirect_to_mobile']); define('REDIRECT_TO_MOBILE', $config['redirect_to_mobile']);
@@ -332,6 +332,7 @@ define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $config['disable_downloa
define('LOGS_MAX_FILES', $config['logs_max_files']); define('LOGS_MAX_FILES', $config['logs_max_files']);
define('LOGS_LOCATION', $config['logs_location']); define('LOGS_LOCATION', $config['logs_location']);
define('LOGGING_LEVEL', $config['logging_level']); define('LOGGING_LEVEL', $config['logging_level']);
define('TIME_ZONE', ini_get('date.timezone'));
// IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it. // IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it.
$_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME']; $_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME'];
@@ -565,7 +566,11 @@ ini_set('short_open_tag', 'On');
ini_set('default_charset', "UTF-8"); ini_set('default_charset', "UTF-8");
ini_set('memory_limit', $config['memory_limit']); ini_set('memory_limit', $config['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']);
ini_set('date.timezone', $config['time_zone']); //Set Time Zone ini_set('date.timezone', TIME_ZONE); //Set Time Zone
date_default_timezone_set(TIME_ZONE);
config(['app.timezone' => TIME_ZONE]);
// Load Language Translation // Load Language Translation
Bootstrap::LoadTranslationObject(defined('SYS_LANG') ? SYS_LANG : "en"); Bootstrap::LoadTranslationObject(defined('SYS_LANG') ? SYS_LANG : "en");
@@ -707,16 +712,6 @@ Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attrib
// Initialization functions plugins // Initialization functions plugins
$oPluginRegistry->init(); $oPluginRegistry->init();
//Set Time Zone
/*----------------------------------********---------------------------------*/
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1;
/*----------------------------------********---------------------------------*/
ini_set('date.timezone',
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone
define('TIME_ZONE', ini_get('date.timezone'));
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$_GET = \ProcessMaker\Util\DateTime::convertDataToUtc($_GET); $_GET = \ProcessMaker\Util\DateTime::convertDataToUtc($_GET);
$_POST = \ProcessMaker\Util\DateTime::convertDataToUtc($_POST); $_POST = \ProcessMaker\Util\DateTime::convertDataToUtc($_POST);