androlax2 / wp-plugin-activation-manifest
本包的最新版本(0.1.0)没有提供许可证信息。
WordPress的简单文件插件激活控制。
0.1.0
2021-01-28 17:42 UTC
Requires
- php: >=7.0
- androlax2/wp-plugin-control: ~0.1.0
- symfony/yaml: ^5.2
This package is auto-updated.
Last update: 2024-08-29 05:31:23 UTC
README
(灵感来源于 https://github.com/PrimeTimeCode/wp-plugin-activation-manifest)
通过最小努力锁定基于环境的单个插件的激活状态。
用法
创建一个YAML文件,定义您想强制执行的插件激活状态。可以取任何您喜欢的名字,并放置在您想要的位置(理想情况下在网站根目录外)。将此文件添加到您项目的仓库中。示例清单文件
# top level keys are the environment some_environment: enable: - someplugin/someplugin.php disable: - someotherplugin/someotherplugin.php # supports multisite network-enable: - someplugin/someplugin.php network-disable: - someplugin/someplugin.php # 'global' is a special key that you can use to apply to all environments global: enable: - woocommerce/woocommerce.php - wpmandrill/wpmandrill.php development: disable: - wpmandrill/wpmandrill.php
安装 composer require primetime/wp-plugin-activation-manifest
执行命令
require('vendor/autoload.php'); // ... // after WordPress is loaded - eg: within an mu-plugin // .. \Androlax2\WordPress\PluginManifest\Activation::set('path/to/plugin-manifest.yml', getenv('WP_ENV'));
在上面的例子中,WP_ENV
是一个环境变量,用于定义环境的名称(例如:开发、测试、生产)。这个环境名称应与yaml文件中的顶级键匹配。环境配置将在 global
配置之后应用,并将覆盖它。就这么简单!