]> lifelog.hopto.org Git - PerlCNF.git/commitdiff
Fix. merge with Lifelog changes RSSFeedPlugin.
authorWill Budic <redacted>
Mon, 20 May 2024 12:09:08 +0000 (22:09 +1000)
committerWill Budic <redacted>
Mon, 20 May 2024 12:09:08 +0000 (22:09 +1000)
system/modules/RSSFeedsPlugin.pm
tests/testSQL.pl

index 81b644f04059d3c6ac3048d4bf6d2e65ffdc3c69..a4c2ffcd3e577e61eb5e1a97e0dd7e10fa849ac8 100644 (file)
@@ -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){
index 59cefe19722b276a87576c203972d0fba95e26ac..9ff9338497aae4b7e87c79d0a189ff79e902b78b 100644 (file)
@@ -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);