build/xmlscripts/magento.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* magento.xml
*
* @copyright Copyright (c) 2016 Staempfli AG
* @author juan.alonso@staempfli.com
*/
-->
<project name="Magento" default="..." basedir=".">
<includepath classpath="${phing.dir}/build/phpscripts/Magento"/>
<taskdef name="setMagentoConfig" classname="EnsureConfiguration"/>
<target name="magento:clean:setup"
depends="magento:install,
magento:config:set,
magento:cache:clean"
hidden="true">
<echo message="****************************************************************************"/>
<echo message="Magento has been successfully set up"/>
<echo message=""/>
<echo message="Admin frontname: /${magento.admin.frontname}"/>
<echo message="Admin username: ${install.admin.username}"/>
<echo message="Admin password: ${install.admin.password}"/>
<echo message="****************************************************************************"/>
</target>
<target name="magento:module:init"
hidden="true">
<exec command="${bin.n98-magerun2} module:status | grep -A1 "List of enabled modules:" | tail -n 1"
checkreturn="true" outputProperty="first.enabled.module"/>
<if>
<equals arg1="${first.enabled.module}" arg2="None"/>
<then>
<echo message="Enable all Modules"/>
<exec command="${bin.n98-magerun2} module:enable --all" checkreturn="true" logoutput="true"/>
</then>
</if>
</target>
<target name="magento:install"
depends="database:drop,
database:create,
magento:module:init"
hidden="true">
<customHook hook="before-magento-install"/>
<echo message=""/>
<echo message="Installing Magento..."/>
<property name="command.magento.install" value="${bin.n98-magerun2} setup:install" />
<property name="params.command.magento.install"
value="--backend-frontname="${magento.admin.frontname}"
--db-host="${database.host}"
--db-name="${database.name}"
--db-user="${database.user}"
--db-password="${database.password}"
--base-url="http://${project.name}.lo"
--language="${install.locale}"
--timezone="${install.timezone}"
--currency="${install.currency}"
--admin-firstname="${install.admin.firstname}"
--admin-lastname="${install.admin.lastname}"
--admin-email="${install.admin.email}"
--admin-user="${install.admin.username}"
--admin-password="${install.admin.password}"
--use-rewrites=1
--cleanup-database
${magento.setup.install.extra.params}"
/>
<exec command="${command.magento.install} --help" outputProperty="command.magento.install.help.output" checkreturn="true"/>
<if>
<contains string="${command.magento.install.help.output}" substring="--no-interaction"/>
<then>
<property name="params.command.magento.install" value="${params.command.magento.install} --no-interaction" override="true"/>
</then>
</if>
<exec command="${command.magento.install} ${params.command.magento.install}"
passthru="true"
checkreturn="true"
logoutput="true"
outputProperty="command.magento.install.output"/>
<phingcall target="util:check:output">
<property name="check.output" value="${command.magento.install.output}" override="true"/>
</phingcall>
<customHook hook="after-magento-install"/>
</target>
<target name="magento:config:set"
hidden="true">
<setMagentoConfig/>
</target>
<target name="magento:setup:upgrade"
hidden="true">
<property name="command.magento.upgrade" value="${bin.n98-magerun2} setup:upgrade" />
<property name="params.command.magento.upgrade" value=""/>
<if>
<equals arg1="${setup.upgrade.keep.generated}" arg2="1"/>
<then>
<property name="params.command.magento.upgrade" value="${params.command.magento.upgrade} --keep-generated" override="true"/>
</then>
</if>
<exec command="${command.magento.upgrade} --help" outputProperty="command.magento.upgrade.help.output" checkreturn="true"/>
<if>
<contains string="${command.magento.upgrade.help.output}" substring="--no-interaction"/>
<then>
<property name="params.command.magento.upgrade" value="${params.command.magento.upgrade} --no-interaction" override="true"/>
</then>
</if>
<echo message="${command.magento.upgrade} ${params.command.magento.upgrade}"/>
<exec command="${command.magento.upgrade} ${params.command.magento.upgrade}"
checkreturn="true"
logoutput="true"
outputProperty="command.magento.upgrade.output"/>
<phingcall target="util:check:output">
<property name="check.output" value="${command.magento.upgrade.output}" override="true"/>
</phingcall>
</target>
<target name="magento:cache:clean"
hidden="true">
<property name="command.cache.clean" value="${bin.n98-magerun2} cache:clean"/>
<echo message="running ${command.cache.clean}"/>
<exec command="${command.cache.clean}" returnProperty="clean.cache.return"
outputProperty="command.cache.clean.output"/>
<if>
<not>
<equals arg1="${clean.cache.return}" arg2="0"/>
</not>
<then>
<property name="command.cache.remove"
value="rm -rf ${magento.dir}/var/cache/* ${magento.dir}/var/di/* ${magento.dir}/var/generation/* ${magento.dir}/var/page_cache/*"/>
<echo message="try removing folder directly"/>
<echo message="running ${command.cache.remove}"/>
<exec command="${command.cache.remove}" logoutput="true"/>
</then>
<else>
<echo message="${command.cache.clean.output}"/>
</else>
</if>
</target>
</project>