1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) { // Determine common site directory. $common_base = realpath($_SERVER['argv'][1]); // First arg is path to current site. Realpath removes trailing /s define('COMMON_BASE', $common_base); } else { die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n"); } // Make sure necessary files exist. if (!file_exists(COMMON_BASE . '/global/db_auth.inc.php')) { die("Error: First argument directory must contain the global/db_auth.inc.php file with valid MySQL credentials.\n"); } // Set include path. ini_set('include_path', PATH_SEPARATOR . '/usr/lib/php' . PATH_SEPARATOR . COMMON_BASE ); // Include core libraries. require_once 'codebase/lib/App.inc.php'; require_once 'codebase/lib/Utilities.inc.php'; require_once 'codebase/lib/Auth_SQL.inc.php'; $app =& App::getInstance('module_maker'); $app->setParam(array( 'site_name' => 'Module Maker', 'site_email' => 'codebase@strangecode.com', 'enable_session' => false, 'enable_db' => true, 'db_always_debug' => false, 'db_debug' => true, 'db_die_on_failure' => true, 'display_errors' => true, 'error_reporting' => E_ALL, 'log_screen_priority' => LOG_DEBUG, )); require_once 'global/db_auth.inc.php'; // Start application-based functionality: database, session, environment, ini setup, etc. // Most configuration parameters must be set before starting the App. $app->start(); // Global DB object. Automatically preconfigured by $app->start(). $db =& DB::getInstance(); ?>