madebit/wordpress-data-migration
Composer 安装命令:
composer require madebit/wordpress-data-migration
包简介
README 文档
README
How to use
create a folder in your working directory for the migrations.
mkdir migrations
Create a file called CURRENT_VERSION in this folder and insert the current version number
touch migrations/CURRENT_VERSION echo '0' > migrations/CURRENT_VERSION
Include the DataMigration into your project.
add_action('init', function () { new DataMigration(get_template_directory() . '/migrations/'); });
In the migrations folder, create a migration file. These files should be constructed with the version number and the classname. ${VERSION}-${ClassName}.php
touch migrations/1-DoThisAndThat.php
The file should look like this
<?php namespace Madebit\WordpressDataMigration; class DoThisAndThat extends \Madebit\WordpressDataMigration\AbstractMigration { public function up() { // migrate data when migrating up } public function down() { // migrate data when migrating down } } ?>
To migrate, visit the Rest endpoint << YOUR INSTALL >>/wp-json/m8b/v1/migrate.
To test or execute a specific version add the ?version=<INT> parameter.
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-01-18