lightscale/migrator-config-wordpress

一个辅助类,用于配置 lightscale/migrator 以在 wordpress 插件中工作

0.0.3 2022-06-24 10:59 UTC

This package is auto-updated.

Last update: 2024-09-24 15:35:33 UTC


README

为 lightscale/migrator 提供的配置,使其能够在 wordpress 主题或插件中工作。它提供了类 Lightscale\Migrator\Config\Wordpress

安装

这应该通过 composer 从 packagist 安装

$ composer require lightscale/migrator-config-wordpress

用法

要使用它,请将 Lightscale/Migrator 安装到您的插件或主题目录中。

然后在该目录的根目录下创建一个配置文件 migrator_config.php。此文件看起来应该像这样

<?php

use Lightscale\Migrator\Config\Wordpress;

$config = new Wordpress('textdomain', __DIR__);
return $config->config();

参考

构造函数

__construct($namespace, $base_dir, $directory = 'dbmigrations', $load_path = '../../../wp-load.php')

  • $namespace (字符串) - 是用于在 wp_options 表中创建键的文本域。
  • $base_dir (字符串) - 是安装的基础目录。相对于配置。可以是 DIR
  • $directory (字符串) - 是存储迁移的目录。
  • $load_path (字符串) - 是 wp-load.php 的路径,用于使用命令行迁移工具初始化 WordPress。

方法

config()

返回 - 从 migrator_config.php 文件返回的配置数组。

发布历史

  • 0.0.2 添加了 base_dir 功能
  • 0.0.1 所有核心功能正常工作。仍在持续开发中。

要求

  • PHP 7.1.3
  • Composer

贡献者

Sam Light

许可证

本项目根据 GPLv3 许可证授权 - 有关详细信息,请参阅 LICENSE 文件。