Skip to content

Commit

Permalink
Try adding escaped quotes to the db query when testing for a database…
Browse files Browse the repository at this point in the history
… connection.
  • Loading branch information
becw committed Nov 16, 2021
1 parent e8dd761 commit b9a1634
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion targets/drupal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,25 @@ Or, you can specify the export file directly:
the permissions, the database will be created.
-->
<target name="drupal-has-database-connection" depends="set-site" hidden="true">

<!-- We have to format the test query differently when using "ddev drush" vs. when using "drush" directly. -->
<property name="test_query" value="SELECT 1" />
<exec command="which ddev" returnProperty="which_ddev" />
<if>
<and>
<available file="${build.dir}/.ddev/config.yaml" />
<equals arg1="${which_ddev}" arg2="0" />
<not><isset property="env.IS_DDEV_PROJECT" /></not>
</and>
<then>
<property name="test_query" override="true">\"SELECT 1\"</property>
</then>
</if>

<trycatch>
<try>
<drush command="sql-query">
<param>SELECT 1</param>
<param>${test_query}</param>
</drush>
<echo msg="Drupal database connection available." />
</try>
Expand Down

0 comments on commit b9a1634

Please sign in to comment.