Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: rmcelwee on December 13, 2012, 07:30:09 AM

Title: I want 1000 subjects per page. How?
Post by: rmcelwee on December 13, 2012, 07:30:09 AM
I have a ver 1.1.11 board that I have not messed with for years. I looked at it last night and it has become overrun with spam. I deleted the spam members by listing 1000 per page and doing mass deletes. Now I am left with 1000s of spam messages posted by "guest" accts in each forum. I would like to do a mass delete of 1000 messages per page until everything that was written in the past year or so is gone but I cannot find where the 1000 subjects per page option is. Any ideas?
Title: Re: I want 1000 subjects per page. How?
Post by: hadesflames on December 13, 2012, 06:24:58 PM
Go to Admin > Maintenance > Forum Maintenance > Topics

It should be something similar to that.

There, you should be able to prune topics older than a specified number of days, in whatever boards you want. Should be faster than going through a bunch of pages.
Title: Re: I want 1000 subjects per page. How?
Post by: rmcelwee on December 14, 2012, 09:03:03 AM
I need to do just the opposite of that. I want to remove all topics NEWER than 1 year old. All the good stuff I need to save is several years old.
Title: Re: I want 1000 subjects per page. How?
Post by: rmcelwee on December 17, 2012, 08:09:05 PM
Anyone?
Title: Re: I want 1000 subjects per page. How?
Post by: Night09 on December 17, 2012, 09:11:17 PM
You need to run a query on your databases messages table. You will have to make it if date newer than a certain one it deletes it.  I dont have the exact query to hand but thats the way id look at doing it.
Title: Re: I want 1000 subjects per page. How?
Post by: rmcelwee on December 22, 2012, 10:32:26 AM
I don't have a clue on how to do that.

Still looking for a way to increase the number of subjects per page. I can't believe there is not a setting for this.
Title: Re: I want 1000 subjects per page. How?
Post by: rmcelwee on January 23, 2013, 09:55:43 AM
Still looking for help on this...
Title: Re: I want 1000 subjects per page. How?
Post by: MrPhil on January 23, 2013, 10:06:27 AM
QuoteAdmin > Maintenance > Forum Maintenance > Topics
It should be possible to (temporarily) modify the code/query that removes OLDER topics to remove NEWER ones by flipping a comparison. I can't look at it right now, but I'll try to remember to look at it tonight. That would be much safer than trying to manually update the database tables, as there are pointers between tables that need to be kept in sync.

I'm not sure it exists in SMF 1, but in SMF 2 when you deleted the spammers you could delete all their posts at the same time. It may be too late to consider that (upgrade to 2.0.3 first) if you've already deleted the member accounts.
Title: Re: I want 1000 subjects per page. How?
Post by: emanuele on January 23, 2013, 11:43:48 AM
admin > posts and topic > topic settings
and set "Number of posts per page in a topic page"?
The you can register a new account, and go to all unread topics?
Title: Re: I want 1000 subjects per page. How?
Post by: MrPhil on January 23, 2013, 10:11:37 PM
I did some digging through the code, and I think I found what we're looking for. Before running this modification, make a backup of your database just in case it does something unexpected! Use phpMyAdmin or some other database utility; don't use SMF's Admin database backup.

In Sources/RemoveTopic.php, find the following chunk of code in function RemoveOldTopics2():
// All we're gonna do here is grab the ID_TOPICs and send them to removeTopics().
$request = db_query("
SELECT t.ID_TOPIC
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
WHERE m.ID_MSG = t.ID_LAST_MSG
AND m.posterTime < " . (time() - 3600 * 24 * $_POST['maxdays']) . "$condition
AND t.ID_BOARD IN (" . implode(', ', array_keys($_POST['boards'])) . ')', __FILE__, __LINE__);


Take the line in there
AND m.posterTime < " . (time() - 3600 * 24 * $_POST['maxdays']) . "$condition
and flip the relation around:
AND m.posterTime >= " . (time() - 3600 * 24 * $_POST['maxdays']) . "$condition

I have not run this change, but I think it should be that one change. Remember that the labels and prompts are still for the old way (remove OLDER than N days) so don't get confused when you use it. When done, restore the code so you don't have an accident in the future.

By the way, this is 1.1.16 (I couldn't obtain a copy of 1.1.11), but it should be similar.
Title: Re: I want 1000 subjects per page. How?
Post by: Sir Osis of Liver on January 23, 2013, 10:25:07 PM

That code block is the same in 1.1.11.