示例#1
0
add_include_path(__DIR__ . "/lib", false);
// Load the applications configuration file and define the home
require "app/config.php";
define("SOFTWARE_HOME", $config['home']);
// Add the script which contains the third party libraries
require "app/includes.php";
// Setup the global variables needed by the redirected packages
global $redirectedPackage;
global $packageSchema;
$selected = getenv('CFX_SELECTED_DATABASE') !== false ? getenv('CFX_SELECTED_DATABASE') : $selected;
// Setup the database driver and other boilerplate stuff
$dbDriver = $config['db'][$selected]['driver'];
$dbDriverClass = Application::camelize($dbDriver);
add_include_path(Application::getWyfHome("models/datastores/databases/{$dbDriver}"));
Db::$defaultDatabase = $selected;
SQLDBDataStore::$activeDriverClass = $dbDriverClass;
Application::$config = $config;
Application::$prefix = $config['prefix'];
Cache::init($config['cache']['method']);
define('CACHE_MODELS', $config['cache']['models']);
define('CACHE_PREFIX', "");
define('ENABLE_AUDIT_TRAILS', $config['audit_trails']);
if (Application::$config['custom_sessions']) {
    $handler = Sessions::getHandler();
    session_set_save_handler(array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
    register_shutdown_function('session_write_close');
}
session_start();
// Load the styleseets and the javascripts
// Bootstrap the application
require SOFTWARE_HOME . "app/bootstrap.php";