c0714a99f2
Because updating the total issues count associated with a bibliographic record on issue could cause a significant load on the server, this commit adds the syspref UpdateTotalIssuesOnCirc (which defaults to OFF to match existing behavior). The syspref has the following description: Do/Do not update a bibliographic record's total issues count whenever an item is issued (WARNING! This increases server load significantly; if performance is a concern, use the update_totalissues.pl cron job to update the total issues count). Bug 6557: automatically increment totalissues Adds the ability to automatically increment biblioitems.totalissues whenever an item is issued. To test: 1) Choose a record with at least one item that can circulate 2) Check the value of 942$0 (you may need to look at the plain MARC view on the OPAC). Most likely there won't be any 942$0 at all 3) Enable UpdateTotalIssuesOnCirc 4) Check out the item you selected 5) Check the value of 942$0 (you may need to look at the plain MARC view on the OPAC). That value should now be one greater than before 6) Discharge the item 7) Disable UpdateTotalIssuesOnCirc 8) Check out the item you selected again 9) Check the value of 942$0 (you may need to look at the plain MARC view on the OPAC). That value should not have changed Bug 6557: add script to update totalissues from stats NAME update_totalissues.pl SYNOPSIS update_totalissues.pl --use-stats update_totalissues.pl --use-items update_totalissues.pl --commit=1000 update_totalissues.pl --since='2012-01-01' update_totalissues.pl --interval=30d DESCRIPTION This batch job populates bibliographic records' total issues count based on historical issue statistics. --help Prints this help -v|--verbose Provide verbose log information (list every bib modified). --use-stats Use the data in the statistics table for populating total issues. --use-items Use items.issues data for populating total issues. Note that issues data from the items table does not respect the --since or --interval options, by definition. Also note that if both --use-stats and --use-items are specified, the count of biblios processed will be misleading. -s|--since=DATE Only process issues recorded in the statistics table since DATE. -i|--interval=S Only process issues recorded in the statistics table in the last N units of time. The interval should consist of a number with a one-letter unit suffix. The valid suffixes are h (hours), d (days), w (weeks), m (months), and y (years). The default unit is days. --incremental Add the number of issues found in the statistics table to the existing total issues count. Intended so that this script can be used as a cron job to update popularity information during low-usage periods. If neither --since or --interval are specified, incremental mode will default to processing the last twenty-four hours. --commit=N Commit the results to the database after every N records are processed. --test Only test the popularity population script. WARNING If the time on your database server does not match the time on your Koha server you will need to take that into account, and probably use the --since argument instead of the --interval argument for incremental updating. === TESTING PLAN === NOTE: in order to test this script, you will need to have some sort of circulation data already existing in your Koha installation. 1) Disable UpdateTotalIssuesOnCirc 2) Run: misc/cronjobs/update_totalissues.pl --use-items -t -v 3) If you have total checkout data in your item records (i.e. anything in 952$l), you should see messages like "Processing bib 43 (1 issues)" 4) Choose one of the lines that shows more than 0 issues, and view the record with that biblionumber in the staff client, choosing the "Items" tab (moredetail.pl). Add up the "Total checkouts" listed for each item, and confirm it matches what the script reported 5) Run: misc/cronjobs/update_totalissues.pl --use-stats -t -v 6) If you have any circulation statistics in your database (i.e. any 'issue' entries in your statistics table), you should see messages like "Processing bib 43 (1 issues)"; 7) Choose one of the lines and view the record with that biblionumber in the staff client, choosing the "Items" tab (moredetail.pl). If you count the number of checkouts listed in each item's checkout history, the total should match what the script reported. 8) Check out an item 9) Run: misc/cronjobs/update_totalissues.pl --use-stats --incremental --interval=1h -t -v 10) You should see one line reporting a single circ for the bib record associated with the item you just checked out (there may be more if you checked out any books in the hour prior to running these tests 11) If the results in steps 4, 7, and 10 match the predictions, the script worked This patch to Koha was sponsored by the Arcadia Public Library and the Arcadia Public Library Foundation in honor of Jackie Faust-Moreno, late director of the Arcadia Public Library. Signed-off-by: Liz Rea <wizzyrea@gmail.com> Tested this with my test data - numbers are correct and updated appropriately. More importantly - if I do a popularity search, the most popular items *come up first*. Amazing.
84 lines
3.3 KiB
Text
84 lines
3.3 KiB
Text
# Koha Example Crontab File
|
|
# Author: Joe Atzberger <atz@liblime.com>
|
|
#
|
|
# This is an example of a crontab file for Debian. It may not work
|
|
# in other versions of crontab, like on Solaris 8 or BSD, for example.
|
|
#
|
|
# While similar in structure,
|
|
# this is NOT an example for cron (as root). Cron takes an extra
|
|
# argument per line to designate the user to run as. You could
|
|
# reasonably extrapolate the needed info from here though.
|
|
#
|
|
# WARNING: These jobs will do things like charge fines, send
|
|
# potentially VERY MANY emails to patrons and even debar offending
|
|
# users. DO NOT RUN OR SCHEDULE these jobs without being sure you
|
|
# really intend to. Make sure the relevant message templates are
|
|
# configured to your liking before scheduling messages to be sent.
|
|
#
|
|
# ENVIRONMENT:
|
|
# First, establish Koha's two important ENV variables.
|
|
|
|
PERL5LIB=/usr/share/koha/lib
|
|
KOHA_CONF=/etc/koha/koha-conf.xml
|
|
|
|
# Some additional variables to save you typing
|
|
KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs
|
|
#
|
|
# MULTIPLE KOHA SUPPORT:
|
|
# You can still run jobs for this user's additional koha installs,
|
|
# by manipulating those variables in the command.
|
|
#
|
|
# For example, on the same codebase:
|
|
# */10 * * * * KOHA_CONF=/etc/koha/koha-conf.xml /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
|
|
#
|
|
# For example, on a separate codebase:
|
|
# */10 * * * * KOHA_CONF=/etc/koha/koha-conf.xml PERL5LIB=/home/koha/kohaclone /home/koha/kohaclone/misc/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
|
|
#
|
|
# ADDITIONAL INFO:
|
|
# See the perldoc of individual scripts to determine what other options
|
|
# are available. Check the man page for crontab to understand the
|
|
# schedule syntax for your system.
|
|
#
|
|
# NOTE: Don't forget to keep the empty line at the bottom.
|
|
# Cron/crontab will choke without it.
|
|
#
|
|
# SCHEDULED JOBS:
|
|
# m h dom mon dow command
|
|
|
|
# OVERDUE NOTICES
|
|
0 1 * * * $KOHA_CRON_PATH/overdue_notices.pl -t
|
|
|
|
# FINES
|
|
5 1 * * * $KOHA_CRON_PATH/fines.pl
|
|
|
|
# ADVANCE NOTICES
|
|
10 1 * * * $KOHA_CRON_PATH/advance_notices.pl -c
|
|
|
|
# PROCESS LONG OVERDUES
|
|
# updates item status from available to longoverdue for items long overdue
|
|
# 19 1 * * * $KOHA_CRON_PATH/longoverdue.pl --lost 90=1 --confirm
|
|
|
|
# SEND EMAILS
|
|
15 * * * * $KOHA_CRON_PATH/process_message_queue.pl
|
|
|
|
# Hourly holds queue updated
|
|
52 * * * * $KOHA_CRON_PATH/holds/build_holds_queue.pl >/dev/null 2>&1
|
|
|
|
# Cancel expired holds
|
|
0 1 * * * $KOHA_CRON_PATH/holds/cancel_expired_holds.pl >/dev/null 2>&1
|
|
|
|
# Update popularity counts for biblio records
|
|
0 2 * * * $KOHA_CRON_PATH/update_totalissues.pl --commit=1000 --use-stats --incremental --interval=1d >/dev/null 2>&1
|
|
|
|
# ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day
|
|
# for both authorities and bibs
|
|
*/10 * * * * $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
|
|
|
|
# services_throttle -- resets the xISBN service
|
|
59 23 * * * $KOHA_CRON_PATH/services_throttle.pl > /dev/null 2>&1
|
|
|
|
# clean up databases nightly. Be sure not to run this with --sessions during a time when the system is in use!
|
|
16 1 * * * $KOHA_CRON_PATH/cleanup_database.pl --sessions --zebraqueue 10
|
|
|
|
# delete old purchase suggestions weekly. Replace XX with a number to define the age of suggestions to delete.
|
|
@weekly $KOHA_CRON_PATH/purge_suggestions.pl --days XX > /dev/null 2>&1
|