tasks/system/CopyTask.php
\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 {@link Project#createTask} to register a new Task.
- Parent(s)
- \Task < \ProjectComponent
- Children
- \XsltTask
- \MoveTask
- Author
- Andreas Aderhold, andi@binarycloud.com
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Version
- $Id: 86322e73609da671413e4c959082958c16a510cc $
Properties

\Project
$project= 'null'
Holds a reference to the project that a project component (a task, a target, etc.) belongs to
A reference to the current project instanceInherited from: \ProjectComponent::$$project\Task::$$projectnullDetails- Type
- \Project
- Inherited_from
- \ProjectComponent::$$project
- Inherited_from
- \Task::$$project
Methods

__construct(
)
:
objectSets up this object internal stuff. i.e. the Fileutils instance
| Type | Description |
|---|---|
| object | The CopyTask instnace |
- Access
- public

_scan(
$fromDir, $toDir, $files, $dirs
)
:
voidCompares source files to destination files to see if they should be copied.
| Name | Type | Description |
|---|---|---|
| $fromDir | ||
| $toDir | ||
| $files | ||
| $dirs |
- Access
- private

addFileSet(
$fs
)
:
voidNested creator, creates a FileSet for this task
| Name | Type | Description |
|---|---|---|
| $fs |

buildMap(
$fromDir, $toDir, $names, $mapper, $map
)
:
voidBuilds a map of filenames (from->to) that should be copied
| Name | Type | Description |
|---|---|---|
| $fromDir | ||
| $toDir | ||
| $names | ||
| $mapper | ||
| $map |
- Access
- private

createFileList(
)
:
objectNested creator, adds a set of files (nested fileset attribute).
| Type | Description |
|---|---|
| object | The created filelist object |
- Access
- public

createFilterChain(
)
:
objectCreates a filterchain
| Type | Description |
|---|---|
| object | The created filterchain object |
- Access
- public

createMapper(
)
:
objectNested creator, creates one Mapper for this task
| Type | Description |
|---|---|
| object | The created Mapper type object |
| Exception | Description |
|---|---|
| \BuildException |
- Access
- public

doWork(
)
:
voidActually copies the files
| Exception | Description |
|---|---|
| \BuildException |
- Access
- private

getLocation(
)
:
\LocationReturns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.
Inherited from: \Task::getLocation()| Type | Description |
|---|---|
| \Location | The location object describing the position of this task within the buildfile. |

getProject(
)
:
\ProjectReturns a reference to current project
Inherited from: \ProjectComponent::getProject()\Task::getProject()| Type | Description |
|---|---|
| \Project | Reference to current porject object |

getRuntimeConfigurableWrapper(
)
:
\RuntimeConfigurableReturns the wrapper object for runtime configuration
Inherited from: \Task::getRuntimeConfigurableWrapper()| Type | Description |
|---|---|
| \RuntimeConfigurable | The wrapper object used by this task |

getTaskType(
)
:
stringReturns the name of the task under which it was invoked, usually the XML tagname
Inherited from: \Task::getTaskType()| Type | Description |
|---|---|
| string | The type of this task (XML Tag) |

init(
)
:
void
Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
| Exception | Description |
|---|---|
| \BuildException |

log(
string $msg, integer $level
=
Project::MSG_INFO
)
:
void
| Name | Type | Description |
|---|---|---|
| $msg | string | The message to log |
| $level | integer | The priority of the message |
- See
- \BuildEvent
- See
- \BuildListener

main(
)
:
trueThe main entry point where everything gets in motion.
Should throw a BuildException if someting goes wrong with the build
This is abstract here. Must be overloaded by real tasks.
| Type | Description |
|---|---|
| true | on success |
| Exception | Description |
|---|---|
| \BuildException |
- Access
- public

maybeConfigure(
)
:
voidConfigure this task if it hasn't been done already.
Inherited from: \Task::maybeConfigure()
setDescription(
string $desc
)
:
void
| Name | Type | Description |
|---|---|---|
| $desc | string | The text describing the task |

setFile(
\string/object $file
)
:
voidSet the file. We have to manually take care of the type that is coming due to limited type support in php in and convert it manually if neccessary.
| Name | Type | Description |
|---|---|---|
| $file | \string/object | The source file. Either a string or an PhingFile object |
- Access
- public

setHaltonerror(
boolean $haltonerror
)
:
voidSet the haltonerror attribute - when true, will make the build fail when errors are detected.
| Name | Type | Description |
|---|---|---|
| $haltonerror | boolean | Flag if the build should be stopped on errors |
- Access
- public

setIncludeEmptyDirs(
boolean $bool
)
:
voidSet the include empty dirs flag. IntrospectionHelper takes care of booleans in set* methods so we can assume that the right value (boolean primitive) is coming in here.
| Name | Type | Description |
|---|---|---|
| $bool | boolean | Flag if empty dirs should be cpoied too |
- Access
- public

setLocation(
\Location $location
)
:
voidSets the location within the buildfile this task occurs. Called by the parser to set location information.
Inherited from: \Task::setLocation()| Name | Type | Description |
|---|---|---|
| $location | \Location | The location object describing the position of this task within the buildfile. |

setMode(
integer $mode
)
:
voidSets the mode to create destination directories with (ignored on Windows).
Default mode is 0755.
| Name | Type | Description |
|---|---|---|
| $mode | integer | Octal mode |
- Access
- public

setOverwrite(
boolean $bool
)
:
voidSet the overwrite flag. IntrospectionHelper takes care of booleans in set* methods so we can assume that the right value (boolean primitive) is coming in here.
| Name | Type | Description |
|---|---|---|
| $bool | boolean | Overwrite the destination file(s) if it/they already exist |
- Access
- public

setOwningTarget(
\Target $target
)
:
void
| Name | Type | Description |
|---|---|---|
| $target | \Target | Reference to owning target |

setPreserveLastModified(
boolean $bool
)
:
voidSet the preserve timestamp flag. IntrospectionHelper takes care of booleans in set* methods so we can assume that the right value (boolean primitive) is coming in here.
| Name | Type | Description |
|---|---|---|
| $bool | boolean | Preserve the timestamp on the destination file |
- Access
- public

setProject(
\Project $project
)
:
voidReferences the project to the current component.
Inherited from: \ProjectComponent::setProject()\Task::setProject()| Name | Type | Description |
|---|---|---|
| $project | \Project | The reference to the current project |

setRuntimeConfigurableWrapper(
\RuntimeConfigurable $wrapper
)
:
voidSets the wrapper object this task should use for runtime configurable elements.
Inherited from: \Task::setRuntimeConfigurableWrapper()| Name | Type | Description |
|---|---|---|
| $wrapper | \RuntimeConfigurable | The wrapper object this task should use |

setTaskName(
string $name
)
:
string
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| string | A string representing the name of this task for log |

setTaskType(
string $name
)
:
voidSets the type of the task. Usually this is the name of the XML tag
Inherited from: \Task::setTaskType()| Name | Type | Description |
|---|---|---|
| $name | string | The type of this task (XML Tag) |

setTodir(
\string/object $dir
)
:
voidSet the toDir. We have to manually take care of the type that is coming due to limited type support in php in and convert it manually if neccessary.
| Name | Type | Description |
|---|---|---|
| $dir | \string/object | The directory, either a string or an PhingFile object |
- Access
- public

setTofile(
\string/object $file
)
:
voidSet the toFile. We have to manually take care of the type that is coming due to limited type support in php in and convert it manually if neccessary.
| Name | Type | Description |
|---|---|---|
| $file | \string/object | The dest file. Either a string or an PhingFile object |
- Access
- public

setVerbose(
boolean $verbosity
)
:
voidUsed to force listing of all names of copied files.
| Name | Type | Description |
|---|---|---|
| $verbosity | boolean |

validateAttributes(
)
:
voidValidates attributes coming in from XML
| Exception | Description |
|---|---|
| \BuildException |
- Access
- private