PMCORE-3063
This commit is contained in:
@@ -433,7 +433,8 @@ class WebApplication
|
||||
* The value of $executeSetupPlugin must always be true for a web environment.
|
||||
*
|
||||
* @param string $workspace
|
||||
* @param boolean $executeSetupPlugin
|
||||
* @param bool $executeSetupPlugin
|
||||
* @param bool $setTimeZone
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*
|
||||
@@ -441,7 +442,7 @@ class WebApplication
|
||||
* @see workflow/engine/bin/cli.php
|
||||
* @see \App\Console\Commands\AddParametersTrait
|
||||
*/
|
||||
public function loadEnvironment($workspace = "", $executeSetupPlugin = true)
|
||||
public function loadEnvironment($workspace = "", $executeSetupPlugin = true, $setTimeZone = true)
|
||||
{
|
||||
define("PATH_SEP", DIRECTORY_SEPARATOR);
|
||||
|
||||
@@ -511,8 +512,10 @@ class WebApplication
|
||||
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace);
|
||||
|
||||
if ($setTimeZone) {
|
||||
//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']);
|
||||
@@ -521,8 +524,10 @@ class WebApplication
|
||||
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
|
||||
define('SYS_SKIN', $arraySystemConfiguration['default_skin']);
|
||||
define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']);
|
||||
if ($setTimeZone) {
|
||||
define('TIME_ZONE',
|
||||
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']);
|
||||
}
|
||||
|
||||
// Change storage path
|
||||
app()->useStoragePath(realpath(PATH_DATA));
|
||||
@@ -537,11 +542,11 @@ class WebApplication
|
||||
ini_set('short_open_tag', 'On'); //??
|
||||
ini_set('default_charset', 'UTF-8'); //??
|
||||
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
|
||||
if ($setTimeZone) {
|
||||
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
|
||||
|
||||
date_default_timezone_set(TIME_ZONE);
|
||||
|
||||
config(['app.timezone' => TIME_ZONE]);
|
||||
}
|
||||
|
||||
// Define the language
|
||||
Bootstrap::setLanguage();
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
<?php
|
||||
|
||||
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
|
||||
// Auto loader
|
||||
require_once __DIR__ . '/../../../bootstrap/autoload.php';
|
||||
|
||||
// Initialize core
|
||||
$app = new Maveriks\WebApplication();
|
||||
$app->setRootDir(PROCESSMAKER_PATH);
|
||||
$app->loadEnvironment();
|
||||
$app->loadEnvironment('', true, false);
|
||||
|
||||
// trap -V before pake
|
||||
// Trap -V before pake
|
||||
if (in_array('-v', $argv) || in_array('-V', $argv) || in_array('--version', $argv)) {
|
||||
printf("ProcessMaker version %s\n", pakeColor::colorize(trim(file_get_contents(PATH_GULLIVER . 'VERSION')), 'INFO'));
|
||||
printf("ProcessMaker version %s\n",
|
||||
pakeColor::colorize(trim(file_get_contents(PATH_GULLIVER . 'VERSION')), 'INFO'));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// register tasks
|
||||
//TODO: include plugins
|
||||
$directories = array(PATH_HOME . 'engine/bin/tasks');
|
||||
// Register tasks
|
||||
$directories = [PATH_HOME . 'engine/bin/tasks'];
|
||||
$pluginsDirectories = glob(PATH_PLUGINS . "*");
|
||||
foreach ($pluginsDirectories as $dir) {
|
||||
if (!is_dir($dir)) {
|
||||
@@ -24,13 +26,35 @@ $app->loadEnvironment();
|
||||
$directories[] = "$dir/bin/tasks";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($directories as $dir) {
|
||||
foreach (glob("$dir/*.php") as $filename) {
|
||||
include_once($filename);
|
||||
include_once $filename;
|
||||
}
|
||||
}
|
||||
|
||||
// Set time zone, if not defined
|
||||
if (!defined('TIME_ZONE')) {
|
||||
// Get workspace
|
||||
$args = $argv;
|
||||
$cliName = array_shift($args);
|
||||
$taskName = array_shift($args);
|
||||
$workspace = array_shift($args);
|
||||
while ($workspace[0] == '-') {
|
||||
$workspace = array_shift($args);
|
||||
}
|
||||
|
||||
// Get time zone (global or by workspace)
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace);
|
||||
|
||||
// Set time zone
|
||||
$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
|
||||
define('TIME_ZONE',
|
||||
(isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']);
|
||||
ini_set('date.timezone', TIME_ZONE);
|
||||
date_default_timezone_set(TIME_ZONE);
|
||||
config(['app.timezone' => TIME_ZONE]);
|
||||
}
|
||||
|
||||
// Run command
|
||||
CLI::run();
|
||||
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user