diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-24 02:08:59 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-24 02:08:59 +0000 |
commit | a597432c7698c54c66810442a682183d670f9a4a (patch) | |
tree | 6dddc14e02587cdfc45524dc0b362a1f035c8cf7 /lib | |
parent | 34b92d2dd5da0298f9d27a230ca3ffa2da061d36 (diff) | |
download | ampache-a597432c7698c54c66810442a682183d670f9a4a.tar.gz ampache-a597432c7698c54c66810442a682183d670f9a4a.tar.bz2 ampache-a597432c7698c54c66810442a682183d670f9a4a.zip |
fixed a problem with the dump that caused it not to work with MySQL 4.x
Diffstat (limited to 'lib')
-rw-r--r-- | lib/install.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/install.php b/lib/install.php index a5f7032b..3afd8aee 100644 --- a/lib/install.php +++ b/lib/install.php @@ -152,8 +152,17 @@ function install_insert_db($username,$password,$hostname,$database) { } } // end if we are creating a user + // Figure out which version of MySQL we're running, if possible we want to use the UTF-8 dump + $sql = "SELECT version()"; + $db_results = @mysql_query($sql,$dbh); + + $data = mysql_fetch_assoc($db_results,$dbh); + $mysql_version = substr(preg_replace("/(\d+)\.(\d+)\.(\d+).*/","$1$2$3",$version[0]),0,3); + + $sql_file = ($mysql_version < '500') ? 'sql/ampache40.sql' : 'sql/ampache.sql'; + /* Attempt to insert database */ - $query = fread(fopen("sql/ampache.sql", "r"), filesize("sql/ampache.sql")); + $query = fread(fopen($sql_file, "r"), filesize($sql_file)); $pieces = split_sql($query); for ($i=0; $i<count($pieces); $i++) { $pieces[$i] = trim($pieces[$i]); |