Changeset 549 for branches/1.1dev/config


Ignore:
Timestamp:
Oct 2, 2015 9:02:39 PM (9 years ago)
Author:
anonymous
Message:

Backporting minor debugging niceites.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/config/boot.inc.php

    r423 r549  
    2323    define('SITE_BASE', '__NO_SITE_BASE__');
    2424}
    25  
     25
    2626/******************************************************************************
    2727 * INCLUDE GLOBAL LIBRARIES AND CONFIGURATIONS
     
    5757    // MySQL connection parameters.
    5858    if (!empty($_SERVER['DB_NAME']) && !empty($_SERVER['DB_USER']) && !empty($_SERVER['DB_PASS'])) {
    59         // We set DB passwords as environment variables in the httpd.conf file, 
     59        // We set DB passwords as environment variables in the httpd.conf file,
    6060        // which is readable only by root.
    6161        $CFG->database = $_SERVER['DB_NAME'];
     
    7070        include SITE_BASE . '/../config/db_auth.inc.php';
    7171    }
    72    
     72
    7373    if (empty($CFG->database) || empty($CFG->username) || !isset($CFG->password)) { // Allow password to be empty string.
    7474        logMsg('Database credentials missing.', LOG_WARNING, __FILE__, __LINE__);
    7575    }
    76    
     76
    7777    // Connect to MySQL
    7878    if ($dbh = mysql_connect('localhost', $CFG->username, $CFG->password)) {
    7979        // Select database
    80         mysql_select_db($CFG->database, $dbh);       
     80        mysql_select_db($CFG->database, $dbh);
    8181    }
    8282
     
    104104    {
    105105        global $CFG, $dbh;
    106        
     106
    107107        $debugqry = preg_replace("/\n[\t ]+/", "\n", $query);
    108108        if ($CFG->db_always_debug || $debug) {
     109            logMsg($debugqry, LOG_DEBUG, __FILE__, __LINE__);
    109110            echo "<!-- --------------------------------------\n" . $debugqry . "\n-->";
    110111        }
    111        
    112         // Ensure we have an active connection. 
     112
     113        // Ensure we have an active connection.
    113114        // If we continue on a dead connection we might experience a "MySQL server has gone away" error.
    114115        // http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
     
    118119            mysql_close($dbh);
    119120            if ($dbh = mysql_connect('localhost', $CFG->username, $CFG->password)) {
    120                 mysql_select_db($CFG->database, $dbh);       
     121                mysql_select_db($CFG->database, $dbh);
    121122            }
    122123            if (!$dbh || mysql_error($dbh)) {
     
    149150        return $qid;
    150151    }
    151    
     152
    152153    $mysql_character_sets = array(
    153154        'utf-8' => 'utf8',
    154155        'iso-8859-1' => 'latin1',
    155156    );
    156    
     157
    157158    // Tell MySQL what character set we're useing. Available only on MySQL verions > 4.01.01.
    158159    if ('' != $CFG->character_set && isset($mysql_character_sets[strtolower($CFG->character_set)])) {
     
    168169 *****************************************************************************/
    169170
    170  
     171
    171172// Skip sessions for some scripts, like the cron executed scripts.
    172173if (true === $CFG->enable_session) { //________________________________________
     
    177178        session_id($ses);
    178179    }
    179    
     180
    180181    // Session parameters.
    181182    ini_set('session.use_cookies', $CFG->session_use_cookies);
     
    197198        session_set_save_handler('mysqlSessionOpen', 'mysqlSessionClose', 'mysqlSessionRead', 'mysqlSessionWrite', 'mysqlSessionDestroy', 'mysqlSessionGarbage');
    198199    }
    199    
     200
    200201    // Start the session. Access session data using: $_SESSION['...']
    201202    session_start();
     
    209210//     if (getGet(session_name())) {
    210211//         logMsg(sprintf('Found session in get: %s=%s', session_name(), getGet(session_name())), LOG_DEBUG, __FILE__, __LINE__);
    211 //     }   
     212//     }
    212213//     logMsg(sprintf('Using session %s=%s', session_name(), session_id()), LOG_DEBUG, __FILE__, __LINE__);
    213    
     214
    214215
    215216    /******************************************************************************
    216217     * LANGUAGE
    217218     *****************************************************************************/
    218            
     219
    219220    // Set the language.
    220221    if ($lang = getFormData('lang')) {
     
    269270    header('X-Codebase-Version: ' . $CFG->codebase_version);
    270271}
    271  
     272
    272273// Capture the ultimate referrer. Used? Not yet.
    273274if (!isset($_SESSION['_ultimate_referrer'])) {
     
    279280$inc_lang = isset($_SESSION['_language']) ? $_SESSION['_language'] : 'en';
    280281ini_set('include_path',
    281     ini_get('include_path') . PATH_SEPARATOR . 
     282    ini_get('include_path') . PATH_SEPARATOR .
    282283    SITE_BASE . '/_templates/' . $inc_lang . PATH_SEPARATOR .
    283284    CODE_BASE . '/templates/' . $inc_lang . PATH_SEPARATOR .
    284    
     285
    285286    SITE_BASE . '/_templates/en' . PATH_SEPARATOR .
    286287    CODE_BASE . '/templates/en' . PATH_SEPARATOR .
    287    
     288
    288289    SITE_BASE . '/_templates' . PATH_SEPARATOR .
    289290    CODE_BASE . '/templates'
Note: See TracChangeset for help on using the changeset viewer.