From 61a5eaf663ad54322144515d2593dc4e83314466 Mon Sep 17 00:00:00 2001 From: Will Budic Date: Mon, 20 May 2024 22:09:08 +1000 Subject: [PATCH] Fix. merge with Lifelog changes RSSFeedPlugin. --- system/modules/RSSFeedsPlugin.pm | 16 ++++++++++------ tests/testSQL.pl | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/system/modules/RSSFeedsPlugin.pm b/system/modules/RSSFeedsPlugin.pm index 81b644f..a4c2ffc 100644 --- a/system/modules/RSSFeedsPlugin.pm +++ b/system/modules/RSSFeedsPlugin.pm @@ -1,7 +1,8 @@ package RSSFeedsPlugin; use strict; -use warnings; no warnings qw(experimental::signatures); +use warnings; +no warnings qw(experimental::signatures); use feature qw(signatures); use Scalar::Util qw(looks_like_number); use Syntax::Keyword::Try; @@ -15,7 +16,7 @@ use LWP::Simple; use Benchmark; -use constant VERSION => '1.0'; +use constant VERSION => '1.1'; # require CNFNode; # require CNFDateTime; @@ -30,6 +31,8 @@ sub new ($class, $plugin){ return bless $settings, $class } + + ### # Process config data to contain expected fields. ### @@ -37,7 +40,7 @@ sub process ($self, $parser, $property) { my $table = $parser->data()->{$property}; if(!$table){ - $parser->error("RSSFeedsPlugin\@Error Table property not foun -> $property"); return + $parser->error("RSSFeedsPlugin\@Error Table property not found -> $property"); return } my $cgi = $parser->const('CGI'); $self->{date} = now(); @@ -105,7 +108,7 @@ sub collectFeeds($self, $parser) { my @col = @{$data[$idx]}; my $name = $col[$hdr{Name}]; next if($feed && $feed ne $name); - my $tree = fetchFeed($self, $name, $col[$hdr{URL}], $col[$hdr{Description}]); + my $tree = fetchFeed($self, $name, $col[$hdr{URL}], $col[$hdr{Expires}], $col[$hdr{Description}]); $parser->log("Fetched feed:".$name); if($tree && ref($$tree) eq 'CNFNode'){ if(not isCNFTrue($self->{CNF_TREE_LOADED}) && isCNFTrue($self->{CNF_TREE_STORE})){ @@ -181,7 +184,7 @@ sub getOutputDir($self){ return $output_local } -sub fetchFeed($self,$name,$url,$description){ +sub fetchFeed($self, $name, $url, $expires, $description){ my ($MD, $tree, $brew,$bench); my $console = isCNFTrue($self->{OUTPUT_TO_CONSOLE}); @@ -198,7 +201,8 @@ sub fetchFeed($self,$name,$url,$description){ if(-e $fname) { my $now = new Date::Manip::Date -> new_date(); $now->parse("today"); my $fdate = new Date::Manip::Date; - my $fsepoch = (stat($fname))[9]; $fdate->parse("epoch $fsepoch"); $fdate->parse("3 business days"); + $expires = "3 business days" if not $expires; + my $fsepoch = (stat($fname))[9]; $fdate->parse("epoch $fsepoch"); $fdate->parse($expires); my $delta = $fdate->calc($now); $self->{CNF_TREE_LOADED} = 0; if($now->cmp($fdate)>0){ diff --git a/tests/testSQL.pl b/tests/testSQL.pl index 59cefe1..9ff9338 100644 --- a/tests/testSQL.pl +++ b/tests/testSQL.pl @@ -81,7 +81,7 @@ try{ )); my $central = $cnf->property('DB_CENTRAL'); my $db = CNFSQL::_connectDB('test','test',$central->{DBI_SQL_SOURCE},$central->{DB}.'.db'); - my $sql = $cnf->SQL(); + $sql = $cnf->SQL(); $sql -> {data } = $sql->{parser}->data(); #$sql -> initDatabase($db,0,{'TBL_A' => ['TBL_A_DATA','name','ID']}); $sql -> initDatabase($db,0); -- 2.34.1