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]
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.
A summary of all available actions can be viewed (in VuFind 2.4 or newer) by running:
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.
The compile controller contains the theme compiler that was introduced in VuFind 4.1.
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.
The harvest controller contains tools for collecting and managing records prior to import into VuFind.
Tool for OAI-PMH harvesting.
Tool for merging individual MARC records together into a single collection (useful for improving import speed after harvesting records).
The import controller contains tools for loading records into VuFind's Solr index.
Tool for importing XML files into Solr using XSLT.
Tool for populating the website index when indexing websites.
The language controller contains tools for managing VuFind's i18n language files.
Create a new string by combining one or more existing strings using a template.
Copy one language string to another in all of the language files.
Delete a language string from all of the language files.
Normalize (sort/deduplicate/tidy) a directory of language files.
The scheduledsearch controller is used for tasks related to VuFind's Email Alerts functionality.
Send out new notification emails, as needed.
The util controller is a catch-all for a variety of useful utilities.
Clean out the record cache, when used
Commit the Solr index.
Populate the hierarchy cache when using hierarchies and collections.
Compile LESS files into CSS within all themes.
Remove duplicate lines from a text file.
Remove all of the records in a specified MARC or text file from the Solr index.
Clean up expired authentication hashes (generated by Email authentication method).
Clean up the external_sessions database table, when used.
Remove unwanted saved searches from the database.
Remove old session data from the database.
Build a Solr index for course reserves.
Check a MARC file for errors.
Optimize the Solr index.
Generate a sitemap for use with search engines.
Delete all currently suppressed catalog records from the Solr index.
Change the password hashing algorithm in the database and configuration.