diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-05-13 21:37:49 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-05-13 21:37:49 +0000 |
commit | 779f4bf4e560d7f415ea51a96ed547831745a8dc (patch) | |
tree | c99f06687da016d975b3e131ff2d57a8b68da0dd /lib/debug.lib.php | |
parent | 1a6ae62569dbc5603a361a488641950cc317ac3d (diff) | |
download | ampache-779f4bf4e560d7f415ea51a96ed547831745a8dc.tar.gz ampache-779f4bf4e560d7f415ea51a96ed547831745a8dc.tar.bz2 ampache-779f4bf4e560d7f415ea51a96ed547831745a8dc.zip |
updated sql file, and the install process now works
Diffstat (limited to 'lib/debug.lib.php')
-rw-r--r-- | lib/debug.lib.php | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/lib/debug.lib.php b/lib/debug.lib.php index 69825c68..9f7f1c59 100644 --- a/lib/debug.lib.php +++ b/lib/debug.lib.php @@ -143,11 +143,10 @@ function check_php_pcre() { } // check_php_pcre -/*! - @function check_config_values() - @discussion checks to make sure that they have at - least set the needed variables -*/ +/** + * check_config_values + * checks to make sure that they have at least set the needed variables + */ function check_config_values($conf) { if (!$conf['database_hostname']) { @@ -211,4 +210,50 @@ function check_putenv() { } // check_putenv +/** + * generate_config + * This takes an array of results and re-generates the config file + * this is used by the installer and by the admin/system page + */ +function generate_config($current) { + + /* Start building the new config file */ + $distfile = Config::get('prefix') . '/config/ampache.cfg.php.dist'; + $handle = fopen($distfile,'r'); + $dist = fread($handle,filesize($distfile)); + fclose($handle); + + $data = explode("\n",$dist); + + /* Run throught the lines and set our settings */ + foreach ($data as $line) { + + /* Attempt to pull out Key */ + if (preg_match("/^;?([\w\d]+)\s+=\s+[\"]{1}(.*?)[\"]{1}$/",$line,$matches) + || preg_match("/^;?([\w\d]+)\s+=\s+[\']{1}(.*?)[\']{1}$/", $line, $matches) + || preg_match("/^;?([\w\d]+)\s+=\s+[\'\"]{0}(.*)[\'\"]{0}$/",$line,$matches)) { + + $key = $matches[1]; + $value = $matches[2]; + + /* Put in the current value */ + if (isset($current[$key]) AND $key != 'config_version') { + $line = $key . ' = "' . $current[$key] . '"'; + unset($current[$key]); + } // if set + + elseif (isset($array_value[$key])) { + $line = ''; + } + + } // if key + + $final .= $line . "\n"; + + } // end foreach line + + return $final; + +} // generate_config + ?> |