Skip to content
Register custom migration tasks that can be scheduled from the plugin settings dashboard in the admin and run as a cron job.
PHP Shell JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
assets
bin
src
tests
views/wp-admin/settings-pages
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
README.md
composer.json
phpcs.ruleset.xml
phpunit.xml
upgrade-task-runner.php

README.md

WordPress Upgrade Task Runner

WP Upgrade Task Runner

PHP from Packagist Latest Stable Version Total Downloads License Build Status Beerpay

Register custom migration tasks that can be triggered from a dashboard in the admin and run via AJAX.

Requirements

PHP >= 7.3
WordPress >= 5.1

The required WordPress version will always be the most recent point release of the previous major release branch.

For both PHP and WordPress requirements, although this library may work with a version below the required versions, they will not be supported and any compatibility is entirely coincidental.

Installation

To install this library, use Composer:

composer require thefrosty/wp-upgrade-task-runner:^2

Getting Started

If a new task is needed, there are only two required steps that are needed.

  1. A class needs to be created and this class needs to extend the AbstractTaskRunner class. See the ExampleMigrationTask example class.
  2. Register the new task class via the TaskLoader::REGISTER_TASKS_TAG filter:
use TheFrosty\WpUpgradeTaskRunner\Tasks\TaskLoader;

\add_filter(TaskLoader::REGISTER_TASKS_TAG, static function(array $tasks): array {
    $tasks[] = new \Project\SomeCustomTask();
    return $tasks;
});

The task class

When a class is added, it needs to have a few pre-defined class values. Both the DATE and TITLE constant are required to be unique. These are what registers a one off cron task when manually running the task from the admin page.

The TaskLoader

Add the new class as a property in the TaskLoader class and instantiate it in the register_tasks method (just like the ExampleMigrationTask).

CLI

Run all registered tasks (not already run) via wp-cli: $ wp wp-upgrade-task-runner.

You can’t perform that action at this time.