<commit_before><?php

/**
 * Database connections module.
 *
 * @category Asymptix PHP Framework
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2009 - 2015, <NAME>
 * @license http://opensource.org/licenses/MIT
 */

$mysqli = new mysqli(
        Config::getDBConfigParam('HOST'),
        Config::getDBConfigParam('USER'), Config::getDBConfigParam('PASSWORD'),
        Config::getDBConfigParam('DBNAME'));
if ($mysqli->connect_error) {
    die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
} else {
    //change character set to utf8
    if (!$mysqli->set_charset(Config::DB_CHARSET)) {
        printf("Error loading character set " . Config::DB_CHARSET . ": %s\n", $mysqli->error);
    } else {
        //printf("Current character set: %s\n", $mysqli->character_set_name());
    }

    $manager = DBCore::getInstance();

    DBCore::connection($mysqli);
    //$manager->setCurrentConnection('first');
}

// Register a shutdown function which will close DB connection
function onExit() {
    global $manager;
    $conns = $manager->getConnections();
    foreach ($conns as $connName => $connResource) { // TODO: without name
        $manager->closeConnection($connResource);
    }
}
register_shutdown_function("onExit");


?><commit_msg>Database connection module cosmetic changes.<commit_after><?php

/**
 * Database connections module.
 *
 * @category Asymptix PHP Framework
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2009 - 2015, <NAME>
 * @license http://opensource.org/licenses/MIT
 */

$mysqli = new mysqli(
        Config::getDBConfigParam('HOST'),
        Config::getDBConfigParam('USER'), Config::getDBConfigParam('PASSWORD'),
        Config::getDBConfigParam('DBNAME'));
if ($mysqli->connect_error) {
    die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);
} else {
    if (!$mysqli->set_charset(Config::DB_CHARSET)) {
        printf("Error loading character set " . Config::DB_CHARSET . ": %s\n", $mysqli->error);
    }

    $manager = DBCore::getInstance();

    DBCore::connection($mysqli);
    //$manager->setCurrentConnection('first');
}

// Register a shutdown function which will close DB connection
function onExit() {
    global $manager;
    $conns = $manager->getConnections();
    foreach ($conns as $connName => $connResource) { // TODO: without name
        $manager->closeConnection($connResource);
    }
}
register_shutdown_function("onExit");

?>
{'fraction_non_alphanumeric': 0.16721446179129007, 'fraction_numerical': 0.006984387838948234, 'mean_word_length': 3.909274193548387, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6589771', 'n_tokens_mistral': 772, 'n_tokens_neox': 743, 'n_words': 155}