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