|
Lines 49-55
my $interval;
Link Here
|
| 49 |
my $usestats = 0; |
49 |
my $usestats = 0; |
| 50 |
my $useitems = 0; |
50 |
my $useitems = 0; |
| 51 |
my $incremental = 0; |
51 |
my $incremental = 0; |
| 52 |
my $commit = 100; |
52 |
my $progress = 100; |
| 53 |
my $unit; |
53 |
my $unit; |
| 54 |
|
54 |
|
| 55 |
my $command_line_options = join(" ",@ARGV); |
55 |
my $command_line_options = join(" ",@ARGV); |
|
Lines 62-68
my $result = GetOptions(
Link Here
|
| 62 |
'use-stats' => \$usestats, |
62 |
'use-stats' => \$usestats, |
| 63 |
'use-items' => \$useitems, |
63 |
'use-items' => \$useitems, |
| 64 |
'incremental' => \$incremental, |
64 |
'incremental' => \$incremental, |
| 65 |
'c|commit=i' => \$commit, |
65 |
'p|progress=i' => \$progress, |
| 66 |
'h|help' => \$want_help |
66 |
'h|help' => \$want_help |
| 67 |
); |
67 |
); |
| 68 |
|
68 |
|
|
Lines 88-101
unless ( $usestats || $useitems ) {
Link Here
|
| 88 |
$want_help = 1; |
88 |
$want_help = 1; |
| 89 |
} |
89 |
} |
| 90 |
|
90 |
|
| 91 |
if ( not $result or $want_help ) { |
91 |
usage() if $want_help; |
| 92 |
usage(); |
|
|
| 93 |
} |
| 94 |
|
92 |
|
| 95 |
cronlogaction({ info => $command_line_options }); |
93 |
cronlogaction({ info => $command_line_options }); |
| 96 |
|
94 |
|
| 97 |
my $dbh = C4::Context->dbh; |
95 |
my $dbh = C4::Context->dbh; |
| 98 |
$dbh->{AutoCommit} = 0; |
|
|
| 99 |
|
96 |
|
| 100 |
my $num_bibs_processed = 0; |
97 |
my $num_bibs_processed = 0; |
| 101 |
my $num_bibs_updated = 0; |
98 |
my $num_bibs_updated = 0; |
|
Lines 146-152
sub process_stats {
Link Here
|
| 146 |
GROUP BY biblio.biblionumber"; |
143 |
GROUP BY biblio.biblionumber"; |
| 147 |
process_query( $query, $limit ); |
144 |
process_query( $query, $limit ); |
| 148 |
|
145 |
|
| 149 |
$dbh->commit(); |
|
|
| 150 |
} |
146 |
} |
| 151 |
|
147 |
|
| 152 |
sub process_query { |
148 |
sub process_query { |
|
Lines 180-191
sub process_query {
Link Here
|
| 180 |
$num_bibs_updated++; |
176 |
$num_bibs_updated++; |
| 181 |
} |
177 |
} |
| 182 |
} |
178 |
} |
| 183 |
if ( not $test_only and ( $num_bibs_processed % $commit ) == 0 ) { |
179 |
if ( not $test_only and ( $num_bibs_processed % $progress ) == 0 ) { |
| 184 |
print_progress_and_commit($num_bibs_processed); |
180 |
print_progress($num_bibs_processed); |
| 185 |
} |
181 |
} |
| 186 |
} |
182 |
} |
| 187 |
|
183 |
|
| 188 |
$dbh->commit(); |
|
|
| 189 |
} |
184 |
} |
| 190 |
|
185 |
|
| 191 |
sub report { |
186 |
sub report { |
|
Lines 209-217
_SUMMARY_
Link Here
|
| 209 |
print $summary; |
204 |
print $summary; |
| 210 |
} |
205 |
} |
| 211 |
|
206 |
|
| 212 |
sub print_progress_and_commit { |
207 |
sub print_progress { |
| 213 |
my $recs = shift; |
208 |
my $recs = shift; |
| 214 |
$dbh->commit(); |
|
|
| 215 |
print "... processed $recs records\n"; |
209 |
print "... processed $recs records\n"; |
| 216 |
} |
210 |
} |
| 217 |
|
211 |
|
|
Lines 223-229
update_totalissues.pl
Link Here
|
| 223 |
|
217 |
|
| 224 |
update_totalissues.pl --use-stats |
218 |
update_totalissues.pl --use-stats |
| 225 |
update_totalissues.pl --use-items |
219 |
update_totalissues.pl --use-items |
| 226 |
update_totalissues.pl --commit=1000 |
220 |
update_totalissues.pl --progress=1000 |
| 227 |
update_totalissues.pl --since='2012-01-01' |
221 |
update_totalissues.pl --since='2012-01-01' |
| 228 |
update_totalissues.pl --interval=30d |
222 |
update_totalissues.pl --interval=30d |
| 229 |
|
223 |
|
|
Lines 273-281
job to update popularity information during low-usage periods. If neither
Link Here
|
| 273 |
--since or --interval are specified, incremental mode will default to |
267 |
--since or --interval are specified, incremental mode will default to |
| 274 |
processing the last twenty-four hours. |
268 |
processing the last twenty-four hours. |
| 275 |
|
269 |
|
| 276 |
=item B<--commit=N> |
270 |
=item B<--progress=N> |
| 277 |
|
271 |
|
| 278 |
Commit the results to the database after every N records are processed. |
272 |
Print the progress to standart output after every N records are processed. |
| 279 |
|
273 |
|
| 280 |
=item B<--test> |
274 |
=item B<--test> |
| 281 |
|
275 |
|
| 282 |
- |
|
|