MyBB Community Forums

Full Version: Task Daily Cleanup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I notice in my task manager the task daily cleanup it says Cleans out old sessions and read threads

What does it clean up exactly? and does it delete any posts or anything?

As ive noticed in the board stats the X New today posts going up and down.

975 Posts
391 New Today

That was 397 before now its gone back down to 391 ???
Here's what probably happened to the posts.
1. The posts were deleted.

2. It's a new day and they've been reset and that's how many posts have accumulated on your forum.

Also, it probably deletes old threads/posts. Just to clean up your board. Wink
But what exactly does it clean up?
Opened up a copy of the file the task executes and found the following comments:

// Clear out sessions older than 24h
// Delete old read topics
// Check PMs moved to trash over a week ago & delete them

Looks like it ends old sessions (more than 24 hours old) and removes PMs that have been in the trash for over a week, though the "delete old read topics" I'm somewhat confused on. Looking at the code it appears that it'd be deleting data on if the topic was read or not (not deleting the thread itself), but I'm not 100% on this one. Maybe someone who understands the code better than me can explain?

from the file (it's open source so I don't see a problem posting this)
	// Delete old read topics
	if($mybb->settings['threadreadcut'] > 0)
	{
		$cut = TIME_NOW-($mybb->settings['threadreadcut']*60*60*24);
		$db->delete_query("threadsread", "dateline < '{$cut}'");
		$db->delete_query("forumsread", "dateline < '{$cut}'");
	}
New posts are counted over the last 24 hours, not by actual day.

The daily task cleanup does not delete posts. It removes old sessions, deletes trashed PMs, and recaches a couple of things. You can open inc/tasks/daily_cleanup.php to see exactly what it does (it's pretty well commented).

Edit: Unicorn is correct about the post read/unread cleanup.
Thanks for your help everyone.