/[A3C]/bin/import-strix.pl
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 /bin/import-strix.pl

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

revision 173 by dpavlin, Tue Jun 3 10:22:49 2008 UTC revision 174 by dpavlin, Mon Jun 16 16:48:16 2008 UTC
# Line 18  Jifty->web->response(Jifty::Response->ne Line 18  Jifty->web->response(Jifty::Response->ne
18    
19  my $config = Jifty->config->app('strix') or die "need strix config";  my $config = Jifty->config->app('strix') or die "need strix config";
20    
21  my $model = A3C::Model::StrixSite->new;  my $model = A3C::Model::StrixInstance->new;
22    
23  my $total = 0;  my $total = 0;
24    
# Line 28  find({ no_chdir => 1, wanted => sub { Line 28  find({ no_chdir => 1, wanted => sub {
28          warn "? $path\n" if $debug;          warn "? $path\n" if $debug;
29          return unless m/conf\.php$/;          return unless m/conf\.php$/;
30    
31          $path =~ m{/etc/([^/]+)/conf\.php$} or die "can't find site name in $path";          $path =~ m{/etc/([^/]+)/conf\.php$} or die "can't find instance name in $path";
32          my $site = $1;          my $instance = $1;
33    
34          my $data = A3C::PHP->parse_file( $path );          my $data = A3C::PHP->parse_file( $path );
35    
36          warn "# PHP = ", dump( $data ) if $debug;          warn "# PHP = ", dump( $data ) if $debug;
37          $data->{site} = $site;          $data->{instance} = $instance;
38    
39          my ($ok,$msg) = $model->load_or_create( %$data );          my ($ok,$msg) = $model->load_or_create( %$data );
40          if ( $ok ) {          if ( $ok ) {
41                  Jifty->log->info("$ok $site ", $msg || 'ADDED');                  Jifty->log->info("$ok $instance ", $msg || 'ADDED');
42                  $total++;                  $total++;
43          } else {          } else {
44                  Jifty->log->error("can't parse $path");                  Jifty->log->error("can't parse $path");
# Line 46  find({ no_chdir => 1, wanted => sub { Line 46  find({ no_chdir => 1, wanted => sub {
46    
47  }}, $config->{dir} );  }}, $config->{dir} );
48    
49  Jifty->log->info( "$total Strix sites imported" );  Jifty->log->info( "$total Strix instances imported" );

Legend:
Removed from v.173  
changed lines
  Added in v.174

  ViewVC Help
Powered by ViewVC 1.1.26