b3nl/phing-shopware

为您的phing-build添加shopware任务。

1.0.21 2015-02-10 19:36 UTC

This package is auto-updated.

Last update: 2024-09-16 06:38:47 UTC


README

此(composer)包为您提供了额外的phing自动化任务。

要求

  1. 任务需要设置一个SW_PATH属性,该属性设置shopware根路径。
  2. 在phing项目中还应存在一个名为"language"的属性。

任务

  • activateSWPlugin(PhingShopware\Task\ActivatePlugin): 调用shopware cli激活指定ID的插件。
    • plugin: 插件ID
    • [ignore: (true|false) - 忽略可能的错误?]
  • callSWCLI(PhingShopware\Task\CallCLI): 使用指定命令调用shopware cli。
    • command: cli命令。
    • [consoleOutput: 包含输出的变量名.]
    • [returnOutput: 包含返回值的变量名.]
  • clearSWCache(PhingShopware\Task\ClearCache): 调用shell脚本清空shopware的缓存目录。
  • controlSWPlugin(PhingShopware\Task\ControlPlugin): 处理您的shopware商店的基本插件操作。
    • [activate: (true|false) - 如果提供此参数,则激活或停用模块。]
    • [ignore: (true|false) - 是否忽略错误?]
    • [install: (true|false) - 首先安装插件?]
    • [可能的子属性]
    • plugin: 插件的ID。
    • [update: (true|false) - 更新插件?]
  • handleSWMaintenance(PhingShopware\Task\HandleMaintenance): 激活或停用维护模式?
    • enable: (true|false)
    • [shopScope: 用于哪个范围?]
  • ifSWPlugin(PhingShopware\Task\IfPlugin): 对插件状态的自定义if检查
    • existsSWPlugin(PhingShopware\Task\Condition\Plugin\IsExisting): 插件是否存在?
      • plugin: 插件的ID。
    • isSWPluginActive(PhingShopware\Task\Condition\Plugin\IsActive): 插件是否激活?
      • plugin: 插件的ID。
    • isSWPluginInstalled(PhingShopware\Task\Condition\Plugin\IsInstalled): 插件是否安装?
      • plugin: 插件的ID。
    • SWPluginNeedsUpdate(PhingShopware\Task\Condition\Plugin\IsInstalled): 插件需要更新吗?
      • plugin: 插件的ID。
  • installSWDatabase(PhingShopware\Task\InstallDatabase): 从本地安装的dev版本获取典型数据库并安装shopware数据库。
  • installSWDemoData(PhingShopware\Task\InstallDemoData): 尝试从http://releases.s3.shopware.com/demo_%s.zip下载演示文件并将其“解压”到shop目录。
    • [demoVersion: 演示数据版本的语义版本字符串]
    • [overwrite: (true|false) - 新的演示zip是否覆盖旧的一个?]
    • [stopOnError: (true|false) - 下载错误是否停止进程?]
    • [urlPattern: 应使用哪个URL模式?]
  • saveSWConfigData(PhingShopware\Task\SaveConfigData): 将典型和必需的配置数据保存到数据库中(adminLanguage, adminName, ... 请参阅示例xml)。
  • writeSWConfigFile(PhingShopware\Task\WriteConfigFile): 读取配置并写入典型的shopware配置文件。
  • writeToSWDatabase(PhingShopware\Task\WriteToDatabase): 在数据库中执行给定的查询。
    • file: sql文件的路径。
    • [withParse: (true|false) "解析"给定文件?解析意味着,用;\r\n -> ;\n分隔查询。]

您可以通过以下方式包含此任务

要将自定义任务注册到Phing中,请使用taskdef元素(第5行)。有关更详细的说明,请参阅B.40节,“TaskdefTask”。可选地,在taskdef元素之前,includepath元素添加到PHP的include路径。当然,这只有在提到的路径尚未在include路径上时才是必需的。有关更详细的说明,请参阅B.24节,“IncludePathTask”。(https://www.phing.info/docs/guide/trunk/ch06s06.html)

  1. includepath
  2. taskdef

示例

<?xml version="1.0" ?>

<project name="test" basedir="." default="echoPossibleTargets">
    <!-- Needed globally in some tasks! -->
    <property name="database_host" value="your database host" />
    <property name="database_name" value="your database name" />
    <property name="database_password" value="your database password" />
    <property name="database_port" value="your database port" />
    <property name="database_user" value="rooyour database user" />

    <property name="language" value="your shop language (de|en)" />
    <property name="SW_PATH" value="The path to your shopware dir." override="true" />

    <includepath classpath="src" />
    <taskdef file="etc/phingShopwareTasks.properties" />

    <target name="echoPossibleTargets">
        <echo>Please use one of this targets: prepareLocalEnv</echo>
    </target>

    <target name="prepareLocalEnv">
        <writeSWConfigFile />
        <installSWDatabase />
        <saveSWConfigData
                adminLanguage="lang" adminName="your backend name" adminEmail="your admin mail"
                adminPassword="your admin password" adminUser="your admin user name"
                configMail="the mail of the shop" shopCurrency="the default shop currency"
                shopLanguage="the default shop language" shopHost="your shop host" />

        <!-- Some plugin processing -->
        <callSWCLI command="sw:plugin:refresh" />
        <ifSWPlugin>
            <existsSWPlugin plugin="AdvancedMenu" />
            <then>
                <echo>AdvancedMenu exists.</echo>
            </then>
            <else>
                <echo>AdvancedMenu does not exist.</echo>
            </else>
        </ifSWPlugin>

        <ifSWPlugin>
            <isSWPluginInstalled plugin="AdvancedMenu" />
            <then>
                <echo>AdvancedMenu allready installed.</echo>
            </then>
            <else>
                <controlSWPlugin install="true" plugin="AdvancedMenu" />
            </else>
        </ifSWPlugin>

        <ifSWPlugin>
            <isSWPluginActive plugin="AdvancedMenu" />
            <then>
                <echo>AdvancedMenu allready activated.</echo>
            </then>
            <else>
                <controlSWPlugin activate="true" plugin="AdvancedMenu">
                    <!--<property file="test.properties" /> -->
                </controlSWPlugin>
            </else>
        </ifSWPlugin>
    </target>
</project>