tasks/system/MoveTask.php

Show: inherited
Table of Contents

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

Package: phing\tasks\system

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

Propertyprotected  $completeDirMap= 'array()'
inheritedInherited from: \CopyTask::$$completeDirMap
Default valuearray()Details
Type
n/a
Inherited_from
\CopyTask::$$completeDirMap  
Propertyprotectedstring  $description= ''
inherited

Description of the task

Inherited from: \Task::$$description\CopyTask::$$description
Details
Type
string
Inherited_from
\Task::$$description  
Inherited_from
\CopyTask::$$description  
Propertyprotected  $destDir= 'null'
inheritedInherited from: \CopyTask::$$destDir
Default valuenullDetails
Type
n/a
Inherited_from
\CopyTask::$$destDir  
Propertyprotected  $destFile= 'null'
inheritedInherited from: \CopyTask::$$destFile
Default valuenullDetails
Type
n/a
Inherited_from
\CopyTask::$$destFile  
Propertyprotected  $dirCopyMap= 'array()'
inheritedInherited from: \CopyTask::$$dirCopyMap
Default valuearray()Details
Type
n/a
Inherited_from
\CopyTask::$$dirCopyMap  
Propertyprotected  $file= 'null'
inheritedInherited from: \CopyTask::$$file
Default valuenullDetails
Type
n/a
Inherited_from
\CopyTask::$$file  
Propertyprotected  $fileCopyMap= 'array()'
inheritedInherited from: \CopyTask::$$fileCopyMap
Default valuearray()Details
Type
n/a
Inherited_from
\CopyTask::$$fileCopyMap  
Propertyprotected  $fileUtils= 'null'
inheritedInherited from: \CopyTask::$$fileUtils
Default valuenullDetails
Type
n/a
Inherited_from
\CopyTask::$$fileUtils  
Propertyprotected  $filelists= 'array()'
inheritedInherited from: \CopyTask::$$filelists
Default valuearray()Details
Type
n/a
Inherited_from
\CopyTask::$$filelists  
Propertyprotected  $filesets= 'array()'
inheritedInherited from: \CopyTask::$$filesets
Default valuearray()Details
Type
n/a
Inherited_from
\CopyTask::$$filesets  
Propertyprotected  $filterChains= 'array()'
inheritedInherited from: \CopyTask::$$filterChains
Default valuearray()Details
Type
n/a
Inherited_from
\CopyTask::$$filterChains  
Propertyprotected  $flatten= 'false'
inheritedInherited from: \CopyTask::$$flatten
Default valuefalseDetails
Type
n/a
Inherited_from
\CopyTask::$$flatten  
Propertyprotected  $haltonerror= 'true'
inheritedInherited from: \CopyTask::$$haltonerror
Default valuetrueDetails
Type
n/a
Inherited_from
\CopyTask::$$haltonerror  
Propertyprotected  $includeEmpty= 'true'
inheritedInherited from: \CopyTask::$$includeEmpty
Default valuetrueDetails
Type
n/a
Inherited_from
\CopyTask::$$includeEmpty  
Propertyprotected\Location  $location= ''
inherited

Stored buildfile location

Inherited from: \Task::$$location\CopyTask::$$location
Details
Type
\Location
Inherited_from
\Task::$$location  
Inherited_from
\CopyTask::$$location  
Propertyprotected  $mapperElement= 'null'
inheritedInherited from: \CopyTask::$$mapperElement
Default valuenullDetails
Type
n/a
Inherited_from
\CopyTask::$$mapperElement  
Propertyprotected  $mode= '0755'
inheritedInherited from: \CopyTask::$$mode
Default value0755Details
Type
n/a
Inherited_from
\CopyTask::$$mode  
Propertyprotected  $overwrite= 'false'
inheritedInherited from: \CopyTask::$$overwrite
Default valuefalseDetails
Type
n/a
Inherited_from
\CopyTask::$$overwrite  
Propertyprotected  $preserveLMT= 'false'
inheritedInherited from: \CopyTask::$$preserveLMT
Default valuefalseDetails
Type
n/a
Inherited_from
\CopyTask::$$preserveLMT  
Propertyprotected\Project  $project= 'null'
inherited

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::$$project
Default valuenullDetails
Type
\Project
Inherited_from
\ProjectComponent::$$project  
Inherited_from
\Task::$$project  
Inherited_from
\CopyTask::$$project  
Propertyprotected\Target  $target= ''
inherited

Owning Target object

Inherited from: \Task::$$target\CopyTask::$$target
Details
Type
\Target
Inherited_from
\Task::$$target  
Inherited_from
\CopyTask::$$target  
Propertyprotectedstring  $taskName= ''
inherited

Taskname for logger

Inherited from: \Task::$$taskName\CopyTask::$$taskName
Details
Type
string
Inherited_from
\Task::$$taskName  
Inherited_from
\CopyTask::$$taskName  
Propertyprotectedstring  $taskType= ''
inherited

Internal taskname (req)

Inherited from: \Task::$$taskType\CopyTask::$$taskType
Details
Type
string
Inherited_from
\Task::$$taskType  
Inherited_from
\CopyTask::$$taskType  
Propertyprotected  $verbosity= 'Project::MSG_VERBOSE'
inheritedInherited from: \CopyTask::$$verbosity
Default valueProject::MSG_VERBOSEDetails
Type
n/a
Inherited_from
\CopyTask::$$verbosity  
Propertyprotected\RuntimeConfigurable  $wrapper= ''
inherited

Wrapper of the task

Inherited from: \Task::$$wrapper\CopyTask::$$wrapper
Details
Type
\RuntimeConfigurable
Inherited_from
\Task::$$wrapper  
Inherited_from
\CopyTask::$$wrapper  

Methods

methodpublic__construct( ) : object

Sets up this object internal stuff. i.e. the Fileutils instance

Returns
Type Description
object The CopyTask instnace
methodprivate_scan(  $fromDir,  $toDir,  $files,  $dirs ) : void
inherited

Compares source files to destination files to see if they should be copied.

Inherited from: \CopyTask::_scan()
Parameters
Name Type Description
$fromDir
$toDir
$files
$dirs
Details
Access
private  
methodpublicaddFileSet(  $fs ) : void
inherited

Nested creator, creates a FileSet for this task

Inherited from: \CopyTask::addFileSet()
Parameters
Name Type Description
$fs
methodprivatebuildMap(  $fromDir,  $toDir,  $names,  $mapper,  $map ) : void
inherited

Builds a map of filenames (from->to) that should be copied

Inherited from: \CopyTask::buildMap()
Parameters
Name Type Description
$fromDir
$toDir
$names
$mapper
$map
Details
Access
private  
methodpubliccreateFileList( ) : object
inherited

Nested creator, adds a set of files (nested fileset attribute).

Inherited from: \CopyTask::createFileList()
Returns
Type Description
object The created filelist object
Details
Access
public  
methodpubliccreateFilterChain( ) : object
inherited

Creates a filterchain

Inherited from: \CopyTask::createFilterChain()
Returns
Type Description
object The created filterchain object
Details
Access
public  
methodpubliccreateMapper( ) : object
inherited

Nested creator, creates one Mapper for this task

Inherited from: \CopyTask::createMapper()
Returns
Type Description
object The created Mapper type object
Throws
Exception Description
\BuildException
Details
Access
public  
methodprivatedeleteDir(  $d ) : void

Go and delete the directory tree.

Parameters
Name Type Description
$d
methodprotecteddoWork( ) : void

Actually copies the files

Throws
Exception Description
\BuildException
methodpublicgetDescription( ) : string
inherited

Returns the textual description of the task

Inherited from: \Task::getDescription()\CopyTask::getDescription()
Returns
Type Description
string The text description of the task
methodpublicgetLocation( ) : \Location
inherited

Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.

Inherited from: \Task::getLocation()\CopyTask::getLocation()
Returns
Type Description
\Location The location object describing the position of this task within the buildfile.
methodpublicgetOwningTarget( ) : \Target
inherited

Returns the owning target of this task.

Inherited from: \Task::getOwningTarget()\CopyTask::getOwningTarget()
Returns
Type Description
\Target The target object that owns this task
methodpublicgetProject( ) : \Project
inherited

Returns a reference to current project

Inherited from: \ProjectComponent::getProject()\Task::getProject()\CopyTask::getProject()
Returns
Type Description
\Project Reference to current porject object
methodprotectedgetRegisterSlot( string $slotName ) : void
inherited

Returns a name

Inherited from: \Task::getRegisterSlot()\CopyTask::getRegisterSlot()
Parameters
Name Type Description
$slotName string
methodpublicgetRuntimeConfigurableWrapper( ) : \RuntimeConfigurable
inherited

Returns the wrapper object for runtime configuration

Inherited from: \Task::getRuntimeConfigurableWrapper()\CopyTask::getRuntimeConfigurableWrapper()
Returns
Type Description
\RuntimeConfigurable The wrapper object used by this task
methodpublicgetTaskName( ) : string
inherited

Returns the name of task, used only for log messages

Inherited from: \Task::getTaskName()\CopyTask::getTaskName()
Returns
Type Description
string Name of this task
methodpublicgetTaskType( ) : string
inherited

Returns the name of the task under which it was invoked, usually the XML tagname

Inherited from: \Task::getTaskType()\CopyTask::getTaskType()
Returns
Type Description
string The type of this task (XML Tag)
methodpublicinit( ) : void
inherited

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.

Throws
Exception Description
\BuildException
methodpubliclog( string $msg, integer $level = Project::MSG_INFO ) : void
inherited

Provides a project level log event to the task.

Inherited from: \Task::log()\CopyTask::log()
Parameters
Name Type Description
$msg string

The message to log

$level integer

The priority of the message

Details
See
\BuildEvent  
See
\BuildListener  
methodprotectedlogError(  $message,  $location = NULL ) : void
inherited

Inherited from: \CopyTask::logError()
Parameters
Name Type Description
$message
$location
methodpublicmain( ) : true
inherited

The main entry point where everything gets in motion.

Inherited from: \CopyTask::main()

Should throw a BuildException if someting goes wrong with the build

This is abstract here. Must be overloaded by real tasks.

Returns
Type Description
true on success
Throws
Exception Description
\BuildException
Details
Access
public  
methodpublicmaybeConfigure( ) : void
inherited

Configure this task if it hasn't been done already.

Inherited from: \Task::maybeConfigure()\CopyTask::maybeConfigure()
methodprivateokToDelete(  $d ) : void

Its only ok to delete a dir tree if there are no files in it.

Parameters
Name Type Description
$d
methodpublicperform( ) : void
inherited

Perfrom this task

Inherited from: \Task::perform()\CopyTask::perform()
methodpublicsetDescription( string $desc ) : void
inherited

Sets a textual description of the task

Inherited from: \Task::setDescription()\CopyTask::setDescription()
Parameters
Name Type Description
$desc string

The text describing the task

methodpublicsetFile( \string/object $file ) : void
inherited

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()
Parameters
Name Type Description
$file \string/object

The source file. Either a string or an PhingFile object

Details
Access
public  
methodpublicsetHaltonerror( boolean $haltonerror ) : void
inherited

Set the haltonerror attribute - when true, will make the build fail when errors are detected.

Inherited from: \CopyTask::setHaltonerror()
Parameters
Name Type Description
$haltonerror boolean

Flag if the build should be stopped on errors

Details
Access
public  
methodpublicsetIncludeEmptyDirs( boolean $bool ) : void
inherited

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()
Parameters
Name Type Description
$bool boolean

Flag if empty dirs should be cpoied too

Details
Access
public  
methodpublicsetLocation( \Location $location ) : void
inherited

Sets the location within the buildfile this task occurs. Called by the parser to set location information.

Inherited from: \Task::setLocation()\CopyTask::setLocation()
Parameters
Name Type Description
$location \Location

The location object describing the position of this task within the buildfile.

methodpublicsetMode( integer $mode ) : void
inherited

Sets the mode to create destination directories with (ignored on Windows).

Inherited from: \CopyTask::setMode()

Default mode is 0755.

Parameters
Name Type Description
$mode integer

Octal mode

Details
Access
public  
methodpublicsetOverwrite( boolean $bool ) : void
inherited

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()
Parameters
Name Type Description
$bool boolean

Overwrite the destination file(s) if it/they already exist

Details
Access
public  
methodpublicsetOwningTarget( \Target $target ) : void
inherited

Sets the owning target this task belongs to.

Inherited from: \Task::setOwningTarget()\CopyTask::setOwningTarget()
Parameters
Name Type Description
$target \Target

Reference to owning target

methodpublicsetPreserveLastModified( boolean $bool ) : void
inherited

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()
Parameters
Name Type Description
$bool boolean

Preserve the timestamp on the destination file

Details
Access
public  
methodpublicsetProject( \Project $project ) : void
inherited

References the project to the current component.

Inherited from: \ProjectComponent::setProject()\Task::setProject()\CopyTask::setProject()
Parameters
Name Type Description
$project \Project

The reference to the current project

methodpublicsetRuntimeConfigurableWrapper( \RuntimeConfigurable $wrapper ) : void
inherited

Sets the wrapper object this task should use for runtime configurable elements.

Inherited from: \Task::setRuntimeConfigurableWrapper()\CopyTask::setRuntimeConfigurableWrapper()
Parameters
Name Type Description
$wrapper \RuntimeConfigurable

The wrapper object this task should use

methodpublicsetTaskName( string $name ) : string
inherited

Sets the name of this task for log messages

Inherited from: \Task::setTaskName()\CopyTask::setTaskName()
Parameters
Name Type Description
$name string
Returns
Type Description
string A string representing the name of this task for log
methodpublicsetTaskType( string $name ) : void
inherited

Sets the type of the task. Usually this is the name of the XML tag

Inherited from: \Task::setTaskType()\CopyTask::setTaskType()
Parameters
Name Type Description
$name string

The type of this task (XML Tag)

methodpublicsetTodir( \string/object $dir ) : void
inherited

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()
Parameters
Name Type Description
$dir \string/object

The directory, either a string or an PhingFile object

Details
Access
public  
methodpublicsetTofile( \string/object $file ) : void
inherited

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()
Parameters
Name Type Description
$file \string/object

The dest file. Either a string or an PhingFile object

Details
Access
public  
methodpublicsetTstamp(  $bool ) : void
inherited

Inherited from: \CopyTask::setTstamp()
Parameters
Name Type Description
$bool
Details
See
\CopyTask::setPreserveLastModified  
methodpublicsetVerbose( boolean $verbosity ) : void
inherited

Used to force listing of all names of copied files.

Inherited from: \CopyTask::setVerbose()
Parameters
Name Type Description
$verbosity boolean
methodprotectedvalidateAttributes( ) : void

Validates attributes coming in from XML

Throws
Exception Description
\BuildException
Details
Access
private  
Documentation was generated by DocBlox 0.18.1.