/[Grep]/lib/Grep/Action/Fetch.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Grep/Action/Fetch.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 46 by dpavlin, Tue Feb 20 22:44:59 2007 UTC revision 47 by dpavlin, Wed Feb 21 03:04:48 2007 UTC
# Line 13  use base qw/Grep::Action Jifty::Action/; Line 13  use base qw/Grep::Action Jifty::Action/;
13  use XML::Feed;  use XML::Feed;
14  use LWP::UserAgent;  use LWP::UserAgent;
15    
16    use Grep::Search;
17    
18  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
19    
20  use Jifty::Param::Schema;  use Jifty::Param::Schema;
# Line 124  sub take_action { Line 126  sub take_action {
126                          modified => $entry->modified ? $entry->modified->strftime("%Y-%m-%d %H:%M:%S") : undef,                          modified => $entry->modified ? $entry->modified->strftime("%Y-%m-%d %H:%M:%S") : undef,
127                  );                  );
128    
129                    $msg ||= '';
130    
131                  if ( $ok ) {                  if ( $ok ) {
132                          Jifty->log->debug("item ", $i->id, ": $msg");                          Jifty->log->debug("item ", $i->id, ": $msg");
133                          $items->add_record( $i );                          $items->add_record( $i );
134                          # count new objects  
135                          $new++ if ($msg !~ m/^Found/);                          # is new record?
136                            if ( $msg !~ m/^Found/ ) {
137                                    $new++;
138                                    Grep::Search->add( $i );
139                            }
140                  } else {                  } else {
141                          warn "can't add entry ", dump( $entry ), "\n";                          warn "can't add entry ", dump( $entry ), "\n";
142                  }                  }
# Line 150  sub take_action { Line 158  sub take_action {
158                  $self->result->content( items => $items );                  $self->result->content( items => $items );
159                  $self->result->content( count => $items->count );                  $self->result->content( count => $items->count );
160    
161                    Grep::Search->finish if $new;
162    
163          } else {          } else {
164                  return $self->result->error( "No results for '$q' in " . $feed->title );                  return $self->result->error( "No results for '$q' in " . $feed->title );
165          }          }

Legend:
Removed from v.46  
changed lines
  Added in v.47

  ViewVC Help
Powered by ViewVC 1.1.26