Replace values of variables in php file with regular expression and sed in ant

<echo message="prepare localconf.php file"/>
<exec executable="sed" failonerror="true" dir="${dir_local}/typo3conf" output="${backup}_${DSTAMP}/localconf.php" os="Linux" >
  <arg value="-e"/>
  <arg value="s/\$typo_db_username = '.*';/\$typo_db_username = '${db_remote_user}';/g"/>
  <arg value="-e"/>
  <arg value="s/\$typo_db_host = '.*';/\$typo_db_host = '${db_remote_host}';/g"/>
  <arg value="-e"/>
  <arg value="s/\$typo_db = '.*';/\$typo_db = '${db_remote_db}';/g"/>
  <arg value="-e"/>
  <arg value="s/\$typo_db_password = '.*';/\$typo_db_password = '${db_remote_pass}';/g"/>
  <arg value="localconf.php"/>
</exec>

Sven Wappler

Webentwickler, TYPO3ler, Hobby-Fotograf

Das könnte Dich auch interessieren …

Schreibe einen Kommentar