• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

MG 1.1 How to delete all empty albums

Alfa1

Well-known member
#1
After migration from vbulletin albums, LDM and photopost I have a large number of empty albums on my site.
Is there a query that I can use to delete all empty albums from my site?
 

Chris D

XenForo developer
Staff member
#2
First it's important to ensure all of the album counts are up to date. These aren't rebuild automatically in all cases (after an import), and therefore it's possible there are fewer empty albums than you expect. It's an important step, because the query I'm about to give you assumes this count will be correct.

The correct rebuild to run to make sure of this is Admin CP > Applications > Gallery Rebuilds and search for the one named "Rebuild XenForo Media Gallery Album Media Count" (some of them have sort of similar names, so double check this!

Once that has been completed, you can just run this query:

Code:
DELETE FROM xengallery_album WHERE album_media_count = 0
After completing that, you will need to run the "Rebuild XenForo Media Gallery User Album Counts" rebuild, this will update the info in xf_user to ensure that a user's album count is correct.
 
Last edited: