summaryrefslogtreecommitdiffstats
path: root/lib/class/update.class.php
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-01-28 20:52:59 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-01-28 21:46:00 -0500
commit1b4fe6a2b1204a894e662745d13f21ab15650d47 (patch)
tree749787b8f0a383d7d0ca5d83b9ed1d7e4768cff1 /lib/class/update.class.php
parent101f4a047ab7a5cb0c00f6a34959fb5edda8aa4c (diff)
downloadampache-1b4fe6a2b1204a894e662745d13f21ab15650d47.tar.gz
ampache-1b4fe6a2b1204a894e662745d13f21ab15650d47.tar.bz2
ampache-1b4fe6a2b1204a894e662745d13f21ab15650d47.zip
Drop unnecessary updates
We only claim to support updates from 3.3.3.5, and that tarball has 340002.
Diffstat (limited to 'lib/class/update.class.php')
-rw-r--r--lib/class/update.class.php221
1 files changed, 2 insertions, 219 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 97e6d4cc..6f0fd8eb 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -414,7 +414,7 @@ class Update {
// Run a check to make sure that they don't try to upgrade from a version that
// won't work.
- if ($current_version < '340001') {
+ if ($current_version < '340002') {
echo "<p align=\"center\">Database version too old, please upgrade to <a href=\"http://ampache.org/downloads/ampache-3.3.3.5.tar.gz\">Ampache-3.3.3.5</a> first</p>";
return false;
}
@@ -465,225 +465,8 @@ class Update {
* and plugins
*/
private static function set_version($key, $value) {
-
$sql = "UPDATE update_info SET value='$value' WHERE `key`='$key'";
- $db_results = Dba::write($sql);
-
- }
-
- /**
- * update_340001
- * This update moves back to the ID for user UID and
- * adds date to the user_vote so that it can be sorted
- * correctly
- */
- private function update_340001() {
-
- $retval = true;
- // Build the User -> ID map using the username as the key
- $sql = "SELECT `id`,`username` FROM `user`";
- $db_results = Dba::read($sql);
-
- $user_array = array();
-
- while ($r = Dba::fetch_assoc($db_results)) {
- $username = $r['username'];
- $user_array[$username] = Dba::escape($r['id']);
- } // end while
-
- // Alter the user table so that you can't have an ID beyond the
- // range of the other tables which have to allow for -1
- $sql = "ALTER TABLE `user` CHANGE `id` `id` INT ( 11 ) NOT NULL AUTO_INCREMENT";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now pull the access list users, alter table and then re-insert
- $sql = "SELECT DISTINCT(`user`) FROM `access_list`";
- $db_results = Dba::read($sql);
-
- while ($r = Dba::fetch_assoc($db_results)) {
- // Build the new SQL
- $username = $r['user'];
- $user_id = $user_array[$username];
- $username = Dba::escape($username);
-
- $sql = "UPDATE `access_list` SET `user`='$user_id' WHERE `user`='$username'";
- $retval = Dba::write($sql) ? $retval : false;
-
- } // end while access_list
-
- // Alter the table
- $sql = "ALTER TABLE `access_list` CHANGE `user` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now pull flagged users, update and alter
- $sql = "SELECT DISTINCT(`user`) FROM `flagged`";
- $db_results = Dba::read($sql);
-
- while ($r = Dba::fetch_assoc($db_results)) {
- $username = $r['user'];
- $user_id = $user_array[$username];
- $username = Dba::escape($username);
-
- $sql = "UPDATE `flagged` SET `user`='$user_id' WHERE `user`='$username'";
- $retval = Dba::write($sql) ? $retval : false;
- } // end while
-
- // Alter the table
- $sql = "ALTER TABLE `flagged` CHANGE `user` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now fix up the ip history
- $sql = "SELECT DISTINCT(`user`) FROM `ip_history`";
- $db_results = Dba::read($sql);
-
- while ($r = Dba::fetch_assoc($db_results)) {
- $username = $r['user'];
- $user_id = $user_array[$username];
- $username = Dba::escape($username);
-
- $sql = "UPDATE `ip_history` SET `user`='$user_id' WHERE `user`='$username'";
- $retval = Dba::write($sql) ? $retval : false;
- } // end while
-
- // Alter the table
- $sql = "ALTER TABLE `ip_history` CHANGE `user` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now fix now playing
- $sql = "SELECT DISTINCT(`user`) FROM `now_playing`";
- $db_results = Dba::read($sql);
-
- while ($r = Dba::fetch_assoc($db_results)) {
- $username = $r['user'];
- $user_id = $user_array[$username];
- $username = Dba::escape($username);
-
- $sql = "UPDATE `now_playing` SET `user`='$user_id' WHERE `user`='$username'";
- $retval = Dba::write($sql) ? $retval : false;
- } // end while
-
- // Alter the table
- $sql = "ALTER TABLE `now_playing` CHANGE `user` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now fix the playlist table
- $sql = "SELECT DISTINCT(`user`) FROM `playlist`";
- $db_results = Dba::read($sql);
-
- while ($r = Dba::fetch_assoc($db_results)) {
- $username = $r['user'];
- $user_id = $user_array[$username];
- $username = Dba::escape($username);
-
- $sql = "UPDATE `playlist` SET `user`='$user_id' WHERE `user`='$username'";
- $retval = Dba::write($sql) ? $retval : false;
- } // end while
-
- // Alter the table
- $sql = "ALTER TABLE `playlist` CHANGE `user` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Drop unused table
- $sql = "DROP TABLE `playlist_permission`";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now fix the ratings table
- $sql = "SELECT DISTINCT(`user`) FROM `ratings`";
- $db_results = Dba::read($sql);
-
- while ($r = Dba::fetch_assoc($db_results)) {
- $username = $r['user'];
- $user_id = $user_array[$username];
- $username = Dba::escape($username);
-
- $sql = "UPDATE `ratings` SET `user`='$user_id' WHERE `user`='$username'";
- $retval = Dba::write($sql) ? $retval : false;
- } // end while
-
- $sql = "ALTER TABLE `ratings` CHANGE `user` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now work on the tag_map
- $sql = "ALTER TABLE `tag_map` CHANGE `user_id` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Now fix user preferences
- $sql = "SELECT DISTINCT(`user`) FROM `user_preference`";
- $db_results = Dba::read($sql);
-
- while ($r = Dba::fetch_assoc($db_results)) {
- $username = $r['user'];
- $user_id = $user_array[$username];
- $username = Dba::escape($username);
-
- $sql = "UPDATE `user_preference` SET `user`='$user_id' WHERE `user`='$username'";
- $retval = Dba::write($sql) ? $retval : false;
- } // end while
-
- // Alter the table
- $sql = "ALTER TABLE `user_preference` CHANGE `user` `user` INT ( 11 ) NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Add a date to the user_vote
- $sql = "ALTER TABLE `user_vote` ADD `date` INT( 11 ) UNSIGNED NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Add the index for said field
- $sql = "ALTER TABLE `user_vote` ADD INDEX(`date`)";
- $retval = Dba::write($sql) ? $retval : false;
-
- $sql = "ALTER TABLE `album` ADD `thumb` TINYBLOB NULL ,ADD `thumb_mime`
- VARCHAR( 128 ) NULL";
- $db_results = Dba::write($sql);
-
- // Now add in the min_object_count preference and the random_method
- $sql = "INSERT INTO `preferences` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
- "VALUES('min_object_count','1','Min Element Count','5','integer','interface')";
- $retval = Dba::write($sql) ? $retval : false;
-
- $sql = "INSERT INTO `preferences` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
- "VALUES('random_method','default','Random Method','5','string','interface')";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Delete old preference
- $sql = "DELETE FROM `preferences` WHERE `name`='min_album_size'";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Make Hash a non-required field and smaller
- $sql = "ALTER TABLE `song` CHANGE `hash` `hash` VARCHAR ( 64 ) NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Make user access an int, nothing else
- $sql = "UPDATE `user` SET `access`='100' WHERE `access`='admin'";
- $retval = Dba::write($sql) ? $retval : false;
-
- $sql = "UPDATE `user` SET `access`='25' WHERE `access`='user'";
- $retval = Dba::write($sql) ? $retval : false;
-
- $sql = "UPDATE `user` SET `access`='5' WHERE `access`='guest'";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Alter the table
- $sql = "ALTER TABLE `user` CHANGE `access` `access` TINYINT ( 4 ) UNSIGNED NOT NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- // Add in Label and Catalog # and language
- $sql = "ALTER TABLE `song_ext_data` ADD `label` VARCHAR ( 128 ) NULL, ADD `catalog_number` VARCHAR ( 128 ) NULL, ADD `language` VARCHAR ( 128 ) NULL";
- $retval = Dba::write($sql) ? $retval : false;
-
- return $retval;
- } //update_340001
-
- /**
- * update_340002
- * This update tweaks the preferences a little more and make sure that the
- * min_object_count has a rational value
- */
- private function update_340002() {
- /* Add the offset_limit preference and remove it from the user table */
- $sql = "INSERT INTO `preferences` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
- "VALUES ('offset_limit','50','Offset Limit','5','integer','interface')";
- return Dba::write($sql);
+ Dba::write($sql);
}
/**