Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 1791

phpBB Custom Coding • Re: Some useful SQL

$
0
0
The phpbb_topics_track table can get enormous over many years because most users never use the mark forums read link and it has a lot of records that can exist since you installed phpBB. Mine was up to almost 2 million rows The following SQL will mark topics read for everyone where the last post was more than a year ago. It will not unmark topics.

Code:

DELETE FROM phpbb_topics_track WHERE mark_time< UNIX_TIMESTAMP(DATE_SUB(CURDATE(), INTERVAL 1 YEAR));DELETE FROM phpbb_forums_track WHERE mark_time< UNIX_TIMESTAMP(DATE_SUB(CURDATE(), INTERVAL 1 YEAR));UPDATE phpbb_users SET user_lastmark=UNIX_TIMESTAMP(DATE_SUB(CURDATE(), INTERVAL 1 YEAR)) WHERE user_lastmark<UNIX_TIMESTAMP(DATE_SUB(CURDATE(), INTERVAL 1 YEAR)) AND user_id != 1;
1.7 million on an 18 year old board.
Thanks ;)

Statistics: Posted by Stoker 4.0 — Tue Jan 07, 2025 9:08 pm



Viewing all articles
Browse latest Browse all 1791

Trending Articles