Skip to content

Commit

Permalink
Fixes acquia#1227: Add target to sync all local multisite dbs.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Mar 21, 2017
1 parent 3922d31 commit bdbee7a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
9 changes: 9 additions & 0 deletions phing/tasks/local-sync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
</if>
</target>

<target name="local:sync:db:all" description="Iteratively synchronizes local database from remote for each multisite listed in multisite.name">
<foreach list="${multisite.name}" param="multisite.name" target="local:sync:db"/>
</target>

<target name="local:sync:db:multisite" hidden="true">
<phingcall target="properties:load:multisite"/>
<phingcall target="local:sync:db"/>
</target>

<target name="local:sync:db" description="Synchronize local database from remote (remote --> local)."
depends="setup:drupal:settings">
<drush command="cc drush"/>
Expand Down
28 changes: 16 additions & 12 deletions phing/tasks/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,7 @@
</then>
</if>

<if>
<!-- There is multisite config. Allow it to override default values. -->
<available file="${blt.config-files.multisite}" />
<then>
<property file="${blt.config-files.multisite}" logoutput="false" override="true"/>
<!--
Here we override drush.uri explicitly (which defaults to 'default')
in order to run commands against multisite.name.
-->
<property name="drush.uri" value="${multisite.name}" override="true"/>
</then>
</if>
<phingcall target="properties:load:multisite"/>

<echo level="verbose">Executing commands against multisite "${multisite.name}"</echo>

Expand All @@ -102,6 +91,21 @@
</then>
</if>

<target name="properties:load:multisite" hidden="true" description="Loads configuration for specific multisite.">
<if>
<!-- There is multisite config. Allow it to override default values. -->
<available file="${blt.config-files.multisite}" />
<then>
<property file="${blt.config-files.multisite}" logoutput="false" override="true"/>
<!--
Here we override drush.uri explicitly (which defaults to 'default')
in order to run commands against multisite.name.
-->
<property name="drush.uri" value="${multisite.name}" override="true"/>
</then>
</if>
</target>

<target name="echo-property" description="Echoes the value of a Phing property." hidden="true">
<fail unless="property.name" message="property.name must be set!"/>
<echo>${property.name}</echo>
Expand Down

0 comments on commit bdbee7a

Please sign in to comment.