summaryrefslogtreecommitdiffstats
path: root/lib/class/update.class.php
diff options
context:
space:
mode:
authorPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-05-05 01:43:51 +0000
committerPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-05-05 01:43:51 +0000
commite3e4c7246686ff44b84f7d4d48b205c6f780dde4 (patch)
treeca880eef0f820cd04385dc6cf92512d98d1b26ee /lib/class/update.class.php
parenta7e1258587ecdc51923a5acb48887b9b4b96efcd (diff)
downloadampache-e3e4c7246686ff44b84f7d4d48b205c6f780dde4.tar.gz
ampache-e3e4c7246686ff44b84f7d4d48b205c6f780dde4.tar.bz2
ampache-e3e4c7246686ff44b84f7d4d48b205c6f780dde4.zip
Art work. Rationalise DB schema, support multiple thumbnail sizes and
caching thereof, call Catalog->gather_art instead of Catalog->gather_album_art, unbreak (hopefully) gather_musicbrainz.
Diffstat (limited to 'lib/class/update.class.php')
-rw-r--r--lib/class/update.class.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index 2fa2bb30..b54def3e 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -337,6 +337,9 @@ class Update {
$version[] = array('version'=>'360002','description'=>$update_string);
+ $update_string = '- Add image table to store images.<br />' .
+ '- Drop album_data and artist_data.<br />';
+ $version[] = array('version'=>'360003','description'=>$update_string);
return $version;
@@ -1871,6 +1874,64 @@ class Update {
} // update_360002
+ /**
+ * update_360003
+ * This update moves the image data to its own table.
+ */
+ public static function update_360003() {
+ $sql = "CREATE TABLE `image` (" .
+ "`id` int(11) unsigned NOT NULL auto_increment," .
+ "`image` mediumblob NOT NULL," .
+ "`mime` varchar(64) collate utf8_unicode_ci NOT NULL," .
+ "`size` varchar(64) collate utf8_unicode_ci NOT NULL," .
+ "`object_type` varchar(64) collate utf8_unicode_ci NOT NULL," .
+ "`object_id` int(11) unsigned NOT NULL," .
+ "PRIMARY KEY (`id`)," .
+ "KEY `object_type` (`object_type`)," .
+ "KEY `object_id` (`object_id`)" .
+ ") ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
+ $db_results = Dba::write($sql);
+
+ foreach (array('album', 'artist') as $type) {
+ $sql = "SELECT `" . $type . "_id` AS `object_id`, " .
+ "`art`, `art_mime` FROM `" . $type .
+ "_data` WHERE `art` IS NOT NULL";
+ $db_results = Dba::read($sql);
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $sql = "INSERT INTO `image` " .
+ "(`image`, `mime`, `size`, " .
+ "`object_type`, `object_id`) " .
+ "VALUES('" . Dba::escape($row['art']) .
+ "', '" . $row['art_mime'] .
+ "', 'original', '" . $type . "', '" .
+ $row['object_id'] . "')";
+ $db_other_results = Dba::write($sql);
+ }
+ $sql = "DROP TABLE `" . $type . "_data`";
+ // $db_results = Dba::write($sql);
+ }
+
+ self::set_version('db_version','360003');
+
+ } // update_360003
+
+ /**
+ * update_360003
+ * This update adds the search table
+ */
+ public static function update_360003_b() {
+ $sql = "CREATE TABLE `search` (" .
+ "`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ," .
+ "`user` INT( 11 ) NOT NULL ," .
+ "`type` ENUM('private','public') DEFAULT NULL ," .
+ "`rules` VARCHAR( 65535 ) NOT NULL ," .
+ "`name` VARCHAR( 255 ) NOT NULL ," .
+ "`logic_operator` VARCHAR(3) NOT NULL " .
+ ") ENGINE = MYISAM ";
+ $db_results = Dba::write($sql);
+ self::set_version('db_version','360003');
+ } // update_360003
+
} // end update class
?>