Show
Ignore:
Timestamp:
05/18/06 17:06:43 (6 years ago)
Author:
nick
Message:

Finish shifting common code out into Listing.pm

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Feed/RSS.pm

    r295 r296  
    6262 
    6363  my @changes = $self->fetch_recently_changed_nodes(%args); 
    64   my $rss_timestamp = $self->rss_timestamp(%args); 
     64  my $rss_timestamp = $self->rss_timestamp( 
     65                              $self->fetch_oldest_for_recently_changed(%args) 
     66  ); 
    6567 
    6668  return $self->generate_node_list_feed($rss_timestamp, @changes); 
     
    214216=item B<rss_timestamp> 
    215217 
    216 Generate the timestamp for the RSS, by figuring out the age range of 
    217 the source data for the feed 
     218Generate the timestamp for the RSS, based on the oldest node (if available) 
    218219 
    219220=cut 
    220221sub rss_timestamp 
    221222{ 
    222   my ($self, %args) = @_; 
    223    
    224   my %criteria = (ignore_case => 1); 
    225  
    226   if ($args{days}) 
    227   { 
    228     $criteria{days} = $args{days}; 
    229   } 
    230   else 
    231   { 
    232     $criteria{last_n_changes} = $args{items} || 15; 
    233   } 
    234    
    235   if ($args{ignore_minor_edits}) 
    236   { 
    237     $criteria{metadata_wasnt} = { major_change => 0 }; 
    238   } 
    239    
    240   if ($args{filter_on_metadata}) 
    241   { 
    242     $criteria{metadata_was} = $args{filter_on_metadata}; 
    243   } 
    244  
    245   my @changes = $self->{wiki}->list_recent_changes(%criteria); 
    246  
    247   if ($changes[0]->{last_modified}) 
    248   { 
    249     my $time = Time::Piece->strptime( $changes[0]->{last_modified}, $self->{timestamp_fmt} ); 
    250  
    251     my $utc_offset = $self->{utc_offset}; 
    252      
    253     return $time->strftime( "%Y-%m-%dT%H:%M:%S$utc_offset" ); 
    254   } 
    255   else 
    256   { 
    257     return '1970-01-01T00:00:00+0000'; 
    258   } 
     223    my ($self, $oldest_node) = @_; 
     224 
     225    if ($oldest_node->{last_modified}) 
     226    { 
     227        my $time = Time::Piece->strptime( $oldest_node->{last_modified}, $self->{timestamp_fmt} ); 
     228 
     229        my $utc_offset = $self->{utc_offset}; 
     230 
     231        return $time->strftime( "%Y-%m-%dT%H:%M:%S$utc_offset" ); 
     232    } 
     233    else 
     234    { 
     235        return '1970-01-01T00:00:00+0000'; 
     236    } 
    259237} 
    260238