# tasks/system/MoveTask.php

## \MoveTask
jump to top

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
Version
  $Revision: 985 $

### Properties

`$completeDirMap= 'array()'`
inherited Inherited from: \CopyTask::$$completeDirMap
Default value `array()`Details

Type
  n/a
Inherited_from
  \CopyTask::$$completeDirMap

`$destDir= 'null'`
inherited Inherited from: \CopyTask::$$destDir
Default value `null` Details

Type
  n/a
Inherited_from
  \CopyTask::$$destDir

`$destFile= 'null'`
inherited Inherited from: \CopyTask::$$destFile
Default value `null` Details

Type
  n/a
Inherited_from
  \CopyTask::$$destFile

`$dirCopyMap= 'array()'`
inherited Inherited from: \CopyTask::$$dirCopyMap
Default value `array()`Details

Type
  n/a
Inherited_from
  \CopyTask::$$dirCopyMap

`$file= 'null'`
inherited Inherited from: \CopyTask::$$file
Default value `null` Details

Type
  n/a
Inherited_from
  \CopyTask::$$file

`$fileCopyMap= 'array()'`
inherited Inherited from: \CopyTask::$$fileCopyMap
Default value `array()`Details

Type
  n/a
Inherited_from
  \CopyTask::$$fileCopyMap

`$fileUtils= 'null'`
inherited Inherited from: \CopyTask::$$fileUtils
Default value `null` Details

Type
  n/a
Inherited_from
  \CopyTask::$$fileUtils

`$filelists= 'array()'`
inherited Inherited from: \CopyTask::$$filelists
Default value `array()`Details

Type
  n/a
Inherited_from
  \CopyTask::$$filelists

`$filesets= 'array()'`
inherited Inherited from: \CopyTask::$$filesets
Default value `array()`Details

Type
  n/a
Inherited_from
  \CopyTask::$$filesets

`$filterChains= 'array()'`
inherited Inherited from: \CopyTask::$$filterChains
Default value `array()`Details

Type
  n/a
Inherited_from
  \CopyTask::$$filterChains

`$flatten= 'false'`
inherited Inherited from: \CopyTask::$$flatten
Default value `false` Details

Type
  n/a
Inherited_from
  \CopyTask::$$flatten

`$haltonerror= 'true'`
inherited Inherited from: \CopyTask::$$haltonerror
Default value `true` Details

Type
  n/a
Inherited_from
  \CopyTask::$$haltonerror

`$includeEmpty= 'true'`
inherited Inherited from: \CopyTask::$$includeEmpty
Default value `true` Details

Type
  n/a
Inherited_from
  \CopyTask::$$includeEmpty

`$mapperElement= 'null'`
inherited Inherited from: \CopyTask::$$mapperElement
Default value `null` Details

Type
  n/a
Inherited_from
  \CopyTask::$$mapperElement

`$mode= '0755'`
inherited Inherited from: \CopyTask::$$mode
Default value `0755` Details

Type
  n/a
Inherited_from
  \CopyTask::$$mode

`$overwrite= 'false'`
inherited Inherited from: \CopyTask::$$overwrite
Default value `false` Details

Type
  n/a
Inherited_from
  \CopyTask::$$overwrite

`$preserveLMT= 'false'`
inherited Inherited from: \CopyTask::$$preserveLMT
Default value `false` Details

Type
  n/a
Inherited_from
  \CopyTask::$$preserveLMT

`$verbosity= 'Project::MSG_VERBOSE'`
inherited Inherited from: \CopyTask::$$verbosity
Default value `Project::MSG_VERBOSE` Details

Type
  n/a
Inherited_from
  \CopyTask::$$verbosity

### Methods

`__construct( ) : object`

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

Returns

Type | Description
--- | ---
object | The CopyTask instnace

`_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

`buildMap( $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

`createFileList( ) : 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

`createFileSet( ) : object`
inherited

Nested creator, creates a FileSet for this task

Inherited from: \CopyTask::createFileSet()
Returns

Type | Description
--- | ---
object | The created fileset object

Details

Access
  public

`createFilterChain( ) : object`
inherited

Creates a filterchain

Inherited from: \CopyTask::createFilterChain()
Returns

Type | Description
--- | ---
object | The created filterchain object

Details

Access
  public

`createMapper( ) : 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

`deleteDir( $d ) : void`

Go and delete the directory tree.

Parameters

Name | Type | Description
--- | --- | ---
$d |  |

`doWork( ) : void`

Actually copies the files

Throws

Exception | Description
--- | ---
\BuildException |

`getDescription( ) : void`
inherited

Inherited from: Task::getDescription()\CopyTask::getDescription()
`getLocation( ) : void`
inherited

Inherited from: Task::getLocation()\CopyTask::getLocation()
`getOwningTarget( ) : void`
inherited

Inherited from: Task::getOwningTarget()\CopyTask::getOwningTarget()
`getProject( ) : void`
inherited

Inherited from: ProjectComponent::getProject()\CopyTask::getProject()
`getRegisterSlot( ) : void`
inherited

Inherited from: Task::getRegisterSlot()\CopyTask::getRegisterSlot()
`getRuntimeConfigurableWrapper( ) : void`
inherited

Inherited from: Task::getRuntimeConfigurableWrapper()\CopyTask::getRuntimeConfigurableWrapper()
`getTaskName( ) : void`
inherited

Inherited from: Task::getTaskName()\CopyTask::getTaskName()
`getTaskType( ) : void`
inherited

Inherited from: Task::getTaskType()\CopyTask::getTaskType()
`init( ) : void`
inherited

Inherited from: Task::init()\CopyTask::init()
`log( ) : void`
inherited

Inherited from: Task::log()\CopyTask::log()
`logError( $message, $location = NULL ) : void`
inherited

Inherited from: \CopyTask::logError()
Parameters

Name | Type | Description
--- | --- | ---
$message |  |
$location |  |

`main( ) : true`
inherited

The main entry point where everything gets in motion.

Inherited from: \CopyTask::main()
Returns

Type | Description
--- | ---
true | on success

Throws

Exception | Description
--- | ---
\BuildException |

Details

Access
  public

`maybeConfigure( ) : void`
inherited

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

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

Parameters

Name | Type | Description
--- | --- | ---
$d |  |

`perform( ) : void`
inherited

Inherited from: Task::perform()\CopyTask::perform()
`setDescription( ) : void`
inherited

Inherited from: Task::setDescription()\CopyTask::setDescription()
`setFile( \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

`setHaltonerror( 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

`setIncludeEmptyDirs( 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

`setLocation( ) : void`
inherited

Inherited from: Task::setLocation()\CopyTask::setLocation()
`setMode( 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

`setOverwrite( 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

`setOwningTarget( ) : void`
inherited

Inherited from: Task::setOwningTarget()\CopyTask::setOwningTarget()
`setPreserveLastModified( 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

`setProject( ) : void`
inherited

Inherited from: ProjectComponent::setProject()\CopyTask::setProject()
`setRuntimeConfigurableWrapper( ) : void`
inherited

Inherited from: Task::setRuntimeConfigurableWrapper()\CopyTask::setRuntimeConfigurableWrapper()
`setTaskName( ) : void`
inherited

Inherited from: Task::setTaskName()\CopyTask::setTaskName()
`setTaskType( ) : void`
inherited

Inherited from: Task::setTaskType()\CopyTask::setTaskType()
`setTodir( \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

`setTofile( \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

`setTstamp( $bool ) : void`
inherited

Inherited from: \CopyTask::setTstamp()
Parameters

Name | Type | Description
--- | --- | ---
$bool |  |

Details

See
  \CopyTask::setPreserveLastModified

`setVerbose( boolean $verbosity ) : void`
inherited

Used to force listing of all names of copied files.

Inherited from: \CopyTask::setVerbose()
Parameters

Name | Type | Description
--- | --- | ---
$verbosity | boolean |

`validateAttributes( ) : void`

Validates attributes coming in from XML

Throws

Exception | Description
--- | ---
\BuildException |

Details

Access
  private

Documentation was generated by DocBlox 0.17.1.