MyBB Community Forums

Full Version: Find Orphaned Attachments render limit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Find Orphaned Attachments worked for me when there were 113, but failed to list any when there were 3,707 to render. Is there a quick change I can make to the query in the php file to fix this? Maybe put a limiter on it?

I figured it out. I added this at line 576 of admin/modules/forum/attachments.php (version 1.8.10)
			if (count($bad_attachments) > 155)
			{
				$bad_attachments = array_splice($bad_attachments, 0, 155);
			}
For my setup, 155 was the max number of records the page could render at once. This fixed my issue perfectly and allowed me to delete all 3,707 of my orphaned attachments, in batches of 155.

Note that there are different kinds of orphans and this was specifically limiting how many of the "bad attachment" kind are returned at a time. "bad attachment" kind means there is a file in the uploads folder that is not used in the database. Also, if you are not a computer programmer, I don't recommend doing something like this!