Files
luos/workflow/engine/bin/cli.php

65 lines
1.8 KiB
PHP
Raw Normal View History

2010-12-02 23:34:41 +00:00
<?php
use ProcessMaker\Core\System;
2021-06-30 15:39:54 +00:00
// Auto loader
require_once __DIR__ . '/../../../bootstrap/autoload.php';
2014-03-17 11:54:09 -04:00
2021-06-30 15:39:54 +00:00
// Initialize core
2014-03-17 11:54:09 -04:00
$app = new Maveriks\WebApplication();
$app->setRootDir(PROCESSMAKER_PATH);
2021-06-30 15:39:54 +00:00
$app->loadEnvironment('', true, false);
// 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'));
exit(0);
}
// Register tasks
$directories = [PATH_HOME . 'engine/bin/tasks'];
$pluginsDirectories = glob(PATH_PLUGINS . "*");
foreach ($pluginsDirectories as $dir) {
if (!is_dir($dir)) {
continue;
}
if (is_dir("$dir/bin/tasks")) {
$directories[] = "$dir/bin/tasks";
}
}
foreach ($directories as $dir) {
foreach (glob("$dir/*.php") as $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);
2021-11-16 14:02:31 -04:00
if (isset($workspace[0])) {
while ($workspace[0] == '-') {
$workspace = array_shift($args);
}
2021-06-30 15:39:54 +00:00
}
// 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);