This is an old revision of the document!
Table of Contents
Command Line Utilities
VuFind comes with several command-line utilities for manipulating its Solr index, maintaining its database, and performing other tasks without relying on the web interface.
Running the Tools
The command line tools are organized into controllers and actions, just like the web portion of the VuFind application. (See the VuFindConsole module of the code for the implementation details). The specific controllers and actions are documented below. Once you know which one you need, you can run it following these instructions.
Using Zend Framework
In VuFind 2.4 or newer, the most consistent way to run command line tools is to run them through Zend Framework directly using the application's index.php script.
The “PHP scripts in directory” approach to command line utilities was designed for backward compatibility with the structure of early VuFind releases. However, the introduction of Zend Framework in VuFind 2 allowed a route-based approach where all commands can be invoked through a single endpoint – the application's index.php script.
php $VUFIND_HOME/public/index.php [controller] [action] [additional parameters]
Using Legacy Wrapper Scripts
Prior to VuFind 2.4, the only way to access command line scripts was to run PHP scripts whose filenames corresponded with action names, and which were stored in directories corresponding with controller names. These could be run like this:
php $VUFIND_HOME/controller/action.php [additional parameters]
Troubleshooting
When running command line tools, it is important to make sure that you have appropriate VUFIND_HOME, VUFIND_LOCAL_DIR and VUFIND_LOCAL_MODULES environment variables set so that the correct code and configuration is loaded.
Many of VuFind's command-line tools make use of a disk-based cache to improve performance. This cache is most commonly found in the $VUFIND_LOCAL_DIR/cache/cli directory, unless you have custom configuration to use an alternate cache location. You should make sure that the user account running the tools has read and write permission for this cache directory.
Available Actions
A summary of all available actions can be viewed (in VuFind 2.4 or newer) by running:
php $VUFIND_HOME/public/index.php
Most of these actions are also summarized below, grouped by controller. However, in case this documentation falls out of date, the index.php output is always the most current way of finding all available tools.
compile controller
The compile controller contains the theme compiler that was introduced in VuFind 4.1.
generate controller
The generate controller (introduced in release 2.4) contains code generation tools to help automate common VuFind customization tasks. It is documented in more detail on the code generators page.
harvest controller
The harvest controller contains tools for collecting and managing records prior to import into VuFind.
Actions:
- harvest_oai
Tool for OAI-PMH harvesting. - merge-marc
Tool for merging individual MARC records together into a single collection (useful for improving import speed after harvesting records).
import controller
The import controller contains tools for loading records into VuFind's Solr index.
Actions:
- import-xsl
Tool for importing XML files into Solr using XSLT. - webcrawl
Tool for populating the website index when indexing websites.
language controller
The language controller contains tools for managing VuFind's i18n language files.
Actions:
- addusingtemplate
Create a new string by combining one or more existing strings using a template. - copystring
Copy one language string to another in all of the language files. - delete
Delete a language string from all of the language files. - normalize
Normalize (sort/deduplicate/tidy) a directory of language files.
util controller
The util controller is a catch-all for a variety of useful utilities.
Actions:
- cleanup_record_cache
Clean out the record cache, when used - commit
Commit the Solr index. - createHierarchyTrees
Populate the hierarchy cache when using hierarchies and collections. - cssBuilder
Compile LESS files into CSS within all themes. - dedupe
Remove duplicate lines from a text file. - deletes
Remove all of the records in a specified MARC or text file from the Solr index. - expire_external_sessions
Clean up the external_sessions database table, when used. - expire_searches
Remove unwanted saved searches from the database. - expire_sessions
Remove old session data from the database. - index_reserves
Build a Solr index for course reserves. - optimize
Optimize the Solr index. - sitemap
Generate a sitemap for use with search engines. - suppressed
Delete all currently suppressed catalog records from the Solr index. - switch_db_hash
Change the password hashing algorithm in the database and configuration.