source: trunk/bin/module_maker/_config.inc.php @ 151

Last change on this file since 151 was 151, checked in by scdev, 18 years ago

Q - Changed one more SessionCache? -> Cache, small bug fixt to Prefs, added operation help to modulemaker scripts.

File size: 1.8 KB
Line 
1<?php
2/* module_maker/_config.inc.php
3 * code by strangecode :: www.strangecode.com :: this document contains copyrighted information. */
4
5// Test argument.
6if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
7    // Determine common site directory.
8    $common_base = realpath($_SERVER['argv'][1]);
9   
10    // First arg is path to current site. Realpath removes trailing /s
11    define('COMMON_BASE', $common_base);
12} else {
13    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
14}
15
16// Make sure necessary files exist.
17if (!file_exists(COMMON_BASE . '/global/db_auth.inc.php')) {
18    die("Error: First argument directory must contain the global/db_auth.inc.php file with valid MySQL credentials.\n");
19}
20
21// Set include path.
22ini_set('include_path', get_include_path()
23    . PATH_SEPARATOR . COMMON_BASE
24);
25
26// Include core libraries.
27require_once 'codebase/lib/App.inc.php';
28require_once 'codebase/lib/Utilities.inc.php';
29require_once 'codebase/lib/Auth_SQL.inc.php';
30
31$app =& App::getInstance('module_maker');
32$app->setParam(array(
33    'site_name' => 'Module Maker',
34    'site_email' => 'codebase@strangecode.com',
35    'enable_session' => false,
36    'enable_db' => true,
37    'db_always_debug' => false,
38    'db_debug' => true,
39    'db_die_on_failure' => true,
40    'display_errors' => true,
41    'error_reporting' => E_ALL,
42    'log_screen_priority' => LOG_DEBUG,
43));
44require_once 'global/db_auth.inc.php';
45
46// Start application-based functionality: database, session, environment, ini setup, etc.
47// Most configuration parameters must be set before starting the App.
48$app->start();
49
50// Global DB object. Automatically preconfigured by $app->start().
51$db =& DB::getInstance();
52
53
54?>
Note: See TracBrowser for help on using the repository browser.