Esempio n. 1
0
    $prefix = '';
} else {
    $prefix = "/{$prefix}";
}
$db = get_db_credentials();
do {
    try {
        echo "\nTesting your database connection ... ";
        @Db::get($db);
        $failed = false;
    } catch (Exception $e) {
        //fputs(STDERR, "Failed\n Could not establish a connection to the database.");
        $response = get_response("Failed\nCould not establish a connection to the database. Would you like to provide new credentials", 'yes', array('yes', 'no'), true);
        if ($response == 'yes') {
            echo "Getting new credentials ...\n";
            $db = get_db_credentials();
            $failed = true;
        } else {
            exit;
        }
    }
} while ($failed);
echo "OK";
echo "\nSetting up the configuration files ...\n";
mkdir2($home . 'app');
mkdir2($home . 'app/cache');
mkdir2($home . 'app/cache/code');
mkdir2($home . 'app/cache/menus');
mkdir2($home . 'app/cache/template_compile');
mkdir2($home . 'app/logs');
mkdir2($home . 'app/modules');
Esempio n. 2
0
/**
 * Find out what database is currently in use
 * @return string name of db
 */
function get_database_name()
{
    $conn_name = get_current_db_connection_name();
    $creds = get_db_credentials($conn_name);
    return $creds['db'];
}
Esempio n. 3
0
function get_client_db_connection($client)
{
    $creds = get_db_credentials($client);
    return get_db_connection($creds);
}
Esempio n. 4
0
								 <p><pre>' . rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '</pre>');
            check_environment_must_be_outside_of_web_tree(DB_CREDENTIALS_FILEPATH, 'db credentials xml file', 'Verify that DB_CREDENTIALS_FILEPATH in package_settings.php is correct and points to a readable file outside the web tree');
            check_environment(DISCO_INC . 'disco.php', 'disco include path', 'Verify the path to DISCO_INC in package_settings.php');
            check_environment(TYR_INC . 'tyr.php', 'tyr include path', 'Verify the path to TYR_INC in package_settings.php');
            check_environment(THOR_INC . 'thor.php', 'thor include path ', 'Verify the path to THOR_INC in package_settings.php');
            check_environment(XML_PARSER_INC . 'xmlparser.php', 'xml parser', 'Verify the path to XML_PARSER_INC in package_settings.php');
            check_environment(HTML_PURIFIER_INC . 'htmlpurifier.php', 'html purifier', 'Verify the path to HTML_PURIFIER_INC in package_settings.php');
            check_environment(REASON_INC . 'header.php', 'reason header', 'Verify the path stored in the constant REASON_INC in package_settings.php');
            echo '<h4>Bootstrapping</h4>';
            include_once SETTINGS_INC . 'reason_settings.php';
            if (file_is_included(SETTINGS_INC . 'reason_settings.php')) {
                echo '<p><strong>...loaded reason settings</strong> (' . SETTINGS_INC . 'reason_settings.php' . ')</p>';
            }
            // connect to Reason DB - we do this right here to make sure we can load the reason_db
            include_once CARL_UTIL_INC . 'db/connectDB.php';
            if ($db_info = get_db_credentials(REASON_DB, false)) {
                echo '<p><strong>...loaded db credentials</strong> (the connection name is ' . REASON_DB . ')</p>';
                $db = mysql_connect($db_info['host'], $db_info['user'], $db_info['password']);
                if (empty($db)) {
                    $msg = '<div class="error">';
                    $msg .= '<p>mysql connection ' . REASON_DB . ' check failed</span> - count not connect to server - could be one of the following</p>';
                    $msg .= '<ul>';
                    $msg .= '<li>Improper username and/or password in the db credentials file in ' . SETTINGS_INC . 'dbs.xml</li>';
                    $msg .= '<li>Improper mysql hostname - currently set to ' . $db_info['host'] . '</li>';
                    $msg .= '<li>The user ' . $db_info['user'] . ' needs to have been granted permission to connect to ' . $db_info['host'] . ' from the web server</li>';
                    $msg .= '</ul>';
                    die_with_message($msg);
                } else {
                    echo '<p><strong>...connected to reason_db</strong>';
                    include_once REASON_INC . 'header.php';
                    echo '<p style="color: green;"><strong>...the Reason environment has been loaded.</strong></p>';