Gossamer Forum
Home : Products : Links 2.0 : Customization :

validate.db move

Quote Reply
validate.db move
can the info in the validate.db file be moved automatically into the links.db?
If this is possible please let me know
Thanks
Ron

Quote Reply
Re: validate.db move In reply to
Try the following:

1) Add the following codes in your links.cfg file:

Code:

$db_auto_validate = 1;


2) Add the following codes in the sub build_staggered routine in the nph-build.cgi file:

Code:

if ($db_auto_validate) {
$t1 = time();
print "** Auto Validating Links . . .\n";
&build_auto_validate (1);
print "** Done (", time - $t1, " s)!\n\n";
}


AFTER the following codes:

Code:

my $t1 = time();
print "** Loading Category information . . .\n";
&build_category_information;
print "** Done (", time - $t1, " s)!\n\n";


3) Add the following codes in the sub build_all routine in the nph-build.cgi file:

Code:

# Auto Validate Links
if ($db_auto_validate) {
print "Auto Validate Links. . .\n";
&build_url_index;
print "Done.\n\n";
}
else {
print "Auto-Validation Turned Off";
}


AFTER the following codes:

Code:

# Rebuild URL Index (This file is auto-generated, you will never need to touch it!
print "Building URL Index . . .\n";
&build_url_index;
print "Done.\n\n";


4) Add the following sub-routine in the nph-build.cgi file:

Code:

sub build_auto_validate {
#--------------------------------------------------------
# Auto Validates Links

my ($output, $validate);
my ($links) = 0;

open (VAL, "<$db_valid_name") or &cgierr("error in build_valid_review. unable to open validate file: $db_valid_name. Reason: $!");
if ($db_use_flock) { flock (VAL, 1); }
LINE: while (<VAL>) {
(/^#/) and ($output .= $_ and next LINE);
(/^\s*$/) and next LINE;
chomp;
$validate .= "$_\n" and $links++;
}
close VAL;

open (VAL, ">$db_valid_name") or &cgierr("error in validate_record. unable to open validate file: $db_valid_name. Reason: $!");
flock(VAL, 2) unless (!$db_use_flock);
print VAL $output;
close VAL;

open (DB, ">>$db_file_name") or &cgierr("error in build_auto_validate, unable to open db file: $db_file_name. Reason: $!");
flock(DB, 2) if ($db_use_flock);
print DB $validate;
print "\tValidated: $links Links\n";
close DB;
}


5) Then save the files.
6) Upload the new files to your web server.
7) Re-build your index via the nph-build.cgi script.

NOTE: The last set of codes are adapted from Widgetz's build_auto_review routine for the Review.cgi Mod.

Good luck!

Regards,

Eliot Lee
Quote Reply
Re: [Stealth] validate.db move In reply to
Hi, if I Build All nothing happens to the unvalidated links. I have to use Staggered for the links to become validated. Is this working as intended? I am using the auto build via cron and not sure how to make it use Staggered.


Thanks
Quote Reply
Re: [WTrippe] validate.db move In reply to
Building via cron doesn't let you run a "staggered" build ... only when doing from the web.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] validate.db move In reply to
The build all option doesn't validate the awaiting links. Is this mod working as intended?
Quote Reply
Re: [WTrippe] validate.db move In reply to
What exactly is this mod mean't to do? Validate listings and make them live whenever a build is done?

Afraid I'm a bit rusty with Links2, as I work with the SQL version now ;)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] validate.db move In reply to
Yes, it's suppose to validate all awaiting links. The staggered build works, but not the build all. I use cron to run the builds and would like it to be hands-free.
Quote Reply
Re: [WTrippe] validate.db move In reply to
Its a stab in the dark - but in nph-build.cgi, find:

Code:
else { &build_all; }

..and try changing to:

Code:
else {
if ($db_auto_validate) {
$t1 = time();
print "** Auto Validating Links . . .\n";
&build_auto_validate (1);
print "** Done (", time - $t1, " s)!\n\n";
}
&build_all;

}

MAKE SURE YOU BACKUP ALL THE FILES IN /admin/data before running though - in case it breaks something Wink

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] validate.db move In reply to
Nothing happened. It didn't even do the print statement.
Quote Reply
Re: [Andy] validate.db move In reply to
What happens if you add:

Code:
$db_auto_validate = 1;

..just BEFORE:

Code:
if ($db_auto_validate) {

?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] validate.db move In reply to
hmmm still nothing happening =(
Quote Reply
Re: [WTrippe] validate.db move In reply to
Mmm, I'll try and have a look later on a copy of Links2 I have on one of my dev sites.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates