Gossamer Forum
Home : Products : Links 2.0 : Customization :

Multiple deletes

Quote Reply
Multiple deletes
After performing a quick check (under verify links), I wish to delete all links that are not accessible anymore.
Is there a relatively easy way of doing this (rather than using 'delete' under the 'links' heading - which only enables you to do this one link at a time)?
Thanks,
Dale.

Quote Reply
Re: Multiple deletes In reply to
Don't think so Smile

Andy

http://www.ace-installer.com
webmaster@Ace-installer.com
Quote Reply
Re: Multiple deletes In reply to
Off the top of my head you could have:

To create a list of all dead links:
Code:
if ($status eq '404') { push @dead, $rec{'ID'}; }
Remove all dead links from links.db:
Code:
open (LINKS, 'admin/data/links.db');
@data = <LINKS>;
close (LINKS);
open (LINKS, '>admin/data/links.db');
open (DEAD, '>admin/data/dead.db');
foreach $line (@data) {
chomp($line);
($id, $rest) = split /\|/, $line;
if (grep {$id != $_ }, @dead) {
print LINKS "$line\n"; #put it back in the database
} else {
print DEAD "$line\n"; #save it to another just in case...
}
}
close (DEAD);
close (LINKS);
This won't necessarily be the exact code to use as I have NEVER looked at the code inside nph-verify.cgi.

Happy Coding,

--Drew
http://www.FindingHim.com