function run_flush_cache($args, $opts) { $rootDir = realpath(__DIR__."/../../../../"); $app = new Maveriks\WebApplication(); $app->setRootDir($rootDir); $loadConstants = false; $workspaces = get_workspaces_from_args($args); if (! defined("PATH_C")) { die("ERROR: seems processmaker is not properly installed (System constants are missing).".PHP_EOL); } CLI::logging("Flush ".pakeColor::colorize("system", "INFO")." cache ... "); G::rm_dir(PATH_C); G::mk_dir(PATH_C, 0777); echo "DONE" . PHP_EOL; foreach ($workspaces as $workspace) { echo "Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... "; G::rm_dir($workspace->path . "/cache"); G::mk_dir($workspace->path . "/cache", 0777); G::rm_dir($workspace->path . "/cachefiles"); G::mk_dir($workspace->path . "/cachefiles", 0777); echo "DONE" . PHP_EOL; } }
function run_create_translation($args, $opts) { G::LoadSystem('inputfilter'); $filter = new InputFilter(); $opts = $filter->xssFilterHard($opts); $args = $filter->xssFilterHard($args); $rootDir = realpath(__DIR__."/../../../../"); $app = new Maveriks\WebApplication(); $app->setRootDir($rootDir); $loadConstants = false; $workspaces = get_workspaces_from_args($args); $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; $translation = new Translation(); CLI::logging("Updating labels Mafe ...\n"); foreach ($workspaces as $workspace) { try { echo "Updating labels for workspace " . pakeColor::colorize($workspace->name, "INFO") . "\n"; $translation->generateTransaltionMafe($lang); } catch (Exception $e) { echo "Errors upgrading labels for workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"; } } CLI::logging("Create successful\n"); }
// define ('DEBUG_TIME_LOG', $config['debug_time']); // define ('DEBUG_CALENDAR_LOG', $config['debug_calendar']); // define ('MEMCACHED_ENABLED', $config['memcached']); // define ('MEMCACHED_SERVER', $config['memcached_server']); // define ('TIME_ZONE', $config['time_zone']); $rootDir = PROCESSMAKER_PATH; require $rootDir . "framework/src/Maveriks/Util/ClassLoader.php"; $loader = Maveriks\Util\ClassLoader::getInstance(); $loader->add($rootDir . 'framework/src/', "Maveriks"); $loader->add($rootDir . 'workflow/engine/src/', "ProcessMaker"); $loader->add($rootDir . 'workflow/engine/src/'); // add vendors to autoloader $loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2"); $loader->addClass("Bootstrap", $rootDir . 'gulliver/system/class.bootstrap.php'); $loader->addModelClassPath($rootDir . "workflow/engine/classes/model/"); $app = new Maveriks\WebApplication(); $app->setRootDir($rootDir); $app->loadEnvironment(); require PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeFunction.php"; require PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeGetopt.class.php"; G::LoadClass("cli"); // 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 //TODO: include plugins $directories = array(PATH_HOME . 'engine/bin/tasks'); $pluginsDirectories = glob(PATH_PLUGINS . "*"); foreach ($pluginsDirectories as $dir) {
$loader->add($rootDir . 'framework/src/', "Maveriks"); if (!is_dir($rootDir . 'vendor')) { if (file_exists($rootDir . 'composer.phar')) { throw new Exception("ERROR: Vendors are missing!" . PHP_EOL . "Please execute the following command to install vendors:" . PHP_EOL . PHP_EOL . "\$>php composer.phar install"); } else { throw new Exception("ERROR: Vendors are missing!" . PHP_EOL . "Please execute the following commands to prepare/install vendors:" . PHP_EOL . PHP_EOL . "\$>curl -sS https://getcomposer.org/installer | php" . PHP_EOL . "\$>php composer.phar install"); } } $loader->add($rootDir . 'workflow/engine/src/', "ProcessMaker"); $loader->add($rootDir . 'workflow/engine/src/'); // add vendors to autoloader $loader->add($rootDir . 'vendor/luracast/restler/vendor', "Luracast"); $loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2"); $loader->addClass("Bootstrap", $rootDir . 'gulliver/system/class.bootstrap.php'); $loader->addModelClassPath($rootDir . "workflow/engine/classes/model/"); $app = new Maveriks\WebApplication(); $app->setRootDir($rootDir); $app->setRequestUri($_SERVER['REQUEST_URI']); $stat = $app->route(); switch ($stat) { case Maveriks\WebApplication::RUNNING_WORKFLOW: include "sysGeneric.php"; break; case Maveriks\WebApplication::RUNNING_API: $app->run(Maveriks\WebApplication::SERVICE_API); break; case Maveriks\WebApplication::RUNNING_OAUTH2: $app->run(Maveriks\WebApplication::SERVICE_OAUTH2); break; case Maveriks\WebApplication::RUNNING_INDEX: $response = new Maveriks\Http\Response(file_get_contents("index.html"), 302);