tasks/system/MoveTask.php
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.
- Package
- phing.tasks.system
- Version
- $Id$
\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.
- Parent(s)
- \CopyTask < \Task < \ProjectComponent
- Author
- Andreas Aderhold, andi@binarycloud.com
- Copyright
- 2001,2002 THYRELL. All rights reserved
- Version
- $Id$
Properties

$completeDirMap= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \CopyTask::$$completeDirMap

string
$description= ''
- Type
- string
- Inherited_from
- \Task::$$description
- Inherited_from
- \CopyTask::$$description

$destDir= 'null'
nullDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$destDir

$destFile= 'null'
nullDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$destFile

$dirCopyMap= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \CopyTask::$$dirCopyMap

$file= 'null'
nullDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$file

$fileCopyMap= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \CopyTask::$$fileCopyMap

$fileUtils= 'null'
nullDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$fileUtils

$filelists= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \CopyTask::$$filelists

$filesets= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \CopyTask::$$filesets

$filterChains= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \CopyTask::$$filterChains

$flatten= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$flatten

$haltonerror= 'true'
trueDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$haltonerror

$includeEmpty= 'true'
trueDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$includeEmpty

\Location
$location= ''
- Type
- \Location
- Inherited_from
- \Task::$$location
- Inherited_from
- \CopyTask::$$location

$mapperElement= 'null'
nullDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$mapperElement

$mode= '0755'
0755Details- Type
- n/a
- Inherited_from
- \CopyTask::$$mode

$overwrite= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$overwrite

$preserveLMT= 'false'
falseDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$preserveLMT

\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::$$project\CopyTask::$$projectnullDetails- Type
- \Project
- Inherited_from
- \ProjectComponent::$$project
- Inherited_from
- \Task::$$project
- Inherited_from
- \CopyTask::$$project

\Target
$target= ''
- Type
- \Target
- Inherited_from
- \Task::$$target
- Inherited_from
- \CopyTask::$$target

string
$taskName= ''
- Type
- string
- Inherited_from
- \Task::$$taskName
- Inherited_from
- \CopyTask::$$taskName

string
$taskType= ''
- Type
- string
- Inherited_from
- \Task::$$taskType
- Inherited_from
- \CopyTask::$$taskType

$verbosity= 'Project::MSG_VERBOSE'
Project::MSG_VERBOSEDetails- Type
- n/a
- Inherited_from
- \CopyTask::$$verbosity

\RuntimeConfigurable
$wrapper= ''
- Type
- \RuntimeConfigurable
- Inherited_from
- \Task::$$wrapper
- Inherited_from
- \CopyTask::$$wrapper
Methods

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

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

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

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

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

createMapper(
)
:
object
| Type | Description |
|---|---|
| object | The created Mapper type object |
| Exception | Description |
|---|---|
| \BuildException |
- Access
- public

getDescription(
)
:
stringReturns the textual description of the task
Inherited from: \Task::getDescription()\CopyTask::getDescription()| Type | Description |
|---|---|
| string | The text description of the task |

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

getOwningTarget(
)
:
\TargetReturns the owning target of this task.
Inherited from: \Task::getOwningTarget()\CopyTask::getOwningTarget()| Type | Description |
|---|---|
| \Target | The target object that owns this task |

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

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

getTaskName(
)
:
stringReturns the name of task, used only for log messages
Inherited from: \Task::getTaskName()\CopyTask::getTaskName()| Type | Description |
|---|---|
| string | Name of this task |

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

init(
)
:
voidCalled by the parser to let the task initialize properly.
Inherited from: \Task::init()\CopyTask::init()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
)
:
voidProvides a project level log event to the task.
Inherited from: \Task::log()\CopyTask::log()| Name | Type | Description |
|---|---|---|
| $msg | string | The message to log |
| $level | integer | The priority of the message |
- See
- \BuildEvent
- See
- \BuildListener

logError(
$message, $location
=
NULL
)
:
void| Name | Type | Description |
|---|---|---|
| $message | ||
| $location |

main(
)
:
true
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()\CopyTask::maybeConfigure()
okToDelete(
$d
)
:
voidIts only ok to delete a dir tree if there are no files in it.
| Name | Type | Description |
|---|---|---|
| $d |

setDescription(
string $desc
)
:
voidSets a textual description of the task
Inherited from: \Task::setDescription()\CopyTask::setDescription()| 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.
Inherited from: \CopyTask::setFile()| 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.
Inherited from: \CopyTask::setHaltonerror()| 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.
Inherited from: \CopyTask::setIncludeEmptyDirs()| 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()\CopyTask::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).
Inherited from: \CopyTask::setMode()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.
Inherited from: \CopyTask::setOverwrite()| Name | Type | Description |
|---|---|---|
| $bool | boolean | Overwrite the destination file(s) if it/they already exist |
- Access
- public

setOwningTarget(
\Target $target
)
:
voidSets the owning target this task belongs to.
Inherited from: \Task::setOwningTarget()\CopyTask::setOwningTarget()| 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.
Inherited from: \CopyTask::setPreserveLastModified()| 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()\CopyTask::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()\CopyTask::setRuntimeConfigurableWrapper()| Name | Type | Description |
|---|---|---|
| $wrapper | \RuntimeConfigurable | The wrapper object this task should use |

setTaskName(
string $name
)
:
stringSets the name of this task for log messages
Inherited from: \Task::setTaskName()\CopyTask::setTaskName()| 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()\CopyTask::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.
Inherited from: \CopyTask::setTodir()| 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.
Inherited from: \CopyTask::setTofile()| Name | Type | Description |
|---|---|---|
| $file | \string/object | The dest file. Either a string or an PhingFile object |
- Access
- public

setTstamp(
$bool
)
:
void| Name | Type | Description |
|---|---|---|
| $bool |

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

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