Here's a mod you can run thru cron to autokill any 404 or 403, etc. file not found links in the database.
I've tried it a bit, and it looks like it 90% works. I havent really been able to test it much, but I was hoping someone would be able to get it in 100% working order. Please mail me if you do get it working 100%!!
In nph-verify.cgi:
in sub verify_links, just add a few entries to the variables:
sub verify_links {
# -----------------------------------------------------
use strict;
use vars qw(%urls %code %msg $method $db_url $db_key_pos $db_key $db_script_url $db_file_name $dbj @dblines);
now, in validator.pm add the following in the failure category, so it looks like this:
sub on_failure {
# ---------------------------------------------------------------
# Get's called whenever we fail right away.
#
my ($self, $request, $response, $entry) = @_;
if ($response) {
my $url = $request->url;
my $id = $main::urls{$url};
my $code = $response->code;
my $msg = $response->message;
chomp ($msg); chomp ($url);
$main::code{$url} = $code;
$main::msg {$url} = $msg;
# autokill code
@dblines = <DB>;
close(DB);
foreach ($dbj = 0;$dbj <= @dblines;$dbj++) {
if ($dblines[$dbj] =~ /$id|/) {
splice(@dblines, $dbj, 1);
$dbj -= 1;
}
}
open (DB, "<$db_file_name") or &cgierr("error in delete_records. unable to open db file: $db_file_name.\nReason: $!");
flock(DB, 2);
print DB @dblines;
close(DB);
open (DB, "<$db_file_name") or &cgierr("error in delete_records. unable to open db file: $db_file_name.\nReason: $!");
flock(DB, 2);
### end autokill
Now, I have to make sure you know there are some errors with this - but I cant see where. That's basically why I'm posting it. I'm not currently sure by looking at it whether it is working 100% or not. ie. this is completely alpha code - just wanted to make that clear.