问题:如何从插件/配置目录加载配置文件?
演示项目:https ://github.com/CakePHPKitchen/CakeDC-Users-Permissions-Example
我正在使用 CakeDC/users 插件,它有一个 permissions.php 文件,它从中加载 RBAC 权限。据我所知,它要么加载用户插件配置文件夹中的默认权限文件,要么从 app/config 文件夹加载 permissions.php 文件。
现在对于我的应用程序骨架,我在 app/config/permissions.php 中有一堆权限,但是,我不想修改该文件,因为我将从上游 repo 执行 git pulls,并且我想避免冲突。
所以我想做的是,在应用程序骨架引导程序中
我想
foreach(Plugin::loaded() as $plugin) {
$path = Plugin::path($plugin) . 'config/permissions.php';
if(file_exists($path)) {
Configure::load($path, 'default', true);
}
}
但我收到以下错误....
Error: The application is trying to load a file from the /Users/jlroberts/Projects/JeffreyLRobertsCom/CakePHPKitchen/PluginDemos/plugins/SharpAgent/config/permissions plugin.
Make sure your plugin /Users/jlroberts/Projects/JeffreyLRobertsCom/CakePHPKitchen/PluginDemos/plugins/SharpAgent/config/permissions is in the /Users/jlroberts/Projects/JeffreyLRobertsCom/CakePHPKitchen/PluginDemos/plugins/ directory and was loaded.
关于如何从 Plugin/config 目录加载 permissions.php 文件的任何想法?