/** * Generate albums cache * * @html admin/cache * @param Context $ctx * @return array */ public function cache(Context $ctx) { $files = []; $albums = Album::fetch(); $force = (bool) $ctx->request->uri->param('force'); foreach ($albums as $album) { foreach ($album->authors() as $author) { foreach ($author->pics() as $pic) { if ($force or !file_exists($pic->cachepath)) { $files[] = $pic->path; } } } } return ['files' => $files, 'force' => $force]; }
/** * Display map of all albums * * @html albums/map */ public function map() { if (!MAPBOX_TOKEN or !MAPBOX_PROJECT) { throw new NotFoundException(); } $albums = Album::fetch(); // keep only album with meta place foreach ($albums as $index => $album) { if (!$album->meta('place')) { unset($albums[$index]); } } return ['albums' => $albums, 'ariane' => []]; }