diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/album.lib.php | 19 | ||||
-rw-r--r-- | lib/class/update.class.php | 3 |
2 files changed, 8 insertions, 14 deletions
diff --git a/lib/album.lib.php b/lib/album.lib.php index 30e55c7f..bf491c2a 100644 --- a/lib/album.lib.php +++ b/lib/album.lib.php @@ -114,12 +114,6 @@ function get_random_albums($count=6) { $rows = Dba::num_rows($db_results); if ($rows < 7) { return false; } - // There's a slight chance with this logic that the number of albums - // returned will be less than the number requested if the id's for the - // albums have signifigant gaps, but the speed increase is probably - // worth it - // - Vlet - $sql = 'SELECT '; for ($i = 0; $i < ceil($count * 1.5); $i++) { @@ -140,15 +134,18 @@ function get_random_albums($count=6) { $in_sql = rtrim($in_sql,',') . ')'; - $sql = "SELECT `album_id` FROM `album_data` WHERE $in_sql AND `art` IS NOT NULL"; + $sql = "SELECT `album_id`,ISNULL(`art`) AS `no_art` FROM `album_data` WHERE $in_sql"; $db_results = Dba::query($sql); $results = array(); - for ($i = 0; $i < $count; $i++) { - $row = Dba::fetch_assoc($db_results); - $results[] = $row['album_id']; - } + while ($row = Dba::fetch_assoc($db_results)) { + $results[$row['album_id']] = $row['no_art']; + } // end for + + asort($results); + $albums = array_keys($results); + $results = array_slice($albums,0,$count); return $results; } // get_random_albums diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 5be760b4..fa16503b 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -1122,9 +1122,6 @@ class Update { */ public static function update_340015() { - $sql = "ALTER TABLE `album_data` ADD INDEX `album_art` `album_id`,`art`(5)"; - $db_results = Dba::query($sql); - $sql = "ALTER TABLE `playlist` CHANGE `date` `date` INT ( 11 ) UNSIGNED NOT NULL"; $db_results = Dba::query($sql); |