classes/phing/tasks/system/CopyTask.php

\CopyTask

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.

Use {@link Project#createTask} to register a new Task.

Extends from
\Task
author
Andreas Aderhold, andi@binarycloud.com
copyright
2001,2002 THYRELL. All rights reserved
package
phing.tasks.system
version
$Revision: 985 $ $Date: 2010-11-11 16:58:35 +0100 (Thu, 11 Nov 2010) $

Properties

Propertyprotected  $completeDirMap= 'array'
Default valuearrayDetails
Type
Propertyprotected  $destDir= 'null'
Default valuenullDetails
Type
Propertyprotected  $destFile= 'null'
Default valuenullDetails
Type
Propertyprotected  $dirCopyMap= 'array'
Default valuearrayDetails
Type
Propertyprotected  $file= 'null'
Default valuenullDetails
Type
Propertyprotected  $fileCopyMap= 'array'
Default valuearrayDetails
Type
Propertyprotected  $fileUtils= 'null'
Default valuenullDetails
Type
Propertyprotected  $filelists= 'array'
Default valuearrayDetails
Type
Propertyprotected  $filesets= 'array'
Default valuearrayDetails
Type
Propertyprotected  $filterChains= 'array'
Default valuearrayDetails
Type
Propertyprotected  $flatten= 'false'
Default valuefalseDetails
Type
Propertyprotected  $haltonerror= 'true'
Default valuetrueDetails
Type
Propertyprotected  $includeEmpty= 'true'
Default valuetrueDetails
Type
Propertyprotected  $mapperElement= 'null'
Default valuenullDetails
Type
Propertyprotected  $mode= '0755'
Default value0755Details
Type
Propertyprotected  $overwrite= 'false'
Default valuefalseDetails
Type
Propertyprotected  $preserveLMT= 'false'
Default valuefalseDetails
Type
Propertyprotected  $verbosity= 'Project'
Default valueProjectDetails
Type

Methods

methodpublic  __construct( ) : object
Sets up this object internal stuff. i.e. the Fileutils instance
Returns
Type Description
object
Details
access
public
methodprivate  _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
methodprivate  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
methodpublic  createFileList( ) : object
Nested creator, adds a set of files (nested fileset attribute).
Returns
Type Description
object
Details
access
public
methodpublic  createFileSet( ) : object
Nested creator, creates a FileSet for this task
Returns
Type Description
object
Details
access
public
methodpublic  createFilterChain( ) : object
Creates a filterchain
Returns
Type Description
object
Details
access
public
methodpublic  createMapper( ) : object
Nested creator, creates one Mapper for this task
Returns
Type Description
object
Details
access
public
throws
methodprotected  doWork( ) : void
Actually copies the files
Details
access
private
throws
methodprotected  logError(  $message,  $location = NULL ) :
Parameters
Name Type Description
$message
$location
methodpublic  main( ) : true
The main entry point where everything gets in motion.
Returns
Type Description
true
Details
access
public
throws
methodpublic  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
methodpublic  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
methodpublic  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
methodpublic  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
methodpublic  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
methodpublic  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
methodpublic  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
methodpublic  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
methodpublic  setTstamp(  $bool ) :
Parameters
Name Type Description
$bool
Details
see
\CopyTask::setPreserveLastModified
methodpublic  setVerbose( boolean $verbosity ) :
Used to force listing of all names of copied files.
Parameters
Name Type Description
$verbosity boolean
methodprotected  validateAttributes( ) : void
Validates attributes coming in from XML
Details
access
private
throws
Documentation was generated by DocBlox 0.13.1.