Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Prune Database Request
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 24, 2015 - 5:57 pm

It's hard for me to test but I think I have this right! The following change will alter the listing based on the last post in a topic instead of the first as you suggest and which I agree is better...

You will need to edit two files:

(1) wp-content/sp-resources/forum-plugins/prune-db/admin/sp-prune-db-admin-prune.php

Quite near the top you will find this code:

$sql = "SELECT * FROM ".SFTOPICS.
" WHERE topic_date <= '".$date."'".$forum_id.
" ORDER BY topic_date, forum_id ASC";

Change it for the following code:

$sql = "SELECT * FROM ".SFTOPICS."
JOIN ".SFPOSTS." ON ".SFTOPICS.".post_id = ".SFPOSTS.".post_id
WHERE ".SFPOSTS.".post_date <= '".$date."'".$forum_id.
" ORDER BY ".SFPOSTS.".post_date, ".SFTOPICS.".forum_id ASC";

which should then display a corrected topic listing. It would be wise to actually just test this against known data to ensure it is correct but I believe it to be so.

(2) wp-content/sp-resources/forum-plugins/prune-db/library/sp-prune-db-components.php

At line 69 you will find this block of code:

if ($first) {
    $forum_ids = ' AND (forum_id='.sp_esc_int($_POST['group'.$x.'forum'.$y]);
    $first = false;
 } else {
    $forum_ids .= ' OR forum_id='.sp_esc_int($_POST['group'.$x.'forum'.$y]);
 }

change it to:

if ($first) {
    $forum_ids = ' AND ('.SFTOPICS.'.forum_id='.sp_esc_int($_POST['group'.$x.'forum'.$y]);
    $first = false;
} else {
    $forum_ids .= ' OR '.SFTOPICS.'.forum_id='.sp_esc_int($_POST['group'.$x.'forum'.$y]);
}

As stated - this does nothing for the batching into smaller chunks. I would suggest no more than, say, 100 topics at a time but this value will differ for everyone.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Tal
Member
Free Members
sp_UserOfflineSmall Offline
Mar 25, 2015 - 3:58 am

I still have a problem. I have a couple of unusually large topics that I can't even prune on their own... any suggestions?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 25, 2015 - 5:04 am

Wow really?

Are all of your SP components ( core/plugins) all up to date?

And what happens exactly when you try to do this one topic? Have you tried from the front end using the forum tools?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Tal
Member
Free Members
sp_UserOfflineSmall Offline
Mar 25, 2015 - 5:40 am

Everything is up to date.

I'm not seeing any options to do it from the front end...

Avatar
Tal
Member
Free Members
sp_UserOfflineSmall Offline
Mar 25, 2015 - 6:11 am

my brain is dumb LOL... there's that whole "delete" thing right!? LOL

Nope, looks like I can't delete from the front end either.

... the longest topic has 10620 posts eek

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 25, 2015 - 6:51 am

What? 10620? Oh my. I need to think about that one! We might need to devise a SQL script for something like that. Let me ponder for a while.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Tal
Member
Free Members
sp_UserOfflineSmall Offline
Mar 25, 2015 - 7:04 am

Yellow Swordfish said
What? 10620? Oh my. I need to think about that one! We might need to devise a SQL script for something like that. Let me ponder for a while.

heh... what can I say.. people like to chat LOL

After a few threads got that long we started locking them down and starting new ones but there's half a dozen like that

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 25, 2015 - 7:08 am

If I write up some SQL queries are you able and willing to run them directly in the database? I just might not be able to do that today...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Tal
Member
Free Members
sp_UserOfflineSmall Offline
Apr 1, 2015 - 1:27 am

I missed this reply ... was just checking to see if there was any progress.. yes, I'm happy to run them in the database

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 1, 2015 - 3:58 am

Deleting in batches will be a pig of a development issue and wont be quick I am afraid. But I should be able to get some base queries to you.

I do need to know if you are using the latest versions of everything as that will make a big difference.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 643
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 616
Members: 17343
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10117
Posts: 79590