From 0ce4c368a3d7816b8385b126768a3d9794eb431b Mon Sep 17 00:00:00 2001 From: Andy Heathershaw Date: Mon, 11 Sep 2017 22:15:30 +0100 Subject: [PATCH] Forward-ported a new DbHelper method from v2.1 which is now needed for the sitemap.xml generator --- app/Helpers/DbHelper.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/Helpers/DbHelper.php b/app/Helpers/DbHelper.php index d2aaaff..ff61fd4 100644 --- a/app/Helpers/DbHelper.php +++ b/app/Helpers/DbHelper.php @@ -9,6 +9,28 @@ use Illuminate\Support\Facades\Auth; class DbHelper { + private static $allowedAlbumIDs = null; + + public static function getAlbumIDsForCurrentUser() + { + if (is_null(self::$allowedAlbumIDs)) + { + $query = self::getAlbumsForCurrentUser_NonPaged(); + $query->select('albums.id'); + + $ids = []; + + foreach ($query->get() as $album) + { + $ids[] = $album->id; + } + + self::$allowedAlbumIDs = $ids; + } + + return self::$allowedAlbumIDs; + } + public static function getAlbumsForCurrentUser($parentID = -1) { $query = self::getAlbumsForCurrentUser_NonPaged();