Allow developers to easily register batch processes through code, and run them through the admin UI
PHP JavaScript Shell CSS
Latest commit 1988281 Feb 17, 2017 @JasonHoffmann JasonHoffmann committed on GitHub Merge pull request #114 from Shelob9/patch-1
Set type to "wordpress-plugin"
Failed to load latest commit information.
bin Making sure both SVN calls are included Jan 11, 2017
includes Running queries twice to calculate offset Feb 3, 2017
languages updating .pot file, adding baseline English translation Sep 25, 2016
templates Rename to Locomotive Sep 21, 2016
tests Running queries twice to calculate offset Feb 3, 2017
.gitignore Add Travis CI Feb 1, 2017
.scrutinizer.yml Add Travis CI Feb 1, 2017
.travis.yml updating filename Oct 18, 2016
codecoverage.xml.dist Add Travis CI Feb 1, 2017
locomotive.php Bumping version Feb 3, 2017
logo.png Adding in logo image, and moving GIF down the page Feb 6, 2017
multisite.xml.dist Rename to Locomotive Sep 21, 2016
package.json Incrementing package.json Feb 3, 2017
phpunit.xml.dist Rename to Locomotive Sep 21, 2016
ruleset.xml Rename to Locomotive Sep 21, 2016
screenshot.gif Replace PNG with GIF Feb 3, 2017
screenshot.png Simplifying Readme Jan 3, 2017


Scrutinizer Code Quality Code Coverage


Locomotive Logo

Creating batch processes in WordPress has never been so easy. If you've ever wanted to query a large dataset and perform simple and repeatable actions, then Locomotive is for you.

Locomotive allows developers to write a single function (or set of functions) to process actions across a large data set. These registered batch processes can be run with the click of a button from the WP admin as needed. Locomotive handles the complexity of batch processing by automatically chunking up data, checking for records that have already been processed and logging errors as they come in.


Quick Start Example

Register a standard post query

function my_post_query_batch_process() {

	register_batch_process( array(
		'name'     => 'Just another batch',
		'type'     => 'post',
		'callback' => 'my_callback_function',
		'args'     => array(
			'posts_per_page' => 1,
			'post_type'      => 'post',
	) );
add_action( 'locomotive_init', 'my_post_query_batch_process' );

Hook In Callback Function

 * This is what we want to do with each individual result during a batch routine.
 * @param  array $result Individual result from batch query.
function my_callback_function( $result ) {
	error_log( print_r( $result->post_title, true ) );

Start Batch Process

Locomotive Menu

Navigate to Tools->Batches in the admin, select your batch, and click Run.




Pull requests are very much welcome and encouraged.