public static function cache_dir($pReload = FALSE) { if ($pReload || is_null(self::$_cache_dir)) { $value = ZUPAL_ROOT_DIR . DS . Zupal_Bootstrap::$registry->configuration->cache->path . DS . 'modules/media/musicbrainz/artists_list'; error_log(__METHOD__ . ': ' . $value); if (!is_dir($value)) { mkdir($value, 775, TRUE); } // process self::$_cache_dir = $value; } return self::$_cache_dir; }
function people($pDepth = 1, $pReload = FALSE) { if (!$this->isSaved()) { return NULL; } if ($pReload || is_null($this->_people)) { $cache = Zupal_Media_MusicBrainz_Cache::getInstance(); $key = 'artist_people_' . $this->identity(); if (!$cache->test($key) || $pReload) { $sql = 'SELECT laa.link0 AS id, laa.link_type AS link_type' . ' FROM l_artist_artist laa LEFT JOIN artist a ON a.id = link0 ' . ' WHERE (link1 = ?) and (a.type = 1) ORDER BY a.begindate'; // error_log(__METHOD__ . ': ' . $sql); $data = $this->table()->getAdapter()->fetchAssoc($sql, array($this->identity())); $cache->save($data, $key); } $data = $cache->load($key); $people = array(); if ($data) { foreach ($data as $keys) { extract($keys); $artist = new Zupal_Musicbrainz_Artist($id); $link = new Zupal_Musicbrainz_Lt_Artist_Artist($link_type); $group = new stdClass(); $group->artist = $artist; $group->type = $link; $people[] = $group; } } $this->_people = $people; } return $this->_people; }