forum.coppermine-gallery.net

No Support => General discussion (no support!) => Topic started by: DanJ on April 18, 2005, 03:29:35 pm

Title: Automated removal of dead links?
Post by: DanJ on April 18, 2005, 03:29:35 pm
The server my site was stored on recently had a catestrophic RAID array failure which resulted in the loss of all data. The site has now been restored from a backup however the recently uploaded images are missing however the the SQL database still refers to them (independent server so no data lost). Is there a way to mass remove all dead links to the images that no longer exist?

If not is there a 3rd party tool to do so? (I guess I should post that on the other forum but I thought it polite to safe x-posting in the hope that there is already a facility I've overlooked).

Thanks to anyone who's able to provide any help, it's all appreciated.
Title: Re: Automated removal of dead links?
Post by: krkeegan on April 18, 2005, 05:45:18 pm
Wow that sucks. I can't think of anything off hand that has been created but I think you may be able to figure something out with phpMyAdmin. If you can figure out what is the most recent photo that is still up I think you could delete all  other posts after.

The pid value in the pictures database is auto_incremented so if you can find the last good picture and remove all references to the other pictures that occur there after I think it should work.

I don't have the table structure in front of me right now, but I also think you will have to make a few mods to the other tables.

Anyone else care to check my reasoning? Is there anything I am missing?

Kevin

Of course if you had a corresponding backup of the database that would work to.
Title: Re: Automated removal of dead links?
Post by: DanJ on April 19, 2005, 01:19:15 am
What you've said makes sense to me. My knowledge of SQL is poor at best but I'm sure I can write a simple enough query to report back the appropriate records.

Thanks for your help.
Title: Re: Automated removal of dead links?
Post by: Nibbler on April 19, 2005, 02:51:23 pm
Try the attached - unzip, upload to cpg dir, and run from browser.