如何在社交引擎模块中包含外部文件



我创建了一个名为MyAwesomeModule的SocialEngine模块,该模块为现有的SocialEngine注册过程添加了注册步骤。它在application/modules/Myawesomemodule.除了此目录中的文件外,它还依赖于其他文件,例如专门为此模块创建并放置在application/modules/User中的几个文件。我遇到的问题是,当我在http://example.com/install/sdk/build中为这个模块构建一个包时,它只包含驻留在模块目录本身中的文件。此模块工作所需的其他文件以及需要复制到外部目录(application/modules/User(的文件不包括在软件包中。

在构建软件包之前,我尝试在软件包信息文件中添加外部文件列表,即application/packages/module-myawesomemodule-4.0.0.json,如下所示:

"application/modules/User": {
"type": "directory",
"path": "application/modules/User",
"structure": [
{
"path": "Plugin/Signup/Phone.php",
"dir": false,
"file": true,
"perms": "0644",
"size": 0,
"sha1": null
},
{
"path": "Form/Signup/Phone.php",
"dir": false,
"file": true,
"perms": "0644",
"size": 0,
"sha1": null
},
{
"path": "controllers/PhoneController.php",
"dir": false,
"file": true,
"perms": "0644",
"size": 0,
"sha1": null
}
]
}

但是,在生成时,上述代码片段中指定的外部文件不会复制到包中。另外,安装后,我在 JSON 文件中命名的外部文件似乎在目标包中消失了。 如何解决这个问题?

这比我想象的要容易得多,这要归功于这个SocialEngine社区帖子。将
您想要的每个文件添加到包中所需的全部是将其包含在模块的清单.php文件中。因此:

return array(
'package' =>
array(
'type' => 'module',
'name' => 'advancedsmsplugin',
'version' => '4.0.0',
'sku' => 'com.company.sms',
'path' => 'application/modules/Advancedsmsplugin',
'title' => 'Advanced SMS Plugin',
'description' => 'Advanced SMS Plugin',
'author' => 'Company Ltd.',
'callback' =>
array(
'class' => 'Engine_Package_Installer_Module',
),
'actions' =>
array(
0 => 'install',
1 => 'upgrade',
2 => 'refresh',
3 => 'enable',
4 => 'disable',
),
'directories' =>
array(
0 => 'application/modules/Advancedsmsplugin',
),
'files' =>
array(
0 => 'application/languages/en/advancedsmsplugin.csv',
1 => 'application/modules/User/Form/Signup/Phone.php',
2 => 'application/modules/User/Plugin/Signup/Phone.php',
3 => 'application/testpackage.html'
),
),
);
?>

最新更新