Changeset 314

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

Add an option to also return the feed timestamp

Location:
wiki-toolkit/trunk/lib/Wiki/Toolkit/Feed
Files:
2 modified

Legend:

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

    r312 r314  
    5555using any supplied parameters to narrow the results. 
    5656 
     57If the argument "also_return_timestamp" is supplied, it will return an 
     58array of the feed, and the feed timestamp. Otherwise it just returns the feed. 
     59 
    5760=cut 
    5861sub recent_changes 
     
    6568    ); 
    6669 
    67     return $self->generate_node_list_feed($atom_timestamp, @changes); 
     70    my $feed = $self->generate_node_list_feed($atom_timestamp, @changes); 
     71 
     72    if($args{'also_return_timestamp'}) { 
     73        return ($feed,$feed_timestamp); 
     74    } else { 
     75        return $feed; 
     76    } 
    6877} 
    6978 
     
    7281 
    7382Build an Atom Feed of all the different versions of a given node. 
     83 
     84If the argument "also_return_timestamp" is supplied, it will return an 
     85array of the feed, and the feed timestamp. Otherwise it just returns the feed. 
    7486 
    7587=cut 
     
    8193    my $feed_timestamp = $self->feed_timestamp( $all_versions[0] ); 
    8294 
    83     return $self->generate_node_list_feed($feed_timestamp, @all_versions); 
     95    my $feed = $self->generate_node_list_feed($feed_timestamp, @all_versions); 
     96 
     97    if($args{'also_return_timestamp'}) { 
     98        return ($feed,$feed_timestamp); 
     99    } else { 
     100        return $feed; 
     101    } 
    84102}  
    85103 
  • 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