Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: Days Old Plug In works okay?

Quote Reply
Re: Days Old Plug In works okay? In reply to
BTW... to really "fix" this problem, and save cycles the next time, you could alter the code above to be:

Code:
if (($link->{'isNew'} eq 'Yes') or ($link->{'isNew'} == 1)){
$link->{'Days_Old'} = GT::Date::date_diff ( GT::Date::date_get(), $link->{'Add_Date'});
if ($link->{'Days_Old'} > $CFG->{'build_new_cutoff'}) {
my $LINK_DB = $DB->table('Links');
$LINK_DB->update (
{
isNew => 'No'
},
{
ID => $link->{'ID'}
}
);
($link->{'isNew'} eq 'Yes') && ($link->{'isNew'} = 'No');
($link->{'isNew'} eq '1') && ($link->{'isNew'} = '0');
}
#delete $link->{'Days_Old'}; ## undef isn't enough for consistency in some cases
$link->{'Days_Old'} = ''; ## undef, or set to null
}
Should be self explanatory, but if the Days_Old is greater than the cutoff date,
the database record is updated (so this won't happen again) and the current value
of isNew is also altered, changed to 0 or 'No' depending.

I haven't tested this, but it should work. It's pretty straight forward.

You also need to change the top of the file to

use Links qw/$IN $CFG $DB/;

The $TPL is no longer used, and should be deleted.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Plugins:http://LinkSQL.com/plugin
Subject Author Views Date
Thread Days Old Plug In works okay? Pitman 6792 Apr 19, 2001, 10:44 AM
Thread Re: Days Old Plug In works okay?
katabd 6742 Apr 19, 2001, 11:34 AM
Thread Re: Days Old Plug In works okay?
Pitman 6716 Apr 19, 2001, 12:17 PM
Thread Re: Days Old Plug In works okay?
Clint 6639 Apr 19, 2001, 10:37 PM
Thread Re: Days Old Plug In works okay?
pugdog 6665 Apr 19, 2001, 11:43 PM
Thread Re: Days Old Plug In works okay?
Pitman 6620 Apr 21, 2001, 8:24 AM
Thread Re: Days Old Plug In works okay?
Robert_B 6639 Jul 11, 2001, 6:56 AM
Thread Re: Days Old Plug In works okay?
pugdog 6610 Jul 11, 2001, 12:10 PM
Thread Re: Days Old Plug In works okay?
pugdog 6585 Jul 12, 2001, 8:19 AM
Thread Re: Days Old Plug In works okay?
pugdog 6592 Jul 14, 2001, 2:40 AM
Thread Re: Days Old Plug In works okay?
Pitman 6583 Jul 14, 2001, 4:40 PM
Post Re: Days Old Plug In works okay?
pugdog 6586 Jul 14, 2001, 8:08 PM
Thread Re: Days Old Plug In works okay?
pugdog 6542 Jul 16, 2001, 1:20 AM
Thread Re: [pugdog] Days Old Plug In works okay?
pugdog 6349 Jan 1, 2002, 6:58 PM
Post Re: [pugdog] Days Old Plug In works okay?
pugdog 6335 Jan 2, 2002, 6:30 AM