7 |
__PACKAGE__->mk_accessors(qw( |
__PACKAGE__->mk_accessors(qw( |
8 |
path |
path |
9 |
database |
database |
10 |
|
input |
11 |
)); |
)); |
12 |
|
|
13 |
use File::Path; |
use File::Path; |
15 |
use WebPAC::Common qw/force_array/; |
use WebPAC::Common qw/force_array/; |
16 |
use Carp qw/confess/; |
use Carp qw/confess/; |
17 |
use Cwd; |
use Cwd; |
18 |
|
use File::Slurp; |
19 |
|
|
20 |
use Jifty; |
use Jifty; |
21 |
|
|
135 |
my $count = 0; |
my $count = 0; |
136 |
|
|
137 |
foreach my $field ( keys %$fields ) { |
foreach my $field ( keys %$fields ) { |
138 |
$log->debug("adding search field: $field"); |
my $items = $fields->{$field} || confess "no field?"; |
139 |
$o->create( name => $field ); # || $log->logdie("can't add $field"); |
$log->debug("adding search field: $field [$items]"); |
140 |
|
$o->load_or_create( |
141 |
|
name => $field, |
142 |
|
items => $items, |
143 |
|
); # || $log->logdie("can't add $field"); |
144 |
$count++; |
$count++; |
145 |
} |
} |
146 |
|
|
147 |
|
$log->info("synced $count search fields with Webpacus"); |
148 |
|
|
149 |
|
my $glue_path = "$path/lib/Webpacus/Webpac.pm"; |
150 |
|
|
151 |
|
$log->info("creating clue class Webpacus::Webpac at $glue_path"); |
152 |
|
|
153 |
|
my $glue = <<"_END_OF_GLUE_"; |
154 |
|
package Webpacus::Webpac; |
155 |
|
|
156 |
|
=head1 NAME |
157 |
|
|
158 |
|
Webpacus::Webpac - configuration exported from WebPAC |
159 |
|
|
160 |
|
=cut |
161 |
|
|
162 |
|
use strict; |
163 |
|
use warnings; |
164 |
|
|
165 |
|
sub index_path { '/data/webpac2/var/kinosearch/webpacus' }; |
166 |
|
|
167 |
|
1; |
168 |
|
_END_OF_GLUE_ |
169 |
|
|
170 |
|
$log->debug("glue source:\n$glue"); |
171 |
|
|
172 |
|
write_file( $glue_path, $glue ) || $log->logdie("can't create $glue_path: $!"); |
173 |
|
|
174 |
return $count; |
return $count; |
175 |
|
|
176 |
} |
} |