source: tags/2.1.5/bin/module_maker/_config.inc.php @ 377

Last change on this file since 377 was 377, checked in by quinn, 14 years ago

Releasing trunk as stable version 2.1.5

File size: 2.6 KB
Line 
1<?php
2/**
3 * The Strangecode Codebase - a general application development framework for PHP
4 * For details visit the project site: <http://trac.strangecode.com/codebase/>
5 * Copyright 2001-2010 Strangecode, LLC
6 *
7 * This file is part of The Strangecode Codebase.
8 *
9 * The Strangecode Codebase is free software: you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your option)
12 * any later version.
13 *
14 * The Strangecode Codebase is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/* module_maker/_config.inc.php */
24
25// Test argument.
26if ($_SERVER['argc'] > 1 && isset($_SERVER['argv'][1]) && '' != $_SERVER['argv'][1] && is_dir($_SERVER['argv'][1])) {
27    // Determine common site directory.
28    $common_base = realpath($_SERVER['argv'][1]);
29   
30    // First arg is path to current site. Realpath removes trailing /s
31    define('COMMON_BASE', $common_base);
32} else {
33    die("Error: First argument must be the directory path to an existing site (ex: /home/sc/www.strangecode.com).\n");
34}
35
36// Make sure necessary files exist.
37if (!file_exists(COMMON_BASE . '/global/db_auth.inc.php')) {
38    die("Error: First argument directory must contain the global/db_auth.inc.php file with valid MySQL credentials.\n");
39}
40
41// Set include path.
42ini_set('include_path', 
43      PATH_SEPARATOR . '/usr/lib/php'
44    . PATH_SEPARATOR . COMMON_BASE
45);
46
47// Include core libraries.
48require_once 'codebase/lib/App.inc.php';
49require_once 'codebase/lib/Utilities.inc.php';
50require_once 'codebase/lib/Auth_SQL.inc.php';
51
52$app =& App::getInstance('module_maker');
53$app->setParam(array(
54    'site_name' => 'Module Maker',
55    'site_email' => 'codebase@strangecode.com',
56    'enable_session' => false,
57    'enable_db' => true,
58    'db_always_debug' => false,
59    'db_debug' => true,
60    'db_die_on_failure' => true,
61    'display_errors' => true,
62    'error_reporting' => E_ALL,
63    'log_screen_priority' => LOG_DEBUG,
64));
65require_once 'global/db_auth.inc.php';
66
67// Start application-based functionality: database, session, environment, ini setup, etc.
68// Most configuration parameters must be set before starting the App.
69$app->start();
70
71// Global DB object. Automatically pre-configured by $app->start().
72$db =& DB::getInstance();
73
74
75?>
Note: See TracBrowser for help on using the repository browser.