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 categories and actions, similar to the web portion of the VuFind application. (See the VuFindConsole module of the code for the implementation details). The specific categories and actions are documented below. Once you know which one you need, you can run it following these instructions.
Using the Index Script
In VuFind 2.4 or newer, the most consistent way to run command line tools is to run them through VuFind's 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 a formal 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 [category] [action] [additional parameters]
The code was implemented using the Zend\Console package until release 7.0, when that package was deprecated and had to be replaced with Symfony\Console. Only the internals changed, so the process of running the scripts remained the same – see the blog post Moving from Laminas\Console to Symfony\Console for more history and details.
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 category names. These could be run like this:
php $VUFIND_HOME/category/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 category. 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 category contains the theme compiler that was introduced in VuFind 4.1.
The generate category (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 category 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 category 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.
Introduced in VuFind 7.0, the install category integrates the formerly stand-alone install.php script with VuFind's core console infrastructure.
Run the install script to set up local modules, adjust Apache configuration, etc.
The language category 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 category is used for tasks related to VuFind's Email Alerts functionality.
Send out new notification emails, as needed.
The util category 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.
Compile SCSS files into CSS within all themes.
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.