Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thefrosty/wp-upgrade-task-runner
Register custom migration tasks that can be scheduled from the plugin settings dashboard in the admin and run as a cron job.
https://github.com/thefrosty/wp-upgrade-task-runner
ajax migration-tool php php80 wordpress wordpress-plugin
Last synced: 3 months ago
JSON representation
Register custom migration tasks that can be scheduled from the plugin settings dashboard in the admin and run as a cron job.
- Host: GitHub
- URL: https://github.com/thefrosty/wp-upgrade-task-runner
- Owner: thefrosty
- Created: 2019-02-12T19:55:54.000Z (almost 6 years ago)
- Default Branch: develop
- Last Pushed: 2024-03-26T14:17:40.000Z (10 months ago)
- Last Synced: 2024-10-04T20:35:31.807Z (3 months ago)
- Topics: ajax, migration-tool, php, php80, wordpress, wordpress-plugin
- Language: PHP
- Homepage: https://austin.passy.co/2019/introducing-wordpress-upgrade-task-runner-v2/
- Size: 206 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# WordPress Upgrade Task Runner
![WP Upgrade Task Runner](.github/wp-upgrade-task-runner.jpg?raw=true "Upgrade Task Runner")
[![PHP from Packagist](https://img.shields.io/packagist/php-v/thefrosty/wp-upgrade-task-runner.svg)]()
[![Latest Stable Version](https://img.shields.io/packagist/v/thefrosty/wp-upgrade-task-runner.svg)](https://packagist.org/packages/thefrosty/wp-upgrade-task-runner)
[![Total Downloads](https://img.shields.io/packagist/dt/thefrosty/wp-upgrade-task-runner.svg)](https://packagist.org/packages/thefrosty/wp-upgrade-task-runner)
[![License](https://img.shields.io/packagist/l/thefrosty/wp-upgrade-task-runner.svg)](https://packagist.org/packages/thefrosty/wp-upgrade-task-runner)
![Build Status](https://github.com/thefrosty/wp-upgrade-task-runner/actions/workflows/main.yml/badge.svg)
[![codecov](https://codecov.io/gh/thefrosty/wp-upgrade-task-runner/branch/develop/graph/badge.svg)](https://codecov.io/gh/thefrosty/wp-upgrade-task-runner)Register custom migration tasks that can be triggered from a dashboard in the admin and run via AJAX.
### Requirements
```
PHP >= 8.1
WordPress >= 6.2
```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:
```php
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 upgrade-task-runner`.
#### CLI OPTIONS
[--task=] : The fully qualified registered task to run.
[--user=] : The user ID to associate with running said task(s).