| 81 | | $idlist = '(' . implode(',', $ids) . ')'; |
| 82 | | |
| 83 | | $sql = "SELECT * FROM `artist` WHERE `id` IN $idlist"; |
| 84 | | $db_results = Dba::query($sql); |
| 85 | | |
| 86 | | while ($row = Dba::fetch_assoc($db_results)) { |
| 87 | | parent::add_to_cache('artist',$row['id'],$row); |
| | 81 | if($ids) { |
| | 82 | $idlist = '(' . implode(',', $ids) . ')'; |
| | 83 | |
| | 84 | $sql = "SELECT * FROM `artist` WHERE `id` IN $idlist"; |
| | 85 | $db_results = Dba::query($sql); |
| | 86 | |
| | 87 | while ($row = Dba::fetch_assoc($db_results)) { |
| | 88 | parent::add_to_cache('artist',$row['id'],$row); |
| | 89 | } |
| | 90 | |
| | 91 | // If we need to also pull the extra information, this is normally only used when we are doing the human display |
| | 92 | if ($extra) { |
| | 93 | $sql = "SELECT `song`.`artist`, COUNT(`song`.`id`) AS `song_count`, COUNT(DISTINCT `song`.`album`) AS `album_count`, SUM(`song`.`time`) AS `time` FROM `song` " . |
| | 94 | "WHERE `song`.`artist` IN $idlist GROUP BY `song`.`artist`"; |
| | 95 | $db_results = Dba::query($sql); |
| | 96 | |
| | 97 | while ($row = Dba::fetch_assoc($db_results)) { |
| | 98 | parent::add_to_cache('artist_extra',$row['artist'],$row); |
| | 99 | } |
| | 100 | |
| | 101 | } // end if extra |
| | 102 | |
| | 103 | return true; |
| | 104 | } else { |
| | 105 | return false; |
| 89 | | |
| 90 | | // If we need to also pull the extra information, this is normally only used when we are doing the human display |
| 91 | | if ($extra) { |
| 92 | | $sql = "SELECT `song`.`artist`, COUNT(`song`.`id`) AS `song_count`, COUNT(DISTINCT `song`.`album`) AS `album_count`, SUM(`song`.`time`) AS `time` FROM `song` " . |
| 93 | | "WHERE `song`.`artist` IN $idlist GROUP BY `song`.`artist`"; |
| 94 | | $db_results = Dba::query($sql); |
| 95 | | |
| 96 | | while ($row = Dba::fetch_assoc($db_results)) { |
| 97 | | parent::add_to_cache('artist_extra',$row['artist'],$row); |
| 98 | | } |
| 99 | | |
| 100 | | } // end if extra |