free geoip CS Tidbits #25: Disable Stale Spam Comment Auditing - protected virtual void jaysonBlog
in

jaysonKnight.com

Welcome to my corner of the internet

protected virtual void jaysonBlog

A conduit to the voices in my head

CS Tidbits #25: Disable Stale Spam Comment Auditing

I've been in the process of building some Community Server add-ins lately (namely a couple of Control Panel add-ins) and stumbled across today's tidbit: Comments that are deemed as spam (they have accrued enough points to be considered as such) and are also flagged as stale (they've been sitting in your database for x number of days) are cleaned up on a regular basis by the DeleteStaleSpamComments job which runs every x number of days that you configure it to fire. 

There are a couple of issues with this process:  A) the job interval will get reset if the asp.net process hosting your CS installation restarts before the configured number of days pass by (which I will address in a future Tidbit) and thus will never fire, and B) while the comments are indeed deleted from the cs_posts table, they are archived into the cs_posts_deleted_archive table, so whatever space they were taking up isn't actually freed back to your database.  The fix for this is easy enough...locate the cs_weblog_DeleteStaleSpamComments stored procedure and delete the following block of SQL:

INSERT cs_posts_deleted_archive (PostID, UserID, SectionID, SettingsID, ApplicationType, Body, Subject, IPAddress, DeletedDate, ParentID, ThreadID, PostLevel, PostType, PropertyNames, PropertyValues, SpamScore, PostStatus) SELECT P.PostID, P.UserID, P.SectionID, P.SettingsID, 1, P.Body, P.Subject, P.IPAddress, getdate(), P.ParentID, P.ThreadID, P.PostLevel, P.PostType, P.PropertyNames, P.PropertyValues, P.SpamScore, P.PostStatus FROM cs_Posts P INNER JOIN @CommentsToDelete D ON P.PostID = D.PostID

That is unless you really want all of your comment spam archived in case you decide one day you want them back.

Share this post: Submit CS+Tidbits+%2325%3a+Disable+Stale+Spam+Comment+Auditing to Technorati | Submit CS+Tidbits+%2325%3a+Disable+Stale+Spam+Comment+Auditing to del.icio.us | Submit CS+Tidbits+%2325%3a+Disable+Stale+Spam+Comment+Auditing to digg.com | Submit CS+Tidbits+%2325%3a+Disable+Stale+Spam+Comment+Auditing to reddit.com | Submit CS+Tidbits+%2325%3a+Disable+Stale+Spam+Comment+Auditing to DotNetKicks | Add CS+Tidbits+%2325%3a+Disable+Stale+Spam+Comment+Auditing to Live Bookmarks
Only published comments... Dec 04 2006, 09:28 PM by Jayson Knight
Filed under:

Comments

 

Community Server Bits said:

Jayson Knight with CS Tidbit #25: Disabling Stale Spam Comment Auditing. As Jayson explains, when comments

March 12, 2007 5:59 AM

Leave a Comment

(required)  
(optional)
(required)  
Add

About Jayson Knight

Jayson Knight was clueless to the computer programming world until he took a C++ class in college. The rest is proverbial history. He has been building applications targeting the .Net framework for 7 years, focusing mainly on internet technologies and database driven web application development.

Most recently he left the world of Corporate IT to finish up his degree in Chemistry, with an eye on Medical School and an Anesthesiology residency program. Read this post for more information.

He is also a Community Server MVP: Community Server is the software that runs this site, plus many others on the web. For more information, check out http://csmvps.com.

When he finds time to pry himself away from his computer and university studies, he can be found on the mountain bike trails when it's warm, and on the ski slopes when it's cold.

Copyright © :: JaysonKnight.com
External Content © :: Respective Authors

Terms of Service/Privacy Policy