PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1
CHAPTER 19 ■ AUTOMATED BUILD WITH PHING

Table 19–5. The Attributes of the copy Element


Attribute Required Description Default Value

Todir Yes (if tofile not present) Directory to copy into. None

Tofile Yes (if todir not present) The file to copy to. None

File No Source file. None

Tstamp No Match the timestamp of
any file overwritten
(it will appear unaltered).

false

includeemptydirs No Copy empty
directories over.

FALSE


Mode No Set the (octal) mode 755

Overwrite No Overwrite target if it
already exists.

no

Input


You have seen that the echo element is used to send output to the user. To gather input from the user, I
have used separate methods involving the command line and an environment variable. These
mechanisms are neither very structured nor interactive, however.


■Note One reason for allowing users to set values at build time is to allow for flexibility from build environment


to build environment. In the case of database passwords, another benefit is that this sensitive data is not


enshrined in the build file itself. Of course, once the build has been run, the password will be saved into a source


file, so it is up to the developer to ensure the security of his system!


The input element allows you to output a prompt message. Phing then awaits user input and
assigns it to a property. Here it is in action:



propertyName="dbpass"
defaultValue="default"
promptChar=" >" />
Free download pdf