BTW... to really "fix" this problem, and save cycles the next time, you could alter the code above to be:
$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
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
}
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