Esempio n. 1
0
$_SERVER['HTTP_USER_AGENT'] = 'crowdfusion-cli';
$_SERVER['QUERY_STRING'] = '';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['CLI_REQUEST'] = true;
$_SERVER['REQUEST_URI'] = $request_uri;
$_GET = array();
$_POST = array();
if (strpos($request_uri, '?') !== false) {
    $_SERVER['QUERY_STRING'] = substr($request_uri, strpos($request_uri, '?') + 1);
    parse_str($_SERVER['QUERY_STRING'], $_GET);
}
$now = microtime(true);
define('PATH_ROOT_SYM', dirname(__FILE__) . '/');
define('PATH_ROOT', realpath(dirname(__FILE__) . '/'));
define('PATH_BUILD', PATH_ROOT . '/build');
define('PATH_APP', PATH_ROOT . '/app');
define('PATH_SYSTEM', PATH_ROOT . '/system');
require PATH_SYSTEM . '/context/ApplicationContext.php';
$hotDeploy = !$compiled;
//////////////////////
// SYSTEM BOOTSTRAP //
//////////////////////
$contextResources = array(PATH_SYSTEM . '/core', PATH_ROOT . '/crowdfusion', PATH_APP . '/plugins');
$postContextResources = array();
if (!empty($custom_context)) {
    $postContextResources[] = $custom_context;
}
$ApplicationContext = new ApplicationContext($contextResources, $options = array('determineContext' => true, 'hotDeploy' => $hotDeploy, 'cacheDir' => PATH_BUILD . '/deploy/', 'systemFile' => PATH_BUILD . '/system.xml', 'environmentsFile' => PATH_BUILD . '/environments.xml', 'systemContextDir' => PATH_SYSTEM . '/config/context'), $postContextResources);
$Dispatcher = $ApplicationContext->object('Dispatcher');
$Dispatcher->processRequest();
//error_log(((microtime(TRUE) - $now)*1000).'ms, '.$ApplicationContext->getNumInstancesCreated().' instances, mem usage: '.FileSystemUtils::humanFilesize(memory_get_peak_usage(true), 4));