【问题标题】:How to include external files in a SocialEngine module如何在 SocialEngine 模块中包含外部文件
【发布时间】:2018-08-14 13:36:58
【问题描述】:

我创建了一个名为 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
        }
    ]
}

但是,上述sn -p 中命名的外部文件在构建时不会复制到包中。此外,我在 JSON 文件中命名的外部文件似乎在安装后在目标包中消失了。 我怎么解决这个问题?

【问题讨论】:

    标签: socialengine


    【解决方案1】:

    感谢this SocialEngine Community post,这比我想象的要容易得多。
    将您想要的每个文件添加到包中所需的只是将其包含在模块的 manifest.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'
            ),
        ),
    );
    ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-19
      • 1970-01-01
      • 1970-01-01
      • 2021-11-23
      • 1970-01-01
      • 2011-05-10
      • 2016-01-25
      • 2023-03-23
      相关资源
      最近更新 更多