Show
Ignore:
Timestamp:
05/25/06 17:46:22 (6 years ago)
Author:
nick
Message:

Add an option to also return the feed timestamp

Files:
1 modified

Legend:

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

    r313 r314  
    5656using any supplied parameters to narrow the results. 
    5757 
     58If the argument "also_return_timestamp" is supplied, it will return an 
     59array of the feed, and the feed timestamp. Otherwise it just returns the feed. 
     60 
    5861=cut 
    5962sub recent_changes 
     
    6669    ); 
    6770 
    68     return $self->generate_node_list_feed($feed_timestamp, @changes); 
     71    my $feed = $self->generate_node_list_feed($feed_timestamp, @changes); 
     72 
     73    if($args{'also_return_timestamp'}) { 
     74        return ($feed,$feed_timestamp); 
     75    } else { 
     76        return $feed; 
     77    } 
    6978} 
    7079 
     
    7382 
    7483Build an RSS Feed of all the different versions of a given node. 
     84 
     85If the argument "also_return_timestamp" is supplied, it will return an 
     86array of the feed, and the feed timestamp. Otherwise it just returns the feed. 
    7587 
    7688=cut 
     
    8294    my $feed_timestamp = $self->feed_timestamp( $all_versions[0] ); 
    8395 
    84     return $self->generate_node_list_feed($feed_timestamp, @all_versions); 
     96    my $feed = $self->generate_node_list_feed($feed_timestamp, @all_versions); 
     97 
     98    if($args{'also_return_timestamp'}) { 
     99        return ($feed,$feed_timestamp); 
     100    } else { 
     101        return $feed; 
     102    } 
    85103} 
    86104 
     
    265283    } 
    266284} 
    267 # Compatibility method 
     285 
     286# Compatibility method - use feed_timestamp with a node instead 
    268287sub rss_timestamp { 
    269     return feed_timestamp(@_); 
     288    my ($self, %args) = @_; 
     289 
     290    warn("Old style method used - please convert to calling feed_timestamp with a node!"); 
     291    my $feed_timestamp = $self->feed_timestamp( 
     292                              $self->fetch_newest_for_recently_changed(%args) 
     293    ); 
     294    return $feed_timestamp; 
    270295} 
    271296