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'
null
Details- Type
- n/a
- Inherited_from
- \CopyTask::$$destDir


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


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


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


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


$fileUtils= 'null'
null
Details- 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'
false
Details- Type
- n/a
- Inherited_from
- \CopyTask::$$flatten


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


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


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


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


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


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


$preserveLMT= 'false'
false
Details- 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::$$projectnull
Details- 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_VERBOSE
Details- Type
- n/a
- Inherited_from
- \CopyTask::$$verbosity


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


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


_scan(
$fromDir, $toDir, $files, $dirs
)
:
void
Compares 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
)
:
void
Builds 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(
)
:
object
Nested 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(
)
:
string
Returns the textual description of the task
Inherited from: \Task::getDescription()\CopyTask::getDescription()Type | Description |
---|---|
string | The text description of the task |


getLocation(
)
:
\Location
Returns 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(
)
:
\Target
Returns the owning target of this task.
Inherited from: \Task::getOwningTarget()\CopyTask::getOwningTarget()Type | Description |
---|---|
\Target | The target object that owns this task |


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


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


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


getTaskType(
)
:
string
Returns 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(
)
:
void
Called 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
)
:
void
Provides 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(
)
:
void
Configure this task if it hasn't been done already.
Inherited from: \Task::maybeConfigure()\CopyTask::maybeConfigure()

okToDelete(
$d
)
:
void
Its only ok to delete a dir tree if there are no files in it.
Name | Type | Description |
---|---|---|
$d |


setDescription(
string $desc
)
:
void
Sets 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
)
:
void
Set 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
)
:
void
Set 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
)
:
void
Set 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
)
:
void
Sets 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
)
:
void
Sets 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
)
:
void
Set 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
)
:
void
Sets 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
)
:
void
Set 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
)
:
void
References 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
)
:
void
Sets 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
)
:
string
Sets 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
)
:
void
Sets 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
)
:
void
Set 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
)
:
void
Set 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
)
:
void
Used to force listing of all names of copied files.
Inherited from: \CopyTask::setVerbose()Name | Type | Description |
---|---|---|
$verbosity | boolean |


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