Forward-ported a new DbHelper method from v2.1 which is now needed for the sitemap.xml generator

This commit is contained in:
Andy Heathershaw 2017-09-11 22:15:30 +01:00
parent 1173b2baba
commit 0ce4c368a3

View File

@ -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();