Classes, interfaces and traits
BuildListener¶
Interface for build listeners.
Classes that implement a listener must extend this class and (faux)implement
all methods that are decleard as dummies below.
« More »
BuildLogger¶
Interface for build loggers.
Build loggers are build listeners but with some additional functionality:
- They can be configured with a log level (below which they will ignore messages)
- They have error and output streams
Classes that implement a listener must implement this interface.
« More »
StreamRequiredBuildLogger¶
Interface for build loggers that require that out/err streams be set in order to function.
This is just an empty sub-interface to BuildLogger, but is used by Phing to throw
graceful errors when classes like phing.listener.DefaultLogger are being used as
-listener.
« More »
TaskContainer¶
Abstract interface for objects which can contain tasks (targets)
Used to check if a class can contain tasks (via instanceof)
« More »
BuildEvent¶
Encapsulates a build specific event.
<p>We have three sources of events all handled by this class:
<ul>
<li>Project level events</li>
<li>Target level events</li>
<li>Task level events</li>
</ul>
<p> Events are all fired from the project class by creating an event object
using this class and passing it to the listeners.
« More »
BuildException¶
BuildException is for when things go wrong in a build execution.
« More »
ConfigurationException¶
ConfigurationException is thrown by Phing during the configuration and setup phase of the project.
« More »
IntrospectionHelper¶
Helper class that collects the methods that a task or nested element
holds to set attributes, create nested elements or hold PCDATA
elements.
<ul>
<li><strong>SMART-UP INLINE DOCS</strong></li>
<li><strong>POLISH-UP THIS CLASS</strong></li>
</ul>
« More »
Phing¶
Entry point into Phing. This class handles the full lifecycle of a build -- from
parsing & handling commandline arguments to assembling the project to shutting down
and cleaning up in the end.
If you are invoking Phing from an external application, this is still
the class to use. Your applicaiton can invoke the start() method, passing
any commandline arguments or additional properties.
« More »
Project¶
The Phing project class. Represents a completely configured Phing project.
The class defines the project and all tasks/targets. It also contains
methods to start a build as well as some properties and FileSystem
abstraction.
« More »
ProjectComponent¶
Abstract class providing properties and methods common to all
the project components
« More »
RuntimeConfigurable¶
Wrapper class that holds the attributes of a Task (or elements
nested below that level) and takes care of configuring that element
at runtime.
<strong>SMART-UP INLINE DOCS</strong>
« More »
Target¶
The Target component. Carries all required target data. Implements the
abstract class {@link TaskContainer}
« More »
Task¶
The base class for all Tasks.
Use \Project#createTask to register a new Task.
« More »
TaskAdapter¶
Use introspection to "adapt" an arbitrary ( not extending Task, but with
similar patterns).
Use \Project#createTask to register a new Task.
« More »
UnknownElement¶
Wrapper class that holds all information necessary to create a task
that did not exist when Phing started.
<em> This has something to do with phing encountering an task XML element
it is not aware of at start time. This is a situation where special steps
need to be taken so that the element is then known.</em>
« More »
Classes, interfaces and traits
AnsiColorLogger¶
Uses ANSI Color Code Sequences to colorize messages
sent to the console.
If used with the -logfile option, the output file
will contain all the necessary escape codes to
display the text in colorized mode when displayed
in the console using applications like cat, more,
etc.
This is designed to work on terminals that support ANSI
color codes. It works on XTerm, ETerm, Mindterm, etc.
It also works on Win9x (with ANSI.SYS loaded.)
NOTE:
It doesn't work on WinNT's COMMAND.COM even with
ANSI.SYS loaded.
The default colors used for differentiating
the message levels can be changed by editing the
phing/listener/defaults.properties file.
This file contains 5 key/value pairs:
AnsiColorLogger.ERROR_COLOR=2;31
AnsiColorLogger.WARNING_COLOR=2;35
AnsiColorLogger.INFO_COLOR=2;36
AnsiColorLogger.VERBOSE_COLOR=2;32
AnsiColorLogger.DEBUG_COLOR=2;34
Another option is to pass a system variable named
ant.logger.defaults, with value set to the path of
the file that contains user defined Ansi Color
Codes, to the <B>java</B> command using -D option.
To change these colors use the following chart:
<B>ANSI COLOR LOGGER CONFIGURATION</B>
Format for AnsiColorLogger.*=
Attribute;Foreground;Background
Attribute is one of the following:
0 -> Reset All Attributes (return to normal mode)
1 -> Bright (Usually turns on BOLD)
2 -> Dim
3 -> Underline
5 -> link
7 -> Reverse
8 -> Hidden
Foreground is one of the following:
30 -> Black
31 -> Red
32 -> Green
33 -> Yellow
34 -> Blue
35 -> Magenta
36 -> Cyan
37 -> White
Background is one of the following:
40 -> Black
41 -> Red
42 -> Green
43 -> Yellow
44 -> Blue
45 -> Magenta
46 -> Cyan
47 -> White
« More »
DefaultLogger¶
Writes a build event to the console.
Currently, it only writes which targets are being executed, and
any messages that get logged.
« More »
HtmlColorLogger¶
Uses CSS class that must be defined in the HTML page
where the Phing output is displayed.
If used with the -logfile option, the output
will contain the text wrapped in html <span> elements
with those css classes.
The default classes used for differentiating
the message levels can be changed by editing the
phing/listener/defaults.properties file.
This file can contain 5 key/value pairs:
HtmlColorLogger.ERROR_CLASS=_your_css_class_name_
HtmlColorLogger.WARNING_CLASS=_your_css_class_name_
HtmlColorLogger.INFO_CLASS=_your_css_class_name_
HtmlColorLogger.VERBOSE_CLASS=_your_css_class_name_
HtmlColorLogger.DEBUG_CLASS=_your_css_class_name_
This stems from the Ansi Color Logger done by Hans Lellelid:
« More »
MailLogger¶
Uses PEAR Mail package to send the build log to one or
more recipients.
Currently, it only writes which targets are being executed, and
any messages that get logged.
« More »
NoBannerLogger¶
Extends DefaultLogger to strip out empty targets.
Currently, it only writes which targets are being executed, and
any messages that get logged.
« More »
PearLogListener¶
Writes build messages to PEAR Log.
By default it will log to file in current directory w/ name 'phing.log'. You can customize
this behavior by setting properties:
- pear.log.type
- pear.log.name
- pear.log.ident (note that this class changes ident to project name)
- pear.log.conf (note that array values are currently unsupported in Phing property files)
<code>
phing -f build.xml -logger phing.listener.PearLogger -Dpear.log.type=file -Dpear.log.name=/path/to/log.log
</code>
« More »
TargetLogger¶
Extends AnsiColorLogger to display times for each target
If used with the -logfile option, the output file
will contain all the necessary escape codes to
display the text in colorized mode when displayed
in the console using applications like cat, more,
etc.
This is designed to work on terminals that support ANSI
color codes. It works on XTerm, ETerm, Mindterm, etc.
It also works on Win9x (with ANSI.SYS loaded.)
NOTE:
It doesn't work on WinNT's COMMAND.COM even with
ANSI.SYS loaded.
The default colors used for differentiating
the message levels can be changed by editing the
phing/listener/defaults.properties file.
This file contains 5 key/value pairs:
AnsiColorLogger.ERROR_COLOR=2;31
AnsiColorLogger.WARNING_COLOR=2;35
AnsiColorLogger.INFO_COLOR=2;36
AnsiColorLogger.VERBOSE_COLOR=2;32
AnsiColorLogger.DEBUG_COLOR=2;34
Another option is to pass a system variable named
ant.logger.defaults, with value set to the path of
the file that contains user defined Ansi Color
Codes, to the <B>java</B> command using -D option.
To change these colors use the following chart:
<B>ANSI COLOR LOGGER CONFIGURATION</B>
Format for AnsiColorLogger.*=
Attribute;Foreground;Background
Attribute is one of the following:
0 -> Reset All Attributes (return to normal mode)
1 -> Bright (Usually turns on BOLD)
2 -> Dim
3 -> Underline
5 -> link
7 -> Reverse
8 -> Hidden
Foreground is one of the following:
30 -> Black
31 -> Red
32 -> Green
33 -> Yellow
34 -> Blue
35 -> Magenta
36 -> Cyan
37 -> White
Background is one of the following:
40 -> Black
41 -> Red
42 -> Green
43 -> Yellow
44 -> Blue
45 -> Magenta
46 -> Cyan
47 -> White
« More »
XmlLogger¶
Generates a file in the current directory with
an XML description of what happened during a build.
The default filename is "log.xml", but this can be overridden
with the property <code>XmlLogger.file</code>.
« More »
Classes, interfaces and traits
AdhocTask¶
Abstract class for creating adhoc Phing components in buildfile.
By itself this class can be used to declare a single class within your buildfile.
You can then reference this class in any task that takes custom classes (selectors,
mappers, filters, etc.)
Subclasses exist for conveniently declaring and registering tasks and types.
« More »
AdhocTaskdefTask¶
A class for creating adhoc tasks in build file.
<target name="test-adhoc">
<adhoc-task name="foo"><![CDATA[
class FooTest extends Task {
private $bar;
function setBar($bar) {
$this->bar = $bar;
}
function main() {
$this->log("In FooTest: " . $this->bar);
}
}
]]></adhoc-task>
<foo bar="B.L.I.N.G"/>
</target>
« More »
AdhocTypedefTask¶
A class for creating adhoc datatypes in build file.
By itself this class can be used to declare a single class within your buildfile.
You can then reference this class in any task that takes custom classes (selectors,
mappers, filters, etc.)
Subclasses exist for conveniently declaring and registering tasks and types.
« More »
AppendTask¶
Appends text, contents of a file or set of files defined by a filelist to a destination file.
<code>
<append text="And another thing\n" destfile="badthings.log"/>
</code>
OR
<code>
<append file="header.html" destfile="fullpage.html"/>
<append file="body.html" destfile="fullpage.html"/>
<append file="footer.html" destfile="fullpage.html"/>
</code>
OR
<code>
<append destfile="${process.outputfile}">
<filterchain>
<xsltfilter style="${process.stylesheet}">
<param name="mode" expression="${process.xslt.mode}"/>
<param name="file_name" expression="%{task.append.current_file.basename}"/> <!-- Example of using a RegisterSlot variable -->
</xsltfilter>
</filterchain>
<filelist dir="book/" listfile="book/PhingGuide.book"/>
</append>
</code>
« More »
ApplyTask¶
Executes a command on the (filtered) file list/set.
(Loosely based on the "Ant Apply" task - http://ant.apache.org/manual/Tasks/apply.html)
« More »
AvailableTask¶
<available> task.
Note: implements condition interface (see condition/Condition.php)
« More »
CaseTask¶
"Inner" class for SwitchTask.
The sequential task has no attributes and does not support any nested
elements apart from Ant tasks. Any valid Ant task may be embedded within the
sequential task.
« More »
ChmodTask¶
Task that changes the permissions on a file/directory.
Use \Project#createTask to register a new Task.
« More »
ChownTask¶
Task that changes the permissions on a file/directory.
Use \Project#createTask to register a new Task.
« More »
ConditionTask¶
<condition> task as a generalization of <available>
<p>This task supports boolean logic as well as pluggable conditions
to decide, whether a property should be set.</p>
<p>This task does not extend Task to take advantage of
ConditionBase.</p>
« More »
CopyTask¶
A phing copy task. Copies a file or directory to a new file
or directory. Files are only copied if the source file is newer
than the destination file, or when the destination file does not
exist. It is possible to explictly overwrite existing files.
Use \Project#createTask to register a new Task.
« More »
CreoleTask¶
Handles Creole configuration needed by SQL type tasks.
Use \Project#createTask to register a new Task.
« More »
CvsPassTask¶
Adds an new entry to a CVS password file.
Use \Project#createTask to register a new Task.
« More »
CvsTask¶
Task for performing CVS operations.
NOTE: This implementation has been moved here from Cvs.java with
the addition of some accessors for extensibility. Another task
can extend this with some customized output processing.
« More »
DeleteTask¶
Deletes a file or directory, or set of files defined by a fileset.
Use \Project#createTask to register a new Task.
« More »
EchoTask¶
Echos a message to the logging system or to a file
Use \Project#createTask to register a new Task.
« More »
ElseIfTask¶
"Inner" class for IfTask.
This class has same basic structure as the IfTask, although of course it doesn't support <else> tags.
« More »
ExecTask¶
Executes a command on the shell.
Use \Project#createTask to register a new Task.
« More »
FailTask¶
Exits the active build, giving an additional message
if available.
Use \Project#createTask to register a new Task.
« More »
ForeachTask¶
<foreach> task
Task definition for the foreach task. This task takes a list with
delimited values, and executes a target with set param.
Usage:
<foreach list="values" target="targ" param="name" delimiter="|" />
Attributes:
list --> The list of values to process, with the delimiter character,
indicated by the "delimiter" attribute, separating each value.
target --> The target to call for each token, passing the token as the
parameter with the name indicated by the "param" attribute.
param --> The name of the parameter to pass the tokens in as to the
target.
delimiter --> The delimiter string that separates the values in the "list"
parameter. The default is ",".
« More »
FunctionParam¶
Supports the <param> nested tag for PhpTask.
« More »
IfTask¶
Perform some tasks based on whether a given condition holds true or
not.
<p>This task is heavily based on the Condition framework that can
be found in Ant 1.4 and later, therefore it cannot be used in
conjunction with versions of Ant prior to 1.4.</p>
<p>This task doesn't have any attributes, the condition to test is
specified by a nested element - see the documentation of your
<code><condition></code> task (see
<a href="http://jakarta.apache.org/ant/manual/CoreTasks/condition.html">the
online documentation</a> for example) for a complete list of nested
elements.</p>
<p>Just like the <code><condition></code> task, only a single
condition can be specified - you combine them using
<code><and></code> or <code><or></code> conditions.</p>
<p>In addition to the condition, you can specify three different
child elements, <code><elseif></code>, <code><then></code> and
<code><else></code>. All three subelements are optional.
Both <code><then></code> and <code><else></code> must not be
used more than once inside the if task. Both are
containers for Ant tasks, just like Ant's
<code><parallel></code> and <code><sequential></code>
tasks - in fact they are implemented using the same class as Ant's
<code><sequential></code> task.</p>
The <code><elseif></code> behaves exactly like an <code><if></code>
except that it cannot contain the <code><else></code> element
inside of it. You may specify as may of these as you like, and the
order they are specified is the order they are evaluated in. If the
condition on the <code><if></code> is false, then the first
<code><elseif></code> who's conditional evaluates to true
will be executed. The <code><else></code> will be executed
only if the <code><if></code> and all <code><elseif></code>
conditions are false.
<p>Use the following task to define the <code><if></code>
task before you use it the first time:</p>
<pre><code>
<taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" />
</code></pre>
<h3>Crude Example</h3>
<code>
<if>
<equals arg1="${foo}" arg2="bar" />
<then>
<echo message="The value of property foo is bar" />
</then>
<else>
<echo message="The value of property foo is not bar" />
</else>
</if>
</code>
<code>
<if>
<equals arg1="${foo}" arg2="bar" />
<then>
<echo message="The value of property foo is 'bar'" />
</then>
<elseif>
<equals arg1="${foo}" arg2="foo" />
<then>
<echo message="The value of property foo is 'foo'" />
</then>
</elseif>
<else>
<echo message="The value of property foo is not 'foo' or 'bar'" />
</else>
</if>
</code>
« More »
ImportTask¶
Imports another build file into the current project.
Targets and properties of the imported file can be overrridden
by targets and properties of the same name declared in the importing file.
The imported file will have a new synthetic property of
"phing.file.<projectname>" declared which gives the full path to the
imported file. Additionally each target in the imported file will be
declared twice: once with the normal name and once with "<projectname>."
prepended. The "<projectname>.<targetname>" synthetic targets allow the
importing file a mechanism to call the imported files targets as
dependencies or via the <phing> or <phingcall> task mechanisms.
« More »
IncludePathTask¶
Adds a normalized path to the PHP include_path.
This provides a way to alter the include_path without editing any global php.ini settings
or PHP_CLASSPATH environment variable.
<code>
<includepath classpath="new/path/here"/>
</code>
« More »
MatchingTask¶
This is an abstract task that should be used by all those tasks that
require to include or exclude files based on pattern matching.
This is very closely based on the ANT class of the same name.
« More »
MkdirTask¶
Task to create a directory.
Use \Project#createTask to register a new Task.
« More »
MoveTask¶
Moves a file or directory to a new file or directory.
By default, the destination file is overwritten if it
already exists. When overwrite is turned off, then files
are only moved if the source file is newer than the
destination file, or when the destination file does not
exist.
Source files and directories are only deleted when the file or
directory has been copied to the destination successfully.
« More »
PDOTask¶
Handles PDO configuration needed by SQL type tasks.
Use \Project#createTask to register a new Task.
« More »
PhingCallTask¶
Call another target in the same project.
<samp>
<target name="foo">
<phingcall target="bar">
<property name="property1" value="aaaaa" />
<property name="foo" value="baz" />
</phingcall>
</target>
<target name="bar" depends="init">
<echo message="prop is ${property1} ${foo}" />
</target>
</samp>
This only works as expected if neither property1 nor foo are defined in the project itself.
« More »
PhingReference¶
Helper class that implements the nested <reference>
element of <phing> and <phingcall>.
« More »
PhingTask¶
Task that invokes phing on another build file.
Use this task, for example, if you have nested buildfiles in your project. Unlike
AntTask, PhingTask can even support filesets:
<pre>
<phing>
<fileset dir="${srcdir}">
<include name="** /build.xml" /> <!-- space added after ** is there because of PHP comment syntax -->
<exclude name="build.xml" />
</fileset>
</phing>
</pre>
« More »
PhpEvalTask¶
Executes PHP function or evaluates expression and sets return value to a property.
WARNING:
This task can, of course, be abused with devastating effects. E.g. do not
modify internal Phing classes unless you know what you are doing.
« More »
PropertyPromptTask¶
Deprecated task that uses console to prompt user for property values.
This class is very slightly simpler than the InputTask, but lacks the ability
to use a non-console input handler. You should, therefore, use InputTask. This
class can serve as a reference, but will be removed in the future.
« More »
PropertyTask¶
Task for setting properties in buildfiles.
Use \Project#createTask to register a new Task.
« More »
ReflexiveTask¶
This task is for using filter chains to make changes to files and overwrite the original files.
This task was created to serve the need for "cleanup" tasks -- e.g. a ReplaceRegexp task or strip task
being used to modify files and then overwrite the modified files. In many (most?) cases you probably
should just use a copy task to preserve the original source files, but this task supports situations
where there is no src vs. build directory, and modifying source files is actually desired.
<code>
<reflexive>
<fileset dir=".">
<include pattern="*.html">
</fileset>
<filterchain>
<replaceregexp>
<regexp pattern="\n\r" replace="\n"/>
</replaceregexp>
</filterchain>
</reflexive>
</code>
« More »
ReplaceRegexpTask¶
ReplaceRegExp is a directory based task for replacing the occurrence of a
given regular expression with a substitution pattern in a selected file or
set of files.
<code>
<replaceregexp file="${src}/build.properties"
match="OldProperty=(.*)"
replace="NewProperty=\1"
byline="true"/>
</code>
« More »
ResolvePathTask¶
Task for resolving relative paths and setting absolute path in property value.
This task was created to address a need for resolving absolute paths of files / directories.
In many cases a relative directory (e.g. "./build") is specified, but it needs to be treated
as an absolute path since other build files (e.g. in subdirs) should all be using the same
path -- and not treating it as a relative path to their own directory.
<code>
<property name="relative_path" value="./dirname"/>
<resolvepath propertyName="absolute_path" file="${relative_path}"/>
<echo>Resolved [absolute] path: ${absolute_path}</echo>
</code>
TODO:
- Possibly integrate this with PackageAsPath, for handling/resolving dot-path paths.
« More »
SequentialTask¶
Sequential is a container task that contains other Phing Task objects.
The sequential task has no attributes and does not support any nested
elements apart from Ant tasks. Any valid Ant task may be embedded within the
sequential task.
« More »
SwitchTask¶
Task definition for the phing task to switch on a particular value.
Task calling syntax:
```
<switch value="value" [caseinsensitive="true|false"] >
<case value="val">
<property name="propname" value="propvalue" /> |
<phingcall target="targetname" /> |
any other tasks
</case>
[
<default>
<property name="propname" value="propvalue" /> |
<phingcall target="targetname" /> |
any other tasks
</default>
]
</switch>
```
Attributes:
value -> The value to switch on
caseinsensitive -> Should we do case insensitive comparisons?
(default is false)
Subitems:
case --> An individual case to consider, if the value that
is being switched on matches to value attribute of
the case, then the nested tasks will be executed.
default --> The default case for when no match is found.
Crude Example:
```
<switch value="${foo}">
<case value="bar">
<echo message="The value of property foo is bar" />
</case>
<case value="baz">
<echo message="The value of property foo is baz" />
</case>
<default>
<echo message="The value of property foo is not sensible" />
</default>
</switch>
```
« More »
TaskdefTask¶
Register a task for use within a buildfile.
This is for registering your own tasks -- or any non-core Task -- for use within a buildfile.
If you find that you are using a particular class frequently, you may want to edit the
phing/tasks/defaults.properties file so that it is included by default. You may also
want to submit it (if LGPL or compatible license) to be included in Phing distribution.
<pre>
<taskdef name="mytag" classname="path.to.MyHandlingClass"/>
.
.
<mytag param1="val1" param2="val2"/>
</pre>
TODO:
-- possibly refactor since this is almost the same as TypeDefTask
(right now these are just too simple to really justify creating an abstract class)
« More »
ThrowTask¶
Exits the active build, giving an additional message
if available.
Use \Project#createTask to register a new Task.
« More »
TouchTask¶
Touch a file and/or fileset(s); corresponds to the Unix touch command.
If the file to touch doesn't exist, an empty one is created.
« More »
TryCatchTask¶
A wrapper task that lets you run tasks(s) when another set
of tasks fails.
Inspired by [http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html](http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html)
« More »
TstampTask¶
Sets properties to the current time, or offsets from the current time.
The default properties are TSTAMP, DSTAMP and TODAY;
Based on Ant's Tstamp task.
« More »
TypedefTask¶
Register a datatype for use within a buildfile.
This is for registering your own datatypes for use within a buildfile.
If you find that you are using a particular class frequently, you may want to edit the
phing/types/defaults.properties file so that it is included by default. You may also
want to submit it (if LGPL or compatible license) to be included in Phing distribution.
<pre>
<typedef name="mytype" classname="path.to.MyHandlingClass"/>
.
<sometask ...>
<mytype param1="val1" param2="val2"/>
</sometask>
</pre>
TODO:
-- possibly refactor since this is almost the same as TaskDefTask
(right now these are just too simple to really justify creating an abstract class)
« More »
UpToDateTask¶
Sets the given property if the specified target has a timestamp
greater than all of the source files.
Use \Project#createTask to register a new Task.
« More »
WaitForTask¶
Based on Apache Ant Wait For:
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
« More »
WarnTask¶
Simple task to echo a warning message (Project::MSG_WARN) to all output devices.
Use \Project#createTask to register a new Task.
« More »
XsltTask¶
Implements an XSLT processing filter while copying files.
This is a shortcut for calling the <copy> task with the XSLTFilter used
in the <filterchains> section.
« More »
Classes, interfaces and traits
AssignedVar¶
An "inner" class for holding assigned var values.
May be need to expand beyond name/value in the future.
« More »
AutoloaderTask¶
The base class for all Tasks.
Use \Project#createTask to register a new Task.
« More »
CapsuleTask¶
A phing task for generating output by using Capsule.
This is based on the interface to TexenTask from Apache's Velocity engine.
« More »
ComposerTask¶
Composer Task
Run composer straight from phing
Use \Project#createTask to register a new Task.
« More »
ExportPropertiesTask¶
Saves currently defined properties into a specified file
Use \Project#createTask to register a new Task.
« More »
FileHashTask¶
fileHash
Calculate either MD5 or SHA hash value of a specified file and retun the
value in a property
« More »
FileSizeTask¶
fileHash
Calculate either MD5 or SHA hash value of a specified file and retun the
value in a property
« More »
FileSyncTask¶
The FileSyncTask class copies files either to or from a remote host, or locally
on the current host. It allows rsync to transfer the differences between two
sets of files across the network connection, using an efficient checksum-search
algorithm.
There are 4 different ways of using FileSyncTask:
1. For copying local files.
2. For copying from the local machine to a remote machine using a remote
shell program as the transport (ssh).
3. For copying from a remote machine to the local machine using a remote
shell program.
4. For listing files on a remote machine.
This is extended from Federico's original code, all his docs are kept in here below.
« More »
FtpDeployTask¶
FtpDeployTask
Deploys a set of files to a remote FTP server.
Example usage:
<ftpdeploy host="host" port="21" username="user" password="password" dir="public_html" mode="ascii" clearfirst="true" depends="false" filemode="" dirmode="">
<fileset dir=".">
<include name="**"/>
<exclude name="phing"/>
<exclude name="build.xml"/>
<exclude name="images/**.png"/>
<exclude name="images/**.gif"/>
<exclude name="images/**.jpg"/>
</fileset>
</ftpdeploy>
« More »
GrowlNotifyTask¶
Growl notification task for Phing, the PHP build tool.
PHP version 5
« More »
HttpGetTask¶
A HTTP download task.
Downloads a file via HTTP GET method and saves it to a specified directory
« More »
HttpRequestTask¶
A HTTP request task.
Making an HTTP request and try to match the response against an provided
regular expression.
« More »
HttpTask¶
Base class for HTTP_Request2-backed tasks
Handles nested <config /> and <header /> tags, contains a method for
HTTP_Request2 instance creation
« More »
JsHintTask¶
JsHintTask
Checks the JavaScript code using JSHint
See http://www.jshint.com/
« More »
JslLintTask¶
A Javascript lint task. Checks syntax of Javascript files.
Javascript lint (http://www.javascriptlint.com) must be in the system path.
This class is based on Knut Urdalen's PhpLintTask.
« More »
JsMinTask¶
Task to minify javascript files.
Requires JShrink (https://github.com/tedivm/JShrink) which
can be installed using composer
« More »
LoadFileTask¶
LoadFileTask
Loads a (text) file and stores the contents in a property.
Supports filterchains.
« More »
MailTask¶
Send an e-mail message
<mail tolist="user@example.org" subject="build complete">The build process is a success...</mail>
« More »
ManifestTask¶
ManifestTask
Generates a simple Manifest file with optional checksums.
Manifest schema:
...
path/to/file CHECKSUM [CHECKSUM2] [CHECKSUM3]
path/to/secondfile CHECKSUM [CHECKSUM2] [CHECKSUM3]
...
Example usage:
<manifest checksum="crc32" file="${dir_build}/Manifest">
<fileset refid="files_build" />
</manifest>
<manifest checksum="md5,adler32,sha256" file="${dir_build}/Manifest">
<fileset refid="files_build" />
</manifest>
« More »
PackageAsPathTask¶
Convert dot-notation packages to relative paths.
Use \Project#createTask to register a new Task.
« More »
ParallelTask¶
Uses the DocBlox_Parallel library to run nested Phing tasks concurrently.
WARNING: this task is highly experimental!
« More »
PatchTask¶
Patches a file by applying a 'diff' file to it
Requires "patch" to be on the execution path.
« More »
PearPackage2Task¶
A task to create a PEAR package.xml version 2.0 file.
This class uses the PEAR_PackageFileManager2 class to perform the work.
This class is designed to be very flexible -- i.e. account for changes to the package.xml w/o
requiring changes to this class. We've accomplished this by having generic <option> and <mapping>
nested elements. All options are set using PEAR_PackageFileManager2::setOptions().
The <option> tag is used to set a simple option value.
<code>
<option name="option_name" value="option_value"/>
or <option name="option_name">option_value</option>
</code>
The <mapping> tag represents a complex data type. You can use nested <element> (and nested <element> with
<element> tags) to represent the full complexity of the structure. Bear in mind that what you are creating
will be mapped to an associative array that will be passed in via PEAR_PackageFileManager2::setOptions().
<code>
<mapping name="option_name">
<element key="key_name" value="key_val"/>
<element key="key_name" value="key_val"/>
</mapping>
</code>
Here's an over-simple example of how this could be used:
<code>
<pearpkg2 name="phing" dir="${build.src.dir}">
<fileset dir="src">
<include name="**"/>
</fileset>
<option name="outputdirectory" value="./build"/>
<option name="packagefile" value="package2.xml"/>
<option name="packagedirectory" value="./${build.dist.dir}"/>
<option name="baseinstalldir" value="${pkg.prefix}"/>
<option name="channel" value="my.pear-channel.com"/>
<option name="summary" value="${pkg.summary}"/>
<option name="description" value="${pkg.description}"/>
<option name="apiversion" value="${pkg.version}"/>
<option name="apistability" value="beta"/>
<option name="releaseversion" value="${pkg.version}"/>
<option name="releasestability" value="beta"/>
<option name="license" value="none"/>
<option name="phpdep" value="5.0.0"/>
<option name="pearinstallerdep" value="1.4.6"/>
<option name="packagetype" value="php"/>
<option name="notes" value="${pkg.relnotes}"/>
<mapping name="maintainers">
<element>
<element key="handle" value="hlellelid"/>
<element key="name" value="Hans"/>
<element key="email" value="hans@xmpl.org"/>
<element key="role" value="lead"/>
<element key="active" value="yes"/>
</element>
</mapping>
</pearpkg2>
</code>
Look at the build.xml in the Phing base directory (assuming you have the full distro / CVS version of Phing) to
see a more complete example of how to call this script.
« More »
PearPackageTask¶
A task to create PEAR package.xml file.
This class uses the PEAR_PackageFileMaintainer class to perform the work.
This class is designed to be very flexible -- i.e. account for changes to the package.xml w/o
requiring changes to this class. We've accomplished this by having generic <option> and <mapping>
nested elements. All options are set using PEAR_PackageFileMaintainer::setOptions().
The <option> tag is used to set a simple option value.
<code>
<option name="option_name" value="option_value"/>
or <option name="option_name">option_value</option>
</code>
The <mapping> tag represents a complex data type. You can use nested <element> (and nested <element> with
<element> tags) to represent the full complexity of the structure. Bear in mind that what you are creating
will be mapped to an associative array that will be passed in via PEAR_PackageFileMaintainer::setOptions().
<code>
<mapping name="option_name">
<element key="key_name" value="key_val"/>
<element key="key_name" value="key_val"/>
</mapping>
</code>
Here's an over-simple example of how this could be used:
<code>
<pearpkg name="phing" dir="${build.src.dir}" destFile="${build.base.dir}/package.xml">
<fileset>
<include name="**"/>
</fileset>
<option name="notes">Sample release notes here.</option>
<option name="description">Package description</option>
<option name="summary">Short description</option>
<option name="version" value="2.0.0b1"/>
<option name="state" value="beta"/>
<mapping name="maintainers">
<element>
<element key="handle" value="hlellelid"/>
<element key="name" value="Hans"/>
<element key="email" value="hans@xmpl.org"/>
<element key="role" value="lead"/>
</element>
</mapping>
</pearpkg>
</code>
Look at the build.xml in the Phing base directory (assuming you have the full distro / CVS version of Phing) to
see a more complete example of how to call this script.
« More »
PearPkgMapping¶
Handles complex options <mapping> elements which are hashes (assoc arrays).
« More »
PearPkgMappingElement¶
Sub-element of <mapping>.
« More »
PearPkgOption¶
Generic option class is used for non-complex options.
« More »
PearPkgRole¶
Encapsulates file roles
« More »
PharPackageTask¶
Package task for {@link http://www.php.net/manual/en/book.phar.php Phar technology}.
This is very closely based on the ANT class of the same name.
« More »
PhpCodeSnifferTask¶
A PHP code sniffer task. Checking the style of one or more PHP source files.
Use \Project#createTask to register a new Task.
« More »
PhpCodeSnifferTask_Wrapper¶
Wrapper to disable PHPCS's destructor
« More »
PhpLintTask¶
A PHP lint task. Checking syntax of one or more PHP source file.
Use \Project#createTask to register a new Task.
« More »
rSTTask¶
reStructuredText rendering task for Phing, the PHP build tool.
PHP version 5
« More »
S3GetTask¶
Downloads an object off S3
Provides common methods and properties to all of the S3 tasks
« More »
S3PutTask¶
Stores an object on S3
Provides common methods and properties to all of the S3 tasks
« More »
ScpTask¶
Copy files to and from a remote host using scp.
Use \Project#createTask to register a new Task.
« More »
Service_Amazon¶
Abstract Service_Amazon class.
Implements common methods & properties used by all Amazon services
« More »
Service_Amazon_S3¶
Abstract Service_Amazon_S3 class.
Provides common methods and properties to all of the S3 tasks
« More »
SmartyTask¶
A phing task for generating output by using Smarty.
This is based on the TexenTask from Apache's Velocity engine. This class
was originally proted in order to provide a template compiling system for
Torque.
TODO:
- Add Path / useClasspath support?
« More »
Ssh2MethodConnectionParam¶
Class that holds parameters for an ssh2_connect $methods parameter
This corresponds to the client_to_server and server_to_client keys of the optional $methods parameter
for the ssh2_connect function
« More »
Ssh2MethodParam¶
Class that holds parameters for an ssh2_connect $methods parameter
This corresponds to the optional $methods parameter
for the ssh2_connect function
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
SshTask¶
Execute commands on a remote host using ssh.
Use \Project#createTask to register a new Task.
« More »
SymlinkTask¶
Generates symlinks based on a target / link combination.
Can also symlink contents of a directory, individually
Single target symlink example:
<code>
<symlink target="/some/shared/file" link="${project.basedir}/htdocs/my_file" />
</code>
Symlink entire contents of directory
This will go through the contents of "/my/shared/library/*"
and create a symlink for each entry into ${project.basedir}/library/
<code>
<symlink link="${project.basedir}/library">
<fileset dir="/my/shared/library">
<include name="*" />
</fileset>
</symlink>
</code>
« More »
TarFileSet¶
This is a FileSet with the option to specify permissions.
Permissions are currently not implemented by PEAR Archive_Tar,
but hopefully they will be in the future.
« More »
TarTask¶
Creates a tar archive using PEAR Archive_Tar.
This is very closely based on the ANT class of the same name.
« More »
UntarTask¶
Extracts one or several tar archives using PEAR Archive_Tar
This is very closely based on the ANT class of the same name.
« More »
UnzipTask¶
Extracts one or several zip archives using ZipArchive class.
This is very closely based on the ANT class of the same name.
« More »
VersionTask¶
VersionTask
Increments a three-part version number from a given file
and writes it back to the file.
Incrementing is based on given releasetype, which can be one
of Major, Minor and Bugfix.
Resulting version number is also published under supplied property.
« More »
WikiPublishTask¶
Publish Wiki document using Wiki API.
Use \Project#createTask to register a new Task.
« More »
XmlLintTask¶
A XML lint task. Checking syntax of one or more XML files against an XML Schema using the DOM extension.
Use \Project#createTask to register a new Task.
« More »
XmlPropertyTask¶
Task for setting properties from an XML file in buildfiles.
Use \Project#createTask to register a new Task.
« More »
ZendCodeAnalyzerTask¶
ZendCodeAnalyzerTask analyze PHP source code using the ZendCodeAnalyzer included in Zend Studio 5.1
Available warnings:
<b>zend-error</b> - %s(line %d): %s
<b>oneline-comment</b> - One-line comment ends with tag.
<b>bool-assign</b> - Assignment seen where boolean expression is expected. Did you mean '==' instead of '='?
<b>bool-print</b> - Print statement used when boolean expression is expected.
<b>bool-array</b> - Array used when boolean expression is expected.
<b>bool-object</b> - Object used when boolean expression is expected.
<b>call-time-ref</b> - Call-time reference is deprecated. Define function as accepting parameter by reference instead.
<b>if-if-else</b> - In if-if-else construction else relates to the closest if. Use braces to make the code clearer.
<b>define-params</b> - define() requires two or three parameters.
<b>define-const</b> - First parameter for define() should be string. Maybe you forgot quotes?
<b>break-var</b> - Break/continue with variable is dangerous - break level can be out of scope.
<b>break-depth</b> - Break/continue with depth more than current nesting level.
<b>var-once</b> - Variable '%s' encountered only once. May be a typo?
<b>var-arg-unused</b> - Function argument '%s' is never used.
<b>var-global-unused</b> - Global variable '%s' is defined but never used.
<b>var-use-before-def</b> - Variable '%s' is used before it was assigned.
<b>var-use-before-def-global</b> - Global variable '%s' is used without being assigned. You are probably relying on register_globals feature of PHP. Note that this feature is off by default.
<b>var-no-global</b> - PHP global variable '%s' is used as local. Maybe you wanted to define '%s' as global?
<b>var-value-unused</b> - Value assigned to variable '%s' is never used
<b>var-ref-notmodified</b> - Function parameter '%s' is passed by reference but never modified. Consider passing by value.
<b>return-empty-val</b> - Function '%s' has both empty return and return with value.
<b>return-empty-used</b> - Function '%s' has empty return but return value is used.
<b>return-noref</b> - Function '%s' returns reference but the value is not assigned by reference. Maybe you meant '=&' instead of '='?
<b>return-end-used</b> - Control reaches the end of function '%s'(file %s, line %d) but return value is used.
<b>sprintf-miss-args</b> - Missing arguments for sprintf: format reqires %d arguments but %d are supplied.
<b>sprintf-extra-args</b> - Extra arguments for sprintf: format reqires %d arguments but %d are supplied.
<b>unreach-code</b> - Unreachable code in function '%s'.
<b>include-var</b> - include/require with user-accessible variable can be dangerous. Consider using constant instead.
<b>non-object</b> - Variable '%s' used as object, but has different type.
<b>bad-escape</b> - Bad escape sequence: \%c, did you mean \\%c?
<b>empty-cond</b> - Condition without a body
<b>expr-unused</b> - Expression result is never used
« More »
ZipFileSet¶
This is a FileSet with the to specify permissions.
Permissions are currently not implemented by PEAR Archive_Tar,
but hopefully they will be in the future.
« More »
ZipTask¶
Creates a zip archive using PHP ZipArchive extension/
This is very closely based on the ANT class of the same name.
« More »
Classes, interfaces and traits
BufferedReader¶
Convenience class for reading files.
« More »
BufferedWriter¶
Convenience class for writing files.
« More »
ConsoleReader¶
Convenience class for reading console input.
« More »
FileOutputStream¶
Output stream subclass for file streams.
« More »
FileReader¶
Convenience class for reading files.
Unlike the Java counterpart, this class does not (yet) handle
character set transformations. This will be an important function
of this class with move to supporting PHP6.
« More »
FileSystem¶
This is an abstract class for platform specific filesystem implementations
you have to implement each method in the platform specific filesystem implementation
classes Your local filesytem implementation must extend this class.
You should also use this class as a template to write your local implementation
Some native PHP filesystem specific methods are abstracted here as well. Anyway
you _must_ always use this methods via a PhingFile object (that by nature uses the
*FileSystem drivers to access the real filesystem via this class using natives.
FIXME:
- Error handling reduced to min fallthrough runtime exceptions
more precise errorhandling is done by the PhingFile class
« More »
FileWriter¶
Convenience class for performing file write operations.
Unlike the Java counterpart, this class does not (yet) handle
character set transformations. This will be an important function
of this class with move to supporting PHP6.
« More »
FilterReader¶
Wrapper class for readers, which can be used to apply filters.
« More »
IOException¶
Extends Exception to take advantage of methods therein.
« More »
OutputStream¶
Wrapper class for PHP stream that supports write operations.
« More »
OutputStreamWriter¶
Writer class for OutputStream objects.
Unlike the Java counterpart, this class does not (yet) handle
character set transformations. This will be an important function
of this class with move to supporting PHP6.
« More »
PhingFile¶
An abstract representation of file and directory pathnames.
« More »
Reader¶
Abstract class for reading character streams.
« More »
StringReader¶
Dummy class for reading from string of characters.
« More »
UnixFileSystem¶
UnixFileSystem class. This class encapsulates the basic file system functions
for platforms using the unix (posix)-stylish filesystem. It wraps php native
functions suppressing normal PHP error reporting and instead uses Exception
to report and error.
This class is part of a oop based filesystem abstraction and targeted to run
on all supported php platforms.
Note: For debugging turn track_errors on in the php.ini. The error messages
and log messages from this class will then be clearer because $php_errormsg
is passed as part of the message.
FIXME:
- Comments
- Error handling reduced to min, error are handled by PhingFile mainly
« More »
Win32FileSystem¶
This is an abstract class for platform specific filesystem implementations
you have to implement each method in the platform specific filesystem implementation
classes Your local filesytem implementation must extend this class.
You should also use this class as a template to write your local implementation
Some native PHP filesystem specific methods are abstracted here as well. Anyway
you _must_ always use this methods via a PhingFile object (that by nature uses the
*FileSystem drivers to access the real filesystem via this class using natives.
FIXME:
- Error handling reduced to min fallthrough runtime exceptions
more precise errorhandling is done by the PhingFile class
« More »
WinNTFileSystem¶
FileSystem for Windows NT/2000.
You should also use this class as a template to write your local implementation
Some native PHP filesystem specific methods are abstracted here as well. Anyway
you _must_ always use this methods via a PhingFile object (that by nature uses the
*FileSystem drivers to access the real filesystem via this class using natives.
FIXME:
- Error handling reduced to min fallthrough runtime exceptions
more precise errorhandling is done by the PhingFile class
« More »
Writer¶
Abstract class for writing character streams.
« More »
Classes, interfaces and traits
ChainableReader¶
Interface indicating that a reader may be chained to another one.
« More »
BaseFilterReader¶
Base class for core filter readers.
« More »
BaseParamFilterReader¶
Base class for core filter readers.
« More »
ExpandProperties¶
Expands Phing Properties, if any, in the data.
<p>
Example:<br>
<pre><expandproperties/></pre>
Or:
<pre><filterreader classname="phing.filters.ExpandProperties'/></pre>
« More »
HeadFilter¶
Reads the first <code>n</code> lines of a stream.
(Default is first 10 lines.)
<p>
Example:
<pre><headfilter lines="3"/></pre>
Or:
<pre><filterreader classname="phing.filters.HeadFilter">
<param name="lines" value="3"/>
</filterreader></pre>
« More »
IconvFilter¶
Encode data from <code>in</code> encoding to <code>out</code> encoding.
Example:
<pre>
<iconvfilter inputencoding="UTF-8" outputencoding="CP1251" />
</pre>
Or:
<pre>
<filterreader classname="phing.filters.IconvFilter">
<param name="inputencoding" value="UTF-8" />
<param name="outputencoding" value="CP1251" />
</filterreader>
</pre>
« More »
LineContains¶
Filter which includes only those lines that contain all the user-specified
strings.
Example:
<pre><linecontains>
<contains value="foo">
<contains value="bar">
</linecontains></pre>
Or:
<pre><filterreader classname="phing.filters.LineContains">
<param type="contains" value="foo"/>
<param type="contains" value="bar"/>
</filterreader></pre>
This will include only those lines that contain <code>foo</code> and
<code>bar</code>.
« More »
LineContainsRegexp¶
Filter which includes only those lines that contain the user-specified
regular expression matching strings.
Example:
<pre><linecontainsregexp>
<regexp pattern="foo*">
</linecontainsregexp></pre>
Or:
<pre><filterreader classname="phing.filters.LineContainsRegExp">
<param type="regexp" value="foo*"/>
</filterreader></pre>
This will fetch all those lines that contain the pattern <code>foo</code>
« More »
PrefixLines¶
Attaches a prefix to every line.
Example:
<pre><prefixlines prefix="Foo"/></pre>
Or:
<pre><filterreader classname="phing.filters.PrefixLines">
<param name="prefix" value="Foo"/>
</filterreader></pre>
« More »
ReplaceRegexp¶
Performs a regexp find/replace on stream.
<p>
Example:<br>
<pre>
<replaceregexp>
<regexp pattern="\r\n" replace="\n"/>
<regexp pattern="(\w+)\.xml" replace="\1.php" ignoreCase="true"/>
</replaceregexp>
</pre>
« More »
ReplaceTokens¶
Replaces tokens in the original input with user-supplied values.
Example:
<pre><replacetokens begintoken="#" endtoken="#">;
<token key="DATE" value="${TODAY}"/>
</replacetokens></pre>
Or:
<pre><filterreader classname="phing.filters.ReplaceTokens">
<param type="tokenchar" name="begintoken" value="#"/>
<param type="tokenchar" name="endtoken" value="#"/>
<param type="token" name="DATE" value="${TODAY}"/>
</filterreader></pre>
« More »
ReplaceTokensWithFile¶
Replaces tokens in the original input with the contents of a file.
The file to be used is controlled by the name of the token which
corresponds to the basename of the file to be used together with
the optional pre and postfix strings that is possible to set.
By default all HTML entities in the file is replaced by the
corresponding HTML entities. This behaviour can be controlled by
the "translatehtml" parameter.
Supported parameters are:
<pre>
prefix string Text to be prefixed to token before using as filename
postfix string Text to be prefixed to token before using as filename
dir string The directory where the files should be read from
translatehtml bool If we should translate all HTML entities in the file.
</pre>
Example:
<pre><filterreader classname="phing.filters.ReplaceTokensWithFile">
<param name="dir" value="examples/" />
<param name="postfix" value=".php" />
</filterreader></pre>
« More »
StripLineBreaks¶
Filter to flatten the stream to a single line.
Example:
<pre><striplinebreaks/></pre>
Or:
<pre><filterreader classname="phing.filters.StripLineBreaks"/></pre>
« More »
StripWhitespace¶
Strips whitespace from [php] files using PHP stripwhitespace() method.
« More »
TabToSpaces¶
Converts tabs to spaces.
Example:
<pre><tabtospaces tablength="8"></pre>
Or:
<pre><filterreader classname="phing.filters.TabsToSpaces">
<param name="tablength" value="8">
</filterreader></pre>
« More »
TailFilter¶
Reads the last <code>n</code> lines of a stream. (Default is last10 lines.)
Example:
<pre><tailfilter lines="3" /></pre>
Or:
<pre><filterreader classname="phing.filters.TailFilter">
<param name="lines" value="3">
</filterreader></pre>
« More »
TidyFilter¶
This filter uses the bundled-with-PHP Tidy extension to filter input.
<p>
Example:<br/>
<pre>
<tidyfilter encoding="utf8">
<config name="indent" value="true"/>
<config name="output-xhtml" value="true"/>
</tidyfilter>
</pre>
« More »
TranslateGettext¶
Replaces gettext("message id") and _("message id") with the translated string.
Gettext is great for creating multi-lingual sites, but in some cases (e.g. for
performance reasons) you may wish to replace the gettext calls with the translations
of the strings; that's what this task is for. Note that this is similar to
ReplaceTokens, but both the find and the replace aspect is more complicated -- hence
this is a separate, stand-alone filter.
<p>
Example:<br>
<pre>
<translategettext locale="en_US" domain="messages" dir="${webroot}/local"/>
</pre>
« More »
XincludeFilter¶
Applies Xinclude parsing to incoming text.
Uses PHP DOM XML support
« More »
XsltFilter¶
Applies XSL stylesheet to incoming text.
Uses PHP XSLT support (libxslt).
« More »
XSLTParam¶
Class that holds an XSLT parameter.
« More »
Classes, interfaces and traits
DataStore¶
An abstract representation of file and directory pathnames.
« More »
DirectoryScanner¶
Class for scanning a directory for files/directories that match a certain
criteria.
These criteria consist of a set of include and exclude patterns. With these
patterns, you can select which files you want to have included, and which
files you want to have excluded.
The idea is simple. A given directory is recursively scanned for all files
and directories. Each file/directory is matched against a set of include
and exclude patterns. Only files/directories that match at least one
pattern of the include pattern list, and don't match a pattern of the
exclude pattern list will be placed in the list of files/directories found.
When no list of include patterns is supplied, "**" will be used, which
means that everything will be matched. When no list of exclude patterns is
supplied, an empty list is used, such that nothing will be excluded.
The pattern matching is done as follows:
The name to be matched is split up in path segments. A path segment is the
name of a directory or file, which is bounded by DIRECTORY_SEPARATOR
('/' under UNIX, '\' under Windows).
E.g. "abc/def/ghi/xyz.php" is split up in the segments "abc", "def", "ghi"
and "xyz.php".
The same is done for the pattern against which should be matched.
Then the segments of the name and the pattern will be matched against each
other. When '**' is used for a path segment in the pattern, then it matches
zero or more path segments of the name.
There are special case regarding the use of DIRECTORY_SEPARATOR at
the beginning of the pattern and the string to match:
When a pattern starts with a DIRECTORY_SEPARATOR, the string
to match must also start with a DIRECTORY_SEPARATOR.
When a pattern does not start with a DIRECTORY_SEPARATOR, the
string to match may not start with a DIRECTORY_SEPARATOR.
When one of these rules is not obeyed, the string will not
match.
When a name path segment is matched against a pattern path segment, the
following special characters can be used:
'*' matches zero or more characters,
'?' matches one character.
Examples:
"**\*.php" matches all .php files/dirs in a directory tree.
"test\a??.php" matches all files/dirs which start with an 'a', then two
more characters and then ".php", in a directory called test.
"**" matches everything in a directory tree.
"**\test\**\XYZ*" matches all files/dirs that start with "XYZ" and where
there is a parent directory called test (e.g. "abc\test\def\ghi\XYZ123").
Case sensitivity may be turned off if necessary. By default, it is
turned on.
Example of usage:
$ds = new DirectroyScanner();
$includes = array("**\*.php");
$excludes = array("modules\*\**");
$ds->SetIncludes($includes);
$ds->SetExcludes($excludes);
$ds->SetBasedir("test");
$ds->SetCaseSensitive(true);
$ds->Scan();
print("FILES:");
$files = ds->GetIncludedFiles();
for ($i = 0; $i < count($files);$i++) {
println("$files[$i]\n");
}
This will scan a directory called test for .php files, but excludes all
.php files in all directories under a directory called "modules"
This class is complete preg/ereg free port of the Java class
org.apache.tools.ant.DirectoryScanner. Even functions that use preg/ereg
internally (like split()) are not used. Only the _fast_ string functions
and comparison operators (=== !=== etc) are used for matching and tokenizing.
« More »
ExtendedFileStream¶
Extended file stream wrapper class which auto-creates directories
« More »
FileUtils¶
File utility class.
- handles os independent stuff etc
- mapper stuff
- filter stuff
« More »
LogWriter¶
Extends the Writer class to output messages to Phing's log
« More »
PathTokenizer¶
A Path tokenizer takes a path and returns the components that make up
that path.
The path can use path separators of either ':' or ';' and file separators
of either '/' or '\'.
« More »
PearPackageScanner¶
Scans for files in a PEAR package.
These criteria consist of a set of include and exclude patterns. With these
patterns, you can select which files you want to have included, and which
files you want to have excluded.
The idea is simple. A given directory is recursively scanned for all files
and directories. Each file/directory is matched against a set of include
and exclude patterns. Only files/directories that match at least one
pattern of the include pattern list, and don't match a pattern of the
exclude pattern list will be placed in the list of files/directories found.
When no list of include patterns is supplied, "**" will be used, which
means that everything will be matched. When no list of exclude patterns is
supplied, an empty list is used, such that nothing will be excluded.
The pattern matching is done as follows:
The name to be matched is split up in path segments. A path segment is the
name of a directory or file, which is bounded by DIRECTORY_SEPARATOR
('/' under UNIX, '\' under Windows).
E.g. "abc/def/ghi/xyz.php" is split up in the segments "abc", "def", "ghi"
and "xyz.php".
The same is done for the pattern against which should be matched.
Then the segments of the name and the pattern will be matched against each
other. When '**' is used for a path segment in the pattern, then it matches
zero or more path segments of the name.
There are special case regarding the use of DIRECTORY_SEPARATOR at
the beginning of the pattern and the string to match:
When a pattern starts with a DIRECTORY_SEPARATOR, the string
to match must also start with a DIRECTORY_SEPARATOR.
When a pattern does not start with a DIRECTORY_SEPARATOR, the
string to match may not start with a DIRECTORY_SEPARATOR.
When one of these rules is not obeyed, the string will not
match.
When a name path segment is matched against a pattern path segment, the
following special characters can be used:
'*' matches zero or more characters,
'?' matches one character.
Examples:
"**\*.php" matches all .php files/dirs in a directory tree.
"test\a??.php" matches all files/dirs which start with an 'a', then two
more characters and then ".php", in a directory called test.
"**" matches everything in a directory tree.
"**\test\**\XYZ*" matches all files/dirs that start with "XYZ" and where
there is a parent directory called test (e.g. "abc\test\def\ghi\XYZ123").
Case sensitivity may be turned off if necessary. By default, it is
turned on.
Example of usage:
$ds = new DirectroyScanner();
$includes = array("**\*.php");
$excludes = array("modules\*\**");
$ds->SetIncludes($includes);
$ds->SetExcludes($excludes);
$ds->SetBasedir("test");
$ds->SetCaseSensitive(true);
$ds->Scan();
print("FILES:");
$files = ds->GetIncludedFiles();
for ($i = 0; $i < count($files);$i++) {
println("$files[$i]\n");
}
This will scan a directory called test for .php files, but excludes all
.php files in all directories under a directory called "modules"
This class is complete preg/ereg free port of the Java class
org.apache.tools.ant.DirectoryScanner. Even functions that use preg/ereg
internally (like split()) are not used. Only the _fast_ string functions
and comparison operators (=== !=== etc) are used for matching and tokenizing.
« More »
SourceFileScanner¶
Utility class that collects the functionality of the various
scanDir methods that have been scattered in several tasks before.
The only method returns an array of source files. The array is a
subset of the files given as a parameter and holds only those that
are newer than their corresponding target files.
« More »
Classes, interfaces and traits
Parameterizable¶
Parameterizable objects take genric key value pairs.
« More »
AbstractFileSet¶
The FileSet class provides methods and properties for accessing
and managing filesets. It extends ProjectComponent and thus inherits
all methods and properties (not explicitly declared). See ProjectComponent
for further detail.
TODO:
- merge this with patternsets: FileSet extends PatternSet !!!
requires additional mods to the parsing algo
[HL] .... not sure if that really makes so much sense. I think
that perhaps they should use common utility class if there really
is that much shared functionality
« More »
Commandline¶
Commandline objects help handling command lines specifying processes to
execute.
The class can be used to define a command line as nested elements or as a
helper to define a command line by an application.
<p>
<code>
<someelement><br>
<acommandline executable="/executable/to/run"><br>
<argument value="argument 1" /><br>
<argument line="argument_1 argument_2 argument_3" /><br>
<argument value="argument 4" /><br>
</acommandline><br>
</someelement><br>
</code>
The element <code>someelement</code> must provide a method
<code>createAcommandline</code> which returns an instance of this class.
« More »
CommandlineArgument¶
"Inner" class used for nested xml command line definitions.
« More »
CommandlineMarker¶
Class to keep track of the position of an Argument.
<p>This class is there to support the srcfile and targetfile
elements of <execon> and <transform> - don't know
whether there might be additional use cases.</p> --SB
« More »
DataType¶
Base class for those classes that can appear inside the build file
as stand alone data types.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
Description¶
Description is used to provide a project-wide description element
(that is, a description that applies to a buildfile as a whole).
If present, the <description> element is printed out before the
target descriptions.
Description has no attributes, only text. There can only be one
project description per project. A second description element will
overwrite the first.
« More »
DirSet¶
Subclass as hint for supporting tasks that the included directories
instead of files should be used.
TODO:
- merge this with patternsets: FileSet extends PatternSet !!!
requires additional mods to the parsing algo
[HL] .... not sure if that really makes so much sense. I think
that perhaps they should use common utility class if there really
is that much shared functionality
« More »
Excludes¶
Datatype which handles excluded files, classes and methods.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
ExcludesNameEntry¶
Class for holding nested excludes elements (file, class, method).
« More »
FileList¶
FileList represents an explicitly named list of files. FileLists
are useful when you want to capture a list of files regardless of
whether they currently exist.
<filelist
id="docfiles"
dir="${phing.docs.dir}"
files="chapters/Installation.html,chapters/Setup.html"/>
OR
<filelist
dir="${doc.src.dir}"
listfile="${phing.docs.dir}/PhingGuide.book"/>
(or a mixture of files="" and listfile="" can be used)
« More »
FileSet¶
Moved out of MatchingTask to make it a standalone object that could
be referenced (by scripts for example).
TODO:
- merge this with patternsets: FileSet extends PatternSet !!!
requires additional mods to the parsing algo
[HL] .... not sure if that really makes so much sense. I think
that perhaps they should use common utility class if there really
is that much shared functionality
« More »
FilterChain¶
FilterChain may contain a chained set of filter readers.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
Mapper¶
Filename Mapper maps source file name(s) to target file name(s).
Built-in mappers can be accessed by specifying they "type" attribute:
<code>
<mapper type="glob" from="*.php" to="*.php.bak"/>
</code>
Custom mappers can be specified by providing a dot-path to a include_path-relative
class:
<code>
<mapper classname="myapp.mappers.DevToProdMapper" from="*.php" to="*.php"/>
<!-- maps all PHP files from development server to production server, for example -->
</code>
« More »
Parameter¶
A parameter is composed of a name, type and value. Nested
Parameters are also possible, but the using task/type has
to support them
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
Path¶
This object represents a path as used by include_path or PATH
environment variable.
This class has been adopted from the Java Ant equivalent. The ability have
path structures in Phing is important; however, because of how PHP classes interact
the ability to specify CLASSPATHs makes less sense than Java.Rather than providing
CLASSPATH for any tasks that take classes as parameters, perhaps a better
solution in PHP is to have an IncludePath task, which prepends paths to PHP's include_path
INI variable. This gets around the problem that simply using a path to load the initial
PHP class is not enough (in most cases the loaded class may assume that it is on the global
PHP include_path, and will try to load dependent classes accordingly). The other option is
to provide a way for this class to add paths to the include path, if desired -- or to create
an IncludePath subclass. Once added, though, when would a path be removed from the include path?
<p>
<code>
<sometask><br>
<somepath><br>
<pathelement location="/path/to/file" /><br>
<pathelement path="/path/to/class2;/path/to/class3" /><br>
<pathelement location="/path/to/file3" /><br>
</somepath><br>
</sometask><br>
</code>
<p>
The object implemention <code>sometask</code> must provide a method called
<code>createSomepath</code> which returns an instance of <code>Path</code>.
Nested path definitions are handled by the Path object and must be labeled
<code>pathelement</code>.<p>
The path element takes a parameter <code>path</code> which will be parsed
and split into single elements. It will usually be used
to define a path from an environment variable.
« More »
PathElement¶
Helper class, holds the nested <code><pathelement></code> values.
« More »
PatternSet¶
The patternset storage component. Carries all necessary data and methods
for the patternset stuff.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
PatternSetNameEntry¶
"Internal" class for holding an include/exclude pattern.
« More »
PhingFilterReader¶
A PhingFilterReader is a wrapper class that encloses the className
and configuration of a Configurable FilterReader.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
PropertyValue¶
Class to hold a property value
Class only required to make it possible to add a property as reference
« More »
Reference¶
Class to hold a reference to another object in the project.
« More »
RegularExpression¶
A regular expression datatype. Keeps an instance of the
compiled expression for speed purposes. This compiled
expression is lazily evaluated (it is compiled the first
time it is needed). The syntax is the dependent on which
regular expression type you are using.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
TokenSource¶
A parameter is composed of a name, type and value.
Example of usage:
<replacetokens>
<tokensource classname="phing.filters.util.IniFileTokenReader">
<!-- all params for the TokenReader here -->
<param name="file" value="tokens.ini" />
</tokensource>
</replacetokens>
or:
<filterreader classname="phing.filters.ReplaceTokens">
<param type="tokensource>
<param name="classname" value="phing.filters.util.IniFileTokenReader" />
<param name="file" value="tokens.ini" />
</param>
</filterreader>
« More »
Classes, interfaces and traits
ExtendFileSelector¶
This is the interface to be used by all custom selectors, those that are
called through the <custom> tag. It is the amalgamation of two
interfaces, the FileSelector and the Paramterizable interface. Note that
you will almost certainly want the default behaviour for handling
Parameters, so you probably want to use the BaseExtendSelector class
as the base class for your custom selector rather than implementing
this interface from scratch.
« More »
FileSelector¶
This is the interface to be used by all selectors.
« More »
SelectorContainer¶
This is the interface for selectors that can contain other selectors.
« More »
SelectorScanner¶
An interface used to describe the actions required by any type of
directory scanner that supports Selecters.
« More »
AndSelector¶
This selector has a collection of other selectors, all of which have to
select a file in order for this selector to select it.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
BaseExtendSelector¶
Convenience base class for all selectors accessed through ExtendSelector.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »
BaseSelector¶
A convenience base class that you can subclass Selectors from. It
provides some helpful common behaviour. Note that there is no need
for Selectors to inherit from this class, it is only necessary that
they implement FileSelector.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
BaseSelectorContainer¶
This is the base class for selectors that can contain other selectors.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
ContainsRegexpSelector¶
Selector that filters files based on whether they contain a
particular string using regexp.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »
ContainsSelector¶
Selector that filters files based on whether they contain a
particular string.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »
DateSelector¶
Selector that chooses files based on their last modified date. Ant uses
millisecond precision (thanks to Java); PHP is forced to use only seconds
precision.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »
DependSelector¶
Selector that filters files based on whether they are newer than
a matching file in another directory tree. It can contain a mapper
element, so isn't available as an ExtendSelector (since those
parameters can't hold other elements).
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
DepthSelector¶
Selector that filters files based on the how deep in the directory
tree they are.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »
ExtendSelector¶
Selector that selects files by forwarding the request on to other classes.
TODO - Consider adding Path (phing.types.Path) support to this class
and to the Mappers class. See Ant versions for implimentation details.
« More »
FilenameSelector¶
Selector that filters files based on the filename.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »
MajoritySelector¶
This selector is here just to shake up your thinking a bit. Don't get
too caught up in boolean, there are other ways you can evaluate a
collection of selectors. This one takes a vote of the selectors it
contains, and majority wins. You could also have an "all-but-one"
selector, a "weighted-average" selector, and so on. These are left
as exercises for the reader (as are the usecases where this would
be necessary).
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
NoneSelector¶
This selector has a collection of other selectors. All of those selectors
must refuse to select a file before the file is considered selected by
this selector.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
NotSelector¶
This selector has one other selectors whose meaning it inverts. It
actually relies on NoneSelector for its implementation of the
isSelected() method, but it adds a check to ensure there is only one
other selector contained within.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
OrSelector¶
This selector has a collection of other selectors, any of which have to
select a file in order for this selector to select it.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
PresentSelector¶
Selector that filters files based on whether they appear in another
directory tree. It can contain a mapper element, so isn't available
as an ExtendSelector (since those parameters can't hold other
elements).
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
SelectorUtils¶
<p>This is a utility class used by selectors and DirectoryScanner. The
functionality more properly belongs just to selectors, but unfortunately
DirectoryScanner exposed these as protected methods. Thus we have to
support any subclasses of DirectoryScanner that may access these methods.
</p>
<p>This is a Singleton.</p>
« More »
SelectSelector¶
This selector just holds one other selector and forwards all
requests to it. It exists so that there is a single selector
type that can exist outside of any targets, as an element of
project. It overrides all of the reference stuff so that it
works as expected. Note that this is the only selector you
can reference.
This class handles the common description attribute and provides
a default implementation for reference handling and checking for
circular references that is appropriate for types that can not be
nested inside elements of the same type (i.e. patternset but not path)
« More »
SizeSelector¶
Selector that filters files based on their size.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »
TypeSelector¶
Selector that selects a certain kind of file: directory or regular file.
It provides support for gathering the parameters together as well as for
assigning an error message and throwing a build exception if an error is
detected.
« More »