AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Closed] Cleaning up old posts & topics

5 Posts
2 Users
0 Reactions
4,197 Views
Posts: 3
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@erkkiat)
Active Member
Joined: 4 years ago
[#19917]

Hi all,

What a great forum software and so easy to install and use. I love it.

I was wondering if there is a way to purge older posts and topics, like over 2 years old etc. I'm worried about my storage plan and would like to make sure I will have a way to trim the database size when needed.

Thanks for any ideas!

-- Eki 

 


4 Replies
Posts: 3
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@erkkiat)
Active Member
Joined: 4 years ago

I should explain the background a bit. The forum centers around mental health, and users are discussing the feelings of the day, medication etc. The relevance of some of the topics decreases over time. The most valuable content is kept, but a periodical cleanup would be useful for cost optimization.

 


3 Replies
Chris
(@chris)
Joined: 5 years ago

Famed Member
Posts: 3609
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

Hi @erkkiat,

You can delete posts and topics by newest/oldest date from Dashboard > Forums > Moderation > Published, use the Created Column to sort them by created date.

Second way is that we can give you an SQL which you can use to remove the topics and post lets say which are older 1 year, but for the SQL we need more Rules to make it work correctly:

How old must be the topics/post.

Which topics must not be deleted. For example, those which are sticky or solved or private.


(@erkkiat)
Joined: 4 years ago

Active Member
Posts: 3
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

Hi @chris,

Excellent! I could store the SQL somewhere for future use. Let's say we want to keep the sticky and private ones written by user "abc". I can modify it accordingly, but it's good to see if there are references I need to consider.

-- Eki 


Chris
(@chris)
Joined: 5 years ago

Famed Member
Posts: 3609
Chris
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@erkkiat,

This SQL deletes all Topics, posts, and post fields, which are older than xx date, and it excludes those which are sticky or private created by user 666(user id), those which are not private or sticky created by user 666 will be also deleted.

DELETE t, p, pm FROM `wp_wpforo_topics` t
	LEFT JOIN `wp_wpforo_posts` p ON p.`topicid` = t.`topicid`
	LEFT JOIN `wp_wpforo_postmeta` pm ON pm.`postid` = p.`postid`
	WHERE t.`created` < '2020-01-01 00:00:00'
	AND NOT ( t.`userid` = 666 AND (t.`private` = 1 OR t.`type` = 1 ) )

Share: