/[webpac2]/trunk/lib/WebPAC/Output/Webpacus.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 /trunk/lib/WebPAC/Output/Webpacus.pm

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

revision 950 by dpavlin, Thu Nov 1 00:16:48 2007 UTC revision 951 by dpavlin, Thu Nov 1 00:16:52 2007 UTC
# Line 121  sub finish { Line 121  sub finish {
121    
122          $log->debug("fields = ", sub { dump $fields });          $log->debug("fields = ", sub { dump $fields });
123    
         $log->info("using Webpacus installation: $path");  
   
124          my $webpac_dir = getcwd();          my $webpac_dir = getcwd();
125    
126          chdir $path || $log->logdie("can't chdir($path) $!");          chdir $path || $log->logdie("can't chdir($path) $!");
# Line 132  sub finish { Line 130  sub finish {
130          my $system_user = Webpacus::CurrentUser->superuser;          my $system_user = Webpacus::CurrentUser->superuser;
131          my $o = Webpacus::Model::Search->new(current_user => $system_user);          my $o = Webpacus::Model::Search->new(current_user => $system_user);
132    
133          my $count = 0;          my ( $count, $new, $updated ) = ( 0, 0, 0 );
134    
135          foreach my $field ( keys %$fields ) {          foreach my $field ( keys %$fields ) {
136                  my $items = $fields->{$field} || confess "no field?";                  my $items = $fields->{$field} || confess "no field?";
137                  $log->debug("adding search field: $field [$items]");  
138                  $o->load_by_cols(                  my ( $id, $msg ) = $o->load_by_cols( name => $field );
139                          name => $field,  
140                  ) ||                  if ( $id ) {
141                  $o->create(                          $o->set_items( $items );
142                          name => $field,                          $log->debug("updated search field: $field [$items] ID: $id $msg");
143                          items => $items,                          $updated++;
144                  ); # || $log->logdie("can't add $field");                  } else {
145                            $log->debug("adding search field: $field [$items] $msg");
146                            $o->create(
147                                    name => $field,
148                                    items => $items,
149                            );
150                            $new++;
151                    }
152    
153                  $count++;                  $count++;
154          }          }
155    
156          $log->info("synced $count search fields with Webpacus");          $log->info("synced $count search fields with Webpacus ($new new/$updated updated) at $path");
157    
158          my $glue_path = "$path/lib/Webpacus/Webpac.pm";          my $glue_path = "$path/lib/Webpacus/Webpac.pm";
159    
160          $log->info("creating clue class Webpacus::Webpac at $glue_path");          $log->debug("creating clue class Webpacus::Webpac at $glue_path");
161    
162          my $glue = <<"_END_OF_GLUE_";          my $glue = <<"_END_OF_GLUE_";
163  package Webpacus::Webpac;  package Webpacus::Webpac;

Legend:
Removed from v.950  
changed lines
  Added in v.951

  ViewVC Help
Powered by ViewVC 1.1.26