thefrosty/wp-upgrade-task-runner
Composer 安装命令:
composer require thefrosty/wp-upgrade-task-runner
包简介
A WordPress plugin for developers to write custom migration tasks.
README 文档
README
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.
- A class needs to be created and this class needs to extend the
AbstractTaskRunnerclass. See theExampleMigrationTaskexample class. - Register the new task class via the
TaskLoader::REGISTER_TASKS_TAGfilter:
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=<class>] : The fully qualified registered task to run.
[--user=<id>] : The user ID to associate with running said task(s).
thefrosty/wp-upgrade-task-runner 适用场景与选型建议
thefrosty/wp-upgrade-task-runner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.98k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2019 年 02 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 thefrosty/wp-upgrade-task-runner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thefrosty/wp-upgrade-task-runner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.98k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-13
