Created a new variable in config.php and settings.php for the SQLite file

This commit is contained in:
David 2012-12-20 16:12:12 +01:00
parent 982b704f69
commit 0e53c7a7c1
2 changed files with 4 additions and 5 deletions

View File

@ -146,7 +146,7 @@ function write_config_file($dbt, $dbh, $dbn, $dbu, $dbp) {
$cfg_content .= " // Database connection credentials\n"; $cfg_content .= " // Database connection credentials\n";
$cfg_content .= " // \n"; $cfg_content .= " // \n";
$cfg_content .= " define(\"SQLITE_FILE\", \"weave_db\");\n";
if ( $dbt != "mysql" ) { if ( $dbt != "mysql" ) {
$cfg_content .= " define(\"MYSQL_ENABLE\", false);\n"; $cfg_content .= " define(\"MYSQL_ENABLE\", false);\n";
$cfg_content .= " define(\"MYSQL_HOST\", \"localhost\");\n"; $cfg_content .= " define(\"MYSQL_HOST\", \"localhost\");\n";
@ -229,7 +229,7 @@ function print_mysql_connection_form() {
// check if we have no configuration at the moment // check if we have no configuration at the moment
// //
if ( file_exists("settings.php") && filesize( "settings.php" ) > 0 ) { if ( file_exists("settings.php") && filesize( "settings.php" ) > 0 ) {
echo "<hr><h2>The setup looks like it's completed, else please delete settings.php</h2><hr>"; echo "<hr><h2>The setup looks like it's completed, please delete settings.php</h2><hr>";
exit; exit;
} }
@ -319,8 +319,7 @@ if ( $action == "step2" ) {
if ( file_exists($db_name) && filesize( $db_name ) > 0 ) { if ( file_exists($db_name) && filesize( $db_name ) > 0 ) {
$dbInstalled = true; $dbInstalled = true;
} else { } else {
// echo("Creating sqlite weave storage: DBname". $db_name ." | username: ". $username); echo("Creating sqlite weave storage: ". $db_name ."<br>");
// echo("<br>");
$dbHandle = new PDO('sqlite:' . $db_name); $dbHandle = new PDO('sqlite:' . $db_name);
$dbHandle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbHandle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} }

View File

@ -58,7 +58,7 @@ class WeaveStorage
if ( ! MYSQL_ENABLE ) if ( ! MYSQL_ENABLE )
{ {
$path = explode('/', $_SERVER['SCRIPT_FILENAME']); $path = explode('/', $_SERVER['SCRIPT_FILENAME']);
$db_name = 'weave_db'; $db_name = SQLITE_FILE;
array_pop($path); array_pop($path);
array_push($path, $db_name); array_push($path, $db_name);
$db_name = implode('/', $path); $db_name = implode('/', $path);