summaryrefslogtreecommitdiffstats
path: root/lib/class/album.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/class/album.class.php')
-rw-r--r--lib/class/album.class.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index 5c810ca6..eef95831 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -90,14 +90,25 @@ class Album {
return $album;
} // construct_from_array
-
+ public static function build_cache($ids, $fields='*') {
+ $idlist = '(' . implode(',', $ids) . ')';
+ $sql = "SELECT $fields FROM album WHERE id in $idlist";
+ $db_results = Dba::query($sql);
+ global $album_cache;
+ $album_cache = array();
+ while ($results = Dba::fetch_assoc($db_results)) {
+ $album_cache[intval($results['id'])] = $results;
+ }
+ }
/**
* _get_info
* This is a private function that pulls the album
* from the database
*/
private function _get_info() {
-
+ global $album_cache;
+ if (isset($album_cache[intval($this->id)]))
+ return $album_cache[intval($this->id)];
// Just get the album information
$sql = "SELECT * FROM `album` WHERE `id`='" . $this->id . "'";
$db_results = Dba::query($sql);