diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-17 05:47:07 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-03-17 05:47:07 +0000 |
commit | 0a401c7ca475c0e65bbdd9212f1b6a439239c94e (patch) | |
tree | 4b10e4a0e212d82fd0d4e01af4a0bb438ca9794e /lib | |
parent | 629efec5fa1a55f9284fa8acdc3333b442e9635e (diff) | |
download | ampache-0a401c7ca475c0e65bbdd9212f1b6a439239c94e.tar.gz ampache-0a401c7ca475c0e65bbdd9212f1b6a439239c94e.tar.bz2 ampache-0a401c7ca475c0e65bbdd9212f1b6a439239c94e.zip |
updated sql files, tweak to the update and installers to make it more utf-8ish hopefully final commit before release
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/update.class.php | 22 | ||||
-rw-r--r-- | lib/init.php | 4 | ||||
-rw-r--r-- | lib/install.php | 14 |
3 files changed, 32 insertions, 8 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 7127f1d5..291c26e8 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -1143,9 +1143,29 @@ class Update { $sql = "ALTER TABLE `playlist` ADD `date` INT ( 11 ) UNSIGNED NOT NULL"; $db_results = Dba::query($sql); - $sql = "ALTER TABLE `rating` CHANGE `rating` TINYINT ( 4 ) NOT NULL"; + // Pull all of the rating information + $sql = "SELECT `id`,`rating` FROM `rating`"; $db_results = Dba::query($sql); + $results = array(); + + while ($row = Dba::fetch_assoc($db_results)) { + $results[] = $row; + } + + $sql = "ALTER TABLE `rating` DROP `rating`"; + $db_results = Dba::query($sql); + + $sql = "ALTER TABLE `rating` ADD `rating` TINYINT ( 4 ) NOT NULL"; + $db_results = Dba::query($sql); + + foreach ($results as $row) { + $rating = Dba::escape($row['rating']); + $id = Dba::escape($row['id']); + $sql = "UPDATE `rating` SET `rating`='$rating' WHERE `id`='$id'"; + $db_results = Dba::query($sql); + } + self::set_version('db_version','340015'); } // update_340015 diff --git a/lib/init.php b/lib/init.php index 5fe7448e..7b259dcb 100644 --- a/lib/init.php +++ b/lib/init.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) 2001 - 2008 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -81,7 +81,7 @@ if (!count($results)) { } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.4-Beta2 Build (003)'; +$results['version'] = '3.4-Beta2'; $results['int_config_version'] = '6'; $results['raw_web_path'] = $results['web_path']; diff --git a/lib/install.php b/lib/install.php index d901e508..838da84f 100644 --- a/lib/install.php +++ b/lib/install.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) 2001 - 2008 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -153,12 +153,11 @@ 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); + $sql = "SELECT VERSION()"; + $db_results = mysql_query($sql,$dbh); - $data = mysql_fetch_assoc($db_results,$dbh); + $data = mysql_fetch_row($db_results); $mysql_version = substr(preg_replace("/(\d+)\.(\d+)\.(\d+).*/","$1$2$3",$data[0]),0,3); - $sql_file = ($mysql_version < '500') ? 'sql/ampache40.sql' : 'sql/ampache.sql'; /* Attempt to insert database */ @@ -175,6 +174,11 @@ function install_insert_db($username,$password,$hostname,$database) { } // end if } // end for + if ($mysql_version >= '500') { + $sql = "ALTER DATABASE `" . Dba::escape($database) . "` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + $db_results = mysql_query($sql); + } + return true; } // install_insert_db |