Visitor Log Question

From: DeannaG (CYBATRON)29 Oct 2020 03:47
To: All 1 of 6
Hi Everyone!

My question is this...
Is it possible to get the forums' system to automatically clean the visitor log of each forum every so often? Such as cleaning out entries older than a set number of days.

I'd like to be able to set things so I don't have to do it manually every couple months. I just cleaned out the visitor's log for one of the subsites we host after finding their visitor log as over 6000 pages long. The other forum they have had a visitor log over 3000 entries. They had never cleaned them. So I shortened them to three months.

Going through forums and having to cut their visitor logs back to 60, 90, or whatever days can be a bit time consuming. Something to do this bit of housekeeping automatically would be great.

It would be nice if either in the Admin area, maybe somewhere in Forum Settings, there was a way to set the system so it would ditch any visitor entry older than a set number of days, or some kind of code in the visitor log pages to do it.

Is this possible and is anyone interested in doing it? Depending on price, this could be a contract job with pay.
From: Peter (BOUGHTONP)29 Oct 2020 22:44
To: DeannaG (CYBATRON) 2 of 6
I'm not sure what would be involved in handling this with Beehive itself - there is a forum_check_maintenance function which would appear to be a suitable place, but I haven't done PHP in yonks and it's not immediately clear what it's doing - I'm not sure whether it would be as simple as adding a couple of lines or if a more involved change would be needed.

However, if you have database access, you can avoid going into every forum admin area by doing it with a query:

DELETE QUICK FROM VISITOR_LOG WHERE LAST_LOGON < CAST('2010-01-01 00:00:00' AS DATETIME)

To first check how many rows would be removed from each forum before running that, you could use:

SELECT FORUM , COUNT(*) FROM VISITOR_LOG WHERE LAST_LOGON < CAST('2010-01-01 00:00:00' AS DATETIME) GROUP BY FORUM

You might be able to change the condition to a dynamic value like so:

SELECT FORUM , COUNT(*) FROM FROM VISITOR_LOG WHERE LAST_LOGON < CURRENT_DATE() - INTERVAL 9 MONTH GROUP BY FORUM

If that works, you could put the line in a .sql file, then schedule a command that runs it against the database using the server OS's scheduling facilities (i.e. cron/systemd/whatever).

From: milko30 Oct 2020 23:19
To: Peter (BOUGHTONP) 3 of 6
I haven't heard/read anyone say yonks in yonks.
From: Matt31 Oct 2020 01:26
To: DeannaG (CYBATRON) 4 of 6
I just pushed a change to Github with a feature to do this. There will be no release for this (or anything else now) and you upgrade at your own risk. Let me know if it works for you.
From: CHYRON (DSMITHHFX) 1 Nov 2020 14:02
To: Matt 5 of 6
Code: 
 There will be no release for this (or anything else now) and you upgrade at your own risk. 


I like the sound of that. Going forward, it will be my policy.

EDITED: 1 Nov 2020 14:03 by DSMITHHFX
From: fixrman 2 Nov 2020 22:34
To: Matt 6 of 6
Matt, do you currently have anything like the visitor log purge to purge members who have registered but never posted? At Technical Me, we had - I'm sure like you also did here - any number of gibberish-named members who were advertising black mould treatments, Burberry bags, Sneakers, etc.; I'd usually ban them manually, but could there also be a parameter that deletes a member and profile after, say, 0 posts in X number of years (I'd say 1.5)?
EDITED: 2 Nov 2020 22:37 by FIXRMAN