Permalink
Browse files

Installer: removing the requirement to have the database config writa…

…ble in the installer
  • Loading branch information...
1 parent 81a1ec3 commit 9ca8e6c25995293f3af823cea373f9112c8a749d @seandowney seandowney committed Dec 14, 2011
Showing with 10 additions and 4 deletions.
  1. +9 −3 install/controllers/install.php
  2. +1 −1 install/helpers/config_file_helper.php
@@ -301,20 +301,26 @@ private function setup()
if (is_writeable(FCPATH . $this->bonfire_app_path . 'config/'))
{
// Database
- copy(APPPATH . 'config/database.php', FCPATH . $this->bonfire_app_path . 'config/development/database.php');
- copy(APPPATH . 'config/database.php', FCPATH . $this->bonfire_app_path . 'config/production/database.php');
- copy(APPPATH . 'config/database.php', FCPATH . $this->bonfire_app_path . 'config/testing/database.php');
+ copy(FCPATH . $this->bonfire_app_path . 'config/database.php', FCPATH . $this->bonfire_app_path . 'config/development/database.php');
+ copy(FCPATH . $this->bonfire_app_path . 'config/database.php', FCPATH . $this->bonfire_app_path . 'config/production/database.php');
+ copy(FCPATH . $this->bonfire_app_path . 'config/database.php', FCPATH . $this->bonfire_app_path . 'config/testing/database.php');
}
$server = $data['main']['hostname'];
$username = $data['main']['username'];
$password = $data['main']['password'];
+ $database = $data['main']['database'];
+ $dbprefix = $data['main']['dbprefix'];
if( !$this->db = mysql_connect($server, $username, $password) )
{
return array('status' => FALSE,'message' => 'The installer could not connect to the MySQL server or the database, be sure to enter the correct information.');
}
+ // use the entered Database settings to connect before calling the Migrations
+ $dsn = 'mysql://'.$username.':'.$password.'@'.$server.'/'.$database.'?dbprefix='.$dbprefix;
+ $this->load->database($dsn);
+
//
// Now install the database tables.
//
@@ -426,7 +426,7 @@ function write_db_config($settings=null)
$CI->load->helper('file');;
// Write the changes out...
- $result = write_file(APPPATH.'config/'.$env .'database'.EXT, $contents);
+ $result = write_file(APPPATH.'../bonfire/application/config/'.$env .'database'.EXT, $contents);
}
}

0 comments on commit 9ca8e6c

Please sign in to comment.