Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2002
Posts: 151
Member
Member
Offline
Joined: Sep 2002
Posts: 151
Hi all!

I guess this is done with some nice sql query?!

I want to delete all threads in a specific forum prior to a specific date.

I thought that the "expire threads after X days" setting should do the trick, but nothing happens. What´s this setting for?

I run 6.4.

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Okay that setting in the forum setup is simply a tag that a script looks for to do this for you. They do not expire by default. You either need to manually run the cron script through your browser or setup a specific cron task.

The script that looks for those forum specific expires times and does the deed is in your Threads cron/php directory. It is doexpire.php

Joined: Jun 2003
Posts: 1,025
Junior Member
Junior Member
Offline
Joined: Jun 2003
Posts: 1,025
You have to use a crontask, or type in the locatiion of your doexpire script in your web browser. That will delete the inactive threads as specified in doexpire.

Joined: Sep 2002
Posts: 151
Member
Member
Offline
Joined: Sep 2002
Posts: 151
I runned the cron script in my browser, and it worked.

But in one forum it set the number of threads to 0 (it still has some hundred threads) but the number of posts is still as it was before.

Is there a way to force UBBT to update/recount this info for all forums?

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Interesting I have not seen this happen before but there is no automatic way that I know of. There is an old script around here by DaveL that checks the last post and counts that should work.

However the manual way to correct it is easy and posted below

This query gets the thread total for a forum

SELECT COUNT(*)
FROM w3t_Posts
WHERE B_Board ='KEYWORDHERE'
AND B_Parent ='0'


This forum gets a Posttotal for a forum

SELECT COUNT(*)
FROM w3t_Posts
WHERE B_Board ='KEYWORDHERE'
AND B_Posted !='0'

You can manually enter the numbers in your w3t_Boards fields as follows

The Bo_Total field is the posttotal

The BO_Threads field is the thread total

Sponsored Links
Joined: Sep 2002
Posts: 151
Member
Member
Offline
Joined: Sep 2002
Posts: 151
Worked gret! Thanks!

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
No doubt I just read the other thread you posted here about deleting threads. I now understand why when you ran the doexpire.php file you got the error looks like you were manually entering commands also.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
One of my number one favorite consulting jobs to get is to fix issues when people manually delete stuff. Usually hours of billable time involved in straightening it out.

There's not many places in Threads where you can manually delete anything with just a SQL Command. The way everything is linked together, very often multiple tables need to be updated.

If you delete posts, the counts in the Boards table will have to be updated.

If you delete replies, you need to make sure that none of them are in the Boards table as the last post.

If you delete users you need to make sure the user number is not in use anywhere in any of the other tables.

If you delete a group you need to make sure no members are a part of it and no boards are using it.

Much too much interaction to just delete data from one of the tables.

Usually someone hires me because "something's wrong". Then after I hunt for an hour or so and try to figure out what's wrong, THEN they say "oh you know, the other day I tried to delete xxxx" and then that usually ends up being the reason for all.

Gregory - if you deleted posts, Omegatron's queries should get you back on track.

If you deleted replies to posts, then make sure you recaululate the B_replies field in the w3t_Posts table.

Just to make sure everything is back in sync.

Joined: Sep 2002
Posts: 151
Member
Member
Offline
Joined: Sep 2002
Posts: 151
I think I´ve got everything back on track, exept for "B_replies".

Edit Just learned what that field does; it count how many replies a post has got, right?!

Last edited by Gregori; 01/02/2004 7:12 PM.
Joined: Sep 2002
Posts: 151
Member
Member
Offline
Joined: Sep 2002
Posts: 151
Oki... I have qround 1000 posts without replies and with wrong value in B_replies.

All of these are in the same forum and should have B_replies set to 0.

Will this work?
Code
<br />UPDATE `w3t_Posts`<br />WHERE `B_Board` = 'archive'<br />SET `B_Replies` = '0';<br />

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That should do it.

that prevent all the page counts from being wrong.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Now further investigation, you might want to make sure that nobody had any of thoese threads marked as "favorite threads" or had post reminders for any of them. Or those users might have trouble viewing their "my home" screen.

Anytime stuff is joined together, if the join fails, it can prevent it from appearing.
That's probably more rare, but if you want ot ensure that you've cleaned up from all you've deleted, those would be the last two places to look.

Joined: Sep 2002
Posts: 151
Member
Member
Offline
Joined: Sep 2002
Posts: 151
This is what I got when trying to set the B-replies as above
Code
<br />#1064 - You have an error in your SQL syntax near 'WHERE  `B_Board`  =  'archive' SET  `B_Replies`  =  '0'' at line 1<br />

Strange!

And the further investegation... wow.... oki... what have I gotten myself into! I do understand that Josh is making biiiiiig bucks, with people like me forcing them selfs to hire him in the end! :lol:

Oki... Is there a way to do alls this without having to check every single one of my 12885 users favorit threads and such?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Are you using the slanted apostrophe like that? - you just need the straight dash - like this ' :


UPDATE w3t_Posts
SET B_Replies = '0'
WHERE B_Board = 'archive'


The favorites and reminders *might* not cause an issue for you. I'm just making you aware of potential problem areas.

Unfortunatley there isn't a real easy way to check that stuff. If it were that easy, then it would be a feature from the admin menu.

Usually what's needed is some kind of script which checks the stuff and removes where necessary. So if the post number in the favorites table doesn't exist, then it can be deleted too.


I just like to throw appropriate caution as someone new comes along, finds a thread like this and runs the query to delete stuff... which often creates problems for them.

A good guide, if you want to delete posts, take a look at the scripts in the admin section that perform this action and see what tables they are updating etc... That's a good guideline of what needs to be done, depsning on what's being removed/changed.

Joined: Sep 2002
Posts: 151
Member
Member
Offline
Joined: Sep 2002
Posts: 151
It worked great this time!

I love this site. I´m really learning stuff here! Like "always backup the database before doing _anything_".

Thanks for the help!

Now.. on to the next question!

Edit Btw... wanna hear something really scary? I was dead tired last night... witch had the affect that I was dreaming. About what, you say?!

Editing tables in mysql!

Now that´s one scary and twisted dream!

Last edited by Gregori; 01/03/2004 5:11 AM.

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Nettomo
Nettomo
Germany, Bremen
Posts: 417
Joined: November 2001
Forum Statistics
Forums63
Topics37,575
Posts293,930
Members13,823
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)