--- bin/import-strix.pl 2008/05/31 16:30:09 145 +++ bin/import-strix.pl 2008/06/03 10:10:20 146 @@ -10,6 +10,8 @@ use File::Find; use A3C::PHP; +my $debug = 0; + BEGIN { Jifty->new; }; Jifty->web->request(Jifty::Request->new); Jifty->web->response(Jifty::Response->new); @@ -23,7 +25,7 @@ find({ no_chdir => 1, wanted => sub { my $path = $File::Find::name; return unless -f $_; - warn "? $path\n"; + warn "? $path\n" if $debug; return unless m/conf\.php$/; $path =~ m{/etc/([^/]+)/conf\.php$} or die "can't find site name in $path"; @@ -31,12 +33,16 @@ my $data = A3C::PHP->parse_file( $path ); - warn "# PHP = ", dump( $data ); + warn "# PHP = ", dump( $data ) if $debug; $data->{site} = $site; my ($id,$msg) = $model->load_or_create( %$data ); - warn "$id $site ", $msg || 'ADDED', "\n"; - $total++ if $id; + Jifty->log->info("$id $site ", $msg || 'ADDED'); + if ( $id ) { + $total++; + } else { + Jifty->log->error("can't parse $path: $msg"); + } }}, $config->{dir} );