diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 47adb07e2..4e07b40db 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -232,7 +232,7 @@ class WebApplication ); } - public function loadEnvironment($workspace) + public function loadEnvironment($workspace = "") { $lang = "en"; @@ -326,6 +326,10 @@ class WebApplication define("PATH_TEMPORAL", PATH_C . "dynEditor/"); define("PATH_DB", PATH_DATA . "sites" . PATH_SEP); + if (empty($workspace)) { + return true; + } + define("SYS_SYS", $workspace); if (! file_exists( PATH_DB . SYS_SYS . "/db.php" )) { @@ -367,5 +371,7 @@ class WebApplication //$memcache = PMmemcached::getSingleton( SYS_SYS ); \Propel::init(PATH_CONFIG . "databases.php"); + + return true; } } \ No newline at end of file diff --git a/workflow/engine/bin/cli.php b/workflow/engine/bin/cli.php index e3047d28e..963e9b3d4 100755 --- a/workflow/engine/bin/cli.php +++ b/workflow/engine/bin/cli.php @@ -25,59 +25,80 @@ * @author Alexandre Rosenfeld */ - /* Windows supports both / and \ as path separators, so use the Unix separator - * for maximum compatibility. - */ - define('PATH_SEP', '/'); +// /* Windows supports both / and \ as path separators, so use the Unix separator +// * for maximum compatibility. +// */ +// define('PATH_SEP', '/'); +// +// define('PATH_HOME', WORKFLOW_PATH ); +// define('PATH_TRUNK', PROCESSMAKER_PATH ); +// define('PATH_OUTTRUNK', realpath(PROCESSMAKER_PATH.'/..') ); +// +///* Most definitions (including the G class) is done in paths.php +// * This mostly simulates a sysGeneric.php call. +// */ +//if (file_exists(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php")) { +// require_once(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php"); +//} +// +//require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths.php"); +// +//require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeFunction.php"); +//require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeGetopt.class.php"); +//require_once (PATH_CORE . "config" . PATH_SEP . "environments.php"); +//require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php"); +// +//require_once (PATH_GULLIVER . "class.bootstrap.php"); +// +//spl_autoload_register(array("Bootstrap", "autoloadClass")); +// +//Bootstrap::registerSystemClasses(); +// +//$config = System::getSystemConfiguration(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "env.ini"); +// +// $e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL; +// $e_all = defined('E_STRICT') ? E_ALL & ~E_STRICT : $e_all; +// $e_all = $e_all & E_WARNING; // show warning +// $e_all = $e_all & ~E_NOTICE; // don't notices +// +// // Do not change any of these settings directly, use env.ini instead +// ini_set('display_errors', $config['debug']); +// ini_set('error_reporting', $e_all); +// ini_set('short_open_tag', 'On'); +// ini_set('default_charset', "UTF-8"); +// ini_set('memory_limit', $config['memory_limit']); +// ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); +// ini_set('date.timezone', $config['time_zone']); +// +// define ('DEBUG_SQL_LOG', $config['debug_sql']); +// 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']); - define('PATH_HOME', WORKFLOW_PATH ); - define('PATH_TRUNK', PROCESSMAKER_PATH ); - define('PATH_OUTTRUNK', realpath(PROCESSMAKER_PATH.'/..') ); +$rootDir = PROCESSMAKER_PATH; +require $rootDir . "framework/src/Maveriks/Util/ClassLoader.php"; -/* Most definitions (including the G class) is done in paths.php - * This mostly simulates a sysGeneric.php call. - */ -if (file_exists(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.php")) { - require_once(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths_installed.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/'); -require_once (PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths.php"); +// add vendors to autoloader +$loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2"); +$loader->addClass("Bootstrap", $rootDir . 'gulliver/system/class.bootstrap.php'); -require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeFunction.php"); -require_once (PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeGetopt.class.php"); -require_once (PATH_CORE . "config" . PATH_SEP . "environments.php"); -require_once (PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.system.php"); +$loader->addModelClassPath($rootDir . "workflow/engine/classes/model/"); -require_once (PATH_GULLIVER . "class.bootstrap.php"); +$app = new Maveriks\WebApplication(); +$app->setRootDir($rootDir); +$app->loadEnvironment(); -spl_autoload_register(array("Bootstrap", "autoloadClass")); +require PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeFunction.php"; +require PATH_THIRDPARTY . "pake" . PATH_SEP . "pakeGetopt.class.php"; -Bootstrap::registerSystemClasses(); - -$config = System::getSystemConfiguration(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "env.ini"); - - $e_all = defined('E_DEPRECATED') ? E_ALL & ~E_DEPRECATED : E_ALL; - $e_all = defined('E_STRICT') ? E_ALL & ~E_STRICT : $e_all; - $e_all = $e_all & E_WARNING; // show warning - $e_all = $e_all & ~E_NOTICE; // don't notices - - // Do not change any of these settings directly, use env.ini instead - ini_set('display_errors', $config['debug']); - ini_set('error_reporting', $e_all); - ini_set('short_open_tag', 'On'); - ini_set('default_charset', "UTF-8"); - ini_set('memory_limit', $config['memory_limit']); - ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); - ini_set('date.timezone', $config['time_zone']); - - define ('DEBUG_SQL_LOG', $config['debug_sql']); - 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']); - - G::LoadClass("cli"); +G::LoadClass("cli"); // trap -V before pake if (in_array('-v', $argv) || in_array('-V', $argv) || in_array('--version', $argv)) diff --git a/workflow/engine/bin/tasks/cliBrowserCacheFiles.php b/workflow/engine/bin/tasks/cliBrowserCacheFiles.php index 5009de68c..c03802a0a 100644 --- a/workflow/engine/bin/tasks/cliBrowserCacheFiles.php +++ b/workflow/engine/bin/tasks/cliBrowserCacheFiles.php @@ -8,7 +8,7 @@ CLI::taskDescription(<<