UBB.Dev
Posted By: blaaskaak [7.3] Salvage >- Recover losts posts - 05/19/2008 2:38 PM
If this query:

Code
SELECT count( DISTINCT TOPIC_ID )
FROM ubbt_POSTS
WHERE TOPIC_ID NOT
IN (
SELECT TOPIC_ID
FROM ubbt_TOPICS
)

Gives you a result >0 you have posts in your database that are not referenced anymore by any existing topic. Attached scripts will salvage those topics to a predefined forum (YOU HAVE TO SET THIS MANUALLY IN THE SCRIPT BEFORE USING IT).

This script and above query require MySQL >= v4.10

Enjoy your cleaned up database smile


Description: Topic salvage tool v1.00
Attached File
salvage.zip  (12 downloads)
Posted By: blaaskaak Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 2:44 PM
A note that didn't really fit in the first post of this topic. The inline moderation does not always want to cooperate with topics salvaged by above tool. Not all salvaged topics are a-okay. Some topics you have to delete by going into them and deleting them with the manage topic stuff.

When using the tool, I discovered some complete topics, but also some loose messages.
Posted By: Ian_W Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 3:17 PM
Thanks - gave it a go as I had 19 posts that were not linked.

It recovered 5 threads. Not all can now be deleted, which I am not too worried about.

One says it can't find the post in the database to view the post.

The other where it merged two threads together (making a 4 post thread), I could delete the last 2 posts, but the 2nd post you can't delete as it says it is the first post in the thread (which it isn't now) and has dependant posts beneath it (which it doesn't)

Anyway I am not too worried, but just reporting back my findings.

HOWEVER! - it found the very first post I made with threads back in 2001 - meaning that my forums are at least 7 years old. Although they go back a couple of years further in a smaller incarnation. So I am happy smile
Posted By: blaaskaak Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 3:27 PM
For some posts, I just went into the post, and deleted it from the edit post screen.

I also had one problem with a post I could not click on, but clicking on the date on the left did open the topic.

You finding your very first post kinda makes the time spend on this all worth it wink
Posted By: jgeoff Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 6:19 PM
Quote

$salvageforum = #;

Just to be clear, would I have to run this for each forum? Can the new private forum be used for each run of this?

Edit: Never mind, I read that wrong...
Posted By: blaaskaak Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 6:21 PM
No, the forum you enter there is the forum the lost posts are put into.

You should make a new empty forum for that to see exactly what is salvaged.
Posted By: jgeoff Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 6:32 PM

It worked... YOU RULE!!! cool

Now to figure out how long thread posts get orphaned to begin with...

Posted By: blaaskaak Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 6:41 PM
Great to hear!
Posted By: sirdude Re: [7.3] Salvage >- Recover losts posts - 05/19/2008 6:57 PM
sometimes Yarp™ does good work... laugh

it's akin to a Blind squirrel getting an acorn every now and then..

Posted By: AllenAyres Re: [7.3] Salvage >- Recover losts posts - 05/21/2008 6:03 AM
Cool, my personal site lists 2, I need to try and and run the script now.

I know we could probably use it here - seems like most of the announcements we imported from threadsdev have issues - like ubbt_topics has them, but ubbt_posts doesn't. Except our mysl is 4.0.something smash
Posted By: blaaskaak Re: [7.3] Salvage >- Recover losts posts - 05/21/2008 9:10 AM
Ah, is ubbdev the reason threads still insists on supporting MySQL <4.1 wink

You would only need to redo the part that finds out about the lost posts and their topic id's since that one uses a query in a query. The rest would work fine.
Posted By: AllenAyres Re: [7.3] Salvage >- Recover losts posts - 05/21/2008 5:52 PM
You may be right there wink

I may talk to Navaho and see about transferring the site to our server... he'd probably prefer to get it out of his hair too smile
Posted By: sirdude Re: [7.3] Salvage >- Recover losts posts - 05/26/2008 8:32 PM
you guys should be on mysql 5 and php 5 and apache 2, for being a ubbDEV site, imho :2c:

i have a dedicated server that can handle your needs wink
Posted By: AllenAyres Re: [7.3] Salvage >- Recover losts posts - 05/30/2008 5:02 AM
We should... I have lots of space on mine too - I may ask him soon.
Posted By: Jake V Re: [7.3] Salvage >- Recover losts posts - 10/22/2010 7:29 PM
The script worked perfectly. Many thanks!
© UBB.Developers