The FileSyncTask class copies files either to or from a remote host, or locally on the current host.
It allows rsync to transfer the differences between two sets of files across the network connection, using an efficient checksum-search algorithm.
There are 4 different ways of using FileSyncTask:
This is extended from Federico's original code, all his docs are kept in here below.
author | Federico Cargnelutti |
---|---|
author | Anton Stöckl |
version | $Revision$ |
package | phing.tasks.ext |
see | \global\http://svn.fedecarg.com/repo/Phing/tasks/ext/FileSyncTask.php |
example | http://fedecarg.com/wiki/FileSyncTask |
copyright | 2001,2002 THYRELL. All rights reserved |
executeCommand() : int
getCommand() : string
string
getDescription() : string
inherited_from | \Task::getDescription() |
---|
string
The text description of the taskgetErrorMessage(int $code) : null | string
int
Error code
null
string
getLocation() : \Location
Used by BuildException to give detailed error messages.
inherited_from | \Task::getLocation() |
---|
\Location
The location object describing the position of this
task within the buildfile.getProject() : \Project
inherited_from | \ProjectComponent::getProject() |
---|---|
inherited_from | \Task::getProject() |
\Project
Reference to current porject objectgetRuntimeConfigurableWrapper() : \RuntimeConfigurable
inherited_from | \Task::getRuntimeConfigurableWrapper() |
---|
\RuntimeConfigurable
The wrapper object used by this taskgetTaskName() : string
inherited_from | \Task::getTaskName() |
---|
string
Name of this taskgetTaskType() : string
inherited_from | \Task::getTaskType() |
---|
string
The type of this task (XML Tag)init()
Should throw a BuildException if something goes wrong with the build
This is abstract here, but may not be overloaded by subclasses.
inherited_from | \Task::init() |
---|
\BuildException |
---|
log(string $msg, integer $level)
see | \global\BuildEvent |
---|---|
see | \global\BuildListener |
inherited_from | \Task::log() |
string
The message to log
integer
The priority of the message
main() : void
Wraps the executeCommand() method.
maybeConfigure()
inherited_from | \Task::maybeConfigure() |
---|
perform()
inherited_from | \Task::perform() |
---|
setBackupDir(string $dir) : void
string
dir
setChecksum(boolean $checksum) : void
Without this option, rsync uses a "quick check" that (by default) checks if each file’s size and time of last modification match between the sender and receiver. This option changes this to compare a 128-bit checksum for each file that has a matching size.
boolean
setDelete(boolean $delete) : void
Files that are excluded from transfer are also excluded from being deleted.
boolean
setDescription(string $desc)
inherited_from | \Task::setDescription() |
---|
string
The text describing the task
setDestinationDir(string $dir) : void
If the option remotehost is not included in the build.xml file, rsync will point to a local directory instead.
string
setDryRun(boolean $dryRun) : void
It is most commonly used in combination with the -v, --verbose and/or -i, --itemize-changes options to see what an rsync command is going to do before one actually runs it.
boolean
setExcludeFile(string $file) : void
string
setIdentityFile(string $identity) : void
string
location of ssh identity file
setItemizeChanges($itemizeChanges) : void
setLocation(\Location $location)
Called by the parser to set location information.
inherited_from | \Task::setLocation() |
---|
setOptions(string $options) : void
string
setOwningTarget(\Target $target)
setProject(\Project $project)
inherited_from | \ProjectComponent::setProject() |
---|---|
inherited_from | \Task::setProject() |
setRemoteHost(string $host) : void
string
setRemotePass(string $pass) : void
Note that this option is only useful when accessing an rsync daemon using the built in transport, not when using a remote shell as the transport.
string
setRemoteShell(string $shell) : void
Typically, rsync is configured to use ssh by default, but you may prefer to use rsh on a local network.
string
setRemoteUser(string $user) : void
This also may be specified in the properties file.
string
setRsyncPath(string $path) : void
string
setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)
inherited_from | \Task::setRuntimeConfigurableWrapper() |
---|
setSourceDir(string $dir) : void
string
setTaskName(string $name) : string
inherited_from | \Task::setTaskName() |
---|
string
string
A string representing the name of this task for logsetTaskType(string $name)
Usually this is the name of the XML tag
inherited_from | \Task::setTaskType() |
---|
string
The type of this task (XML Tag)
setVerbose(boolean $verbose) : void
By default, rsync works silently. A single -v will give you information about what files are being transferred and a brief summary at the end.
boolean
getRegisterSlot(string $slotName)
inherited_from | \Task::getRegisterSlot() |
---|
string
setIsRemoteConnection(boolean $isRemote) : void
boolean
$backupDir : string
The remote directory is copied to a new directory specified by the user.
$checksum : boolean
$defaultOptions : string
r - recursive p - preserve permissions K - treat symlinked dir on receiver as dir z - compress l - copy symlinks as symlinks
$delete : boolean
$description : string
inherited_from | \Task::$$description |
---|
$destinationDir : string
For remote targets this must contain user and host, e.g.: user@host:/my/target/dir
$dryRun : boolean
$excludeFile : string
$identityFile : string
$isRemoteConnection : boolean
$itemizeChanges : boolean
$project : \Project
inherited_from | \ProjectComponent::$$project |
---|---|
inherited_from | \Task::$$project |
$remoteHost : string
$remotePass : string
$remoteShell : string
$remoteUser : string
$rsyncPath : string
$sourceDir : string
For remote sources this must contain user and host, e.g.: user@host:/my/source/dir
$taskName : string
inherited_from | \Task::$$taskName |
---|
$taskType : string
inherited_from | \Task::$$taskType |
---|
$verbose : boolean
The verbose option set to true will give you information about what files are being transferred and a brief summary at the end.