# tasks/system/CopyTask.php

## \CopyTask
jump to top

Package: phing\tasks\system

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.

Parent(s)
  \Task < \ProjectComponent
Children
  \XsltTask
  \MoveTask
Author
  Andreas Aderhold, andi@binarycloud.com
Version
  $Revision: 985 $ $Date: 2010-11-11 16:58:35 +0100 (Thu, 11 Nov 2010) $

### Properties

`$completeDirMap= 'array()'`
Default value `array()`Details

Type
  n/a

`$destDir= 'null'`
Default value `null` Details

Type
  n/a

`$destFile= 'null'`
Default value `null` Details

Type
  n/a

`$dirCopyMap= 'array()'`
Default value `array()`Details

Type
  n/a

`$file= 'null'`
Default value `null` Details

Type
  n/a

`$fileCopyMap= 'array()'`
Default value `array()`Details

Type
  n/a

`$fileUtils= 'null'`
Default value `null` Details

Type
  n/a

`$filelists= 'array()'`
Default value `array()`Details

Type
  n/a

`$filesets= 'array()'`
Default value `array()`Details

Type
  n/a

`$filterChains= 'array()'`
Default value `array()`Details

Type
  n/a

`$flatten= 'false'`
Default value `false` Details

Type
  n/a

`$haltonerror= 'true'`
Default value `true` Details

Type
  n/a

`$includeEmpty= 'true'`
Default value `true` Details

Type
  n/a

`$mapperElement= 'null'`
Default value `null` Details

Type
  n/a

`$mode= '0755'`
Default value `0755` Details

Type
  n/a

`$overwrite= 'false'`
Default value `false` Details

Type
  n/a

`$preserveLMT= 'false'`
Default value `false` Details

Type
  n/a

`$verbosity= 'Project::MSG_VERBOSE'`
Default value `Project::MSG_VERBOSE` Details

Type
  n/a

### Methods

`__construct( ) : object`

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

Returns

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

Details

Access
  public

`_scan( $fromDir, $toDir, $files, $dirs ) : void`

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

Parameters

Name | Type | Description
--- | --- | ---
$fromDir |  |
$toDir |  |
$files |  |
$dirs |  |

Details

Access
  private

`buildMap( $fromDir, $toDir, $names, $mapper, $map ) : void`

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

Parameters

Name | Type | Description
--- | --- | ---
$fromDir |  |
$toDir |  |
$names |  |
$mapper |  |
$map |  |

Details

Access
  private

`createFileList( ) : object`

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

Returns

Type | Description
--- | ---
object | The created filelist object

Details

Access
  public

`createFileSet( ) : object`

Nested creator, creates a FileSet for this task

Returns

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

Details

Access
  public

`createFilterChain( ) : object`

Creates a filterchain

Returns

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

Details

Access
  public

`createMapper( ) : object`

Nested creator, creates one Mapper for this task

Returns

Type | Description
--- | ---
object | The created Mapper type object

Throws

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

Details

Access
  public

`doWork( ) : void`

Actually copies the files

Throws

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

Details

Access
  private

`getDescription( ) : void`

`getLocation( ) : void`

`getOwningTarget( ) : void`

`getProject( ) : void`

`getRegisterSlot( ) : void`

`getRuntimeConfigurableWrapper( ) : void`

`getTaskName( ) : void`

`getTaskType( ) : void`

`init( ) : void`

`log( ) : void`

`logError( $message, $location = NULL ) : void`

Parameters

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

`main( ) : true`

The main entry point where everything gets in motion.

Returns

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

Throws

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

Details

Access
  public

`maybeConfigure( ) : void`

`perform( ) : void`

`setDescription( ) : void`

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

Parameters

Name | Type | Description
--- | --- | ---
$file | \string/object | The source file. Either a string or an PhingFile object

Details

Access
  public

`setHaltonerror( boolean $haltonerror ) : void`

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

Parameters

Name | Type | Description
--- | --- | ---
$haltonerror | boolean | Flag if the build should be stopped on errors

Details

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.

Parameters

Name | Type | Description
--- | --- | ---
$bool | boolean | Flag if empty dirs should be cpoied too

Details

Access
  public

`setLocation( ) : void`

`setMode( integer $mode ) : void`

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

Default mode is 0755.

Parameters

Name | Type | Description
--- | --- | ---
$mode | integer | Octal mode

Details

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.

Parameters

Name | Type | Description
--- | --- | ---
$bool | boolean | Overwrite the destination file(s) if it/they already exist

Details

Access
  public

`setOwningTarget( ) : void`

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

Parameters

Name | Type | Description
--- | --- | ---
$bool | boolean | Preserve the timestamp on the destination file

Details

Access
  public

`setProject( ) : void`

`setRuntimeConfigurableWrapper( ) : void`

`setTaskName( ) : void`

`setTaskType( ) : void`

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

Parameters

Name | Type | Description
--- | --- | ---
$dir | \string/object | The directory, either a string or an PhingFile object

Details

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.

Parameters

Name | Type | Description
--- | --- | ---
$file | \string/object | The dest file. Either a string or an PhingFile object

Details

Access
  public

`setTstamp( $bool ) : void`

Parameters

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

Details

See
  \CopyTask::setPreserveLastModified

`setVerbose( boolean $verbosity ) : void`

Used to force listing of all names of copied files.

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.