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

Last change on this file since 247 was 238, checked in by quinn, 17 years ago

Q - added upgrade_v1-to-v2.mysql SQL upgrade script.

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