diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2010-02-20 19:42:20 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2010-02-20 19:42:20 +0000 |
commit | b5ee2c9a04ff0ea9dae1b4647d3a9a314b87dcba (patch) | |
tree | ebef5b0a98c5531c2d4f3299c7752cd034503fc8 /lib/install.php | |
parent | e88a5c3b3951be00f7d60c1bd122e859a0a17f26 (diff) | |
download | ampache-b5ee2c9a04ff0ea9dae1b4647d3a9a314b87dcba.tar.gz ampache-b5ee2c9a04ff0ea9dae1b4647d3a9a314b87dcba.tar.bz2 ampache-b5ee2c9a04ff0ea9dae1b4647d3a9a314b87dcba.zip |
adjusted installer lib to write the config file directly, need to update documentation to reflect it
Diffstat (limited to 'lib/install.php')
-rw-r--r-- | lib/install.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/install.php b/lib/install.php index 1afea5a7..0746b062 100644 --- a/lib/install.php +++ b/lib/install.php @@ -234,6 +234,15 @@ function install_insert_db($username,$password,$hostname,$database,$dbuser=false */ function install_create_config($web_path,$username,$password,$hostname,$database) { + $config_file = Config::get('prefix') . '/config/ampache.cfg.php'; + + // Make sure it's writeable + if (!is_writeable($config_file)) { + /* HINT: Config File */ + Error::add('general',sprintf(_('%s is not writeable'),$config_file)); + return false; + } + $data['database_username'] = $username; $data['database_password'] = $password; $data['database_hostname'] = $hostname; @@ -261,10 +270,15 @@ function install_create_config($web_path,$username,$password,$hostname,$database $final = generate_config($data); - $browser = new Browser(); - $browser->downloadHeaders('ampache.cfg.php','text/plain',false,filesize('config/ampache.cfg.php.dist')); - echo $final; - exit(); + // Open the file and try to write it + $fhandle = fopen($config_file,'w'); + if (!fwrite($fhandle,$final)) { + Error::add('general',"Error Writing config file"); + fclose ($fhandle); + return false; + } + fclose ($fhandle); + return true; |