# classes/phing/tasks/ext/TarTask.php

## \TarFileSet
jump to top

This is a FileSet with the option to specify permissions.

Permissions are currently not implemented by PEAR Archive_Tar, but hopefully they will be in the future.

Extends from
  \FileSet
author
  Hans Lellelid (Phing)
author
  Arnout J. Kuiper (Ant)
author
  Stefano Mazzocchi (Ant)
author
  Sam Ruby (Ant)
author
  Jon S. Stevens (Ant)
author
  Stefan Bodewig (Ant)
author
  Magesh Umasankar (Ant)
package
  phing.tasks.ext
version
  $Revision: 744 $ $Date: 2010-03-09 11:08:31 +0100 (Tue, 09 Mar 2010) $

### Properties

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

Type

`$fullpath= ''`
Details

Type

`$groupName= ''`
Details

Type

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

Type

`$prefix= ''`
Details

Type

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

Type

`$userName= ''`
Details

Type

### Methods

`getFiles( $p, $includeEmpty = true ) :`
Get a list of files and directories specified in the fileset.

@return array a list of file and directory names, relative to the baseDir for the project.

Parameters

Name | Type | Description
--- | --- | ---
$p |  |
$includeEmpty |  |

`getFullpath( ) :`
`getGroup( ) :`
`getMode( ) :`
`getPrefix( ) :`
`getPreserveLeadingSlashes( ) :`
`getUserName( ) :`
`setFullpath( $fullpath ) :`
If the fullpath attribute is set, the file in the fileset is written with that path in the archive. The prefix attribute, if specified, is ignored. It is an error to have more than one file specified in such a fileset.
Parameters

Name | Type | Description
--- | --- | ---
$fullpath |  |

`setGroup( $groupName ) :`
The groupname for the tar entry; optional, default="" This is not the same as the GID, which is not currently set by the task.
Parameters

Name | Type | Description
--- | --- | ---
$groupName |  |

`setMode( string $octalString ) :`
A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0644
Parameters

Name | Type | Description
--- | --- | ---
$octalString | string |

`setPrefix( $prefix ) :`
If the prefix attribute is set, all files in the fileset are prefixed with that path in the archive.

optional.

Parameters

Name | Type | Description
--- | --- | ---
$prefix |  |

`setPreserveLeadingSlashes( $b ) : void`
Flag to indicates whether leading `/'s should be preserved in the file names.

Optional, default is `false`.

Parameters

Name | Type | Description
--- | --- | ---
$b |  |

`setUserName( $userName ) :`
The username for the tar entry This is not the same as the UID, which is not currently set by the task.
Parameters

Name | Type | Description
--- | --- | ---
$userName |  |

## \TarTask
jump to top

Creates a tar archive using PEAR Archive_Tar.

This is very closely based on the ANT class of the same name.

Extends from
  \MatchingTask
author
  Hans Lellelid (Phing)
author
  Stefano Mazzocchi (Ant)
author
  Stefan Bodewig (Ant)
author
  Magesh Umasankar
copyright
  2001,2002 THYRELL. All rights reserved
package
  phing.tasks.ext
version
  $Id: TarTask.php 1084 2011-05-06 09:55:25Z mrook $

### Constants

`TAR_NAMELEN = '100'`

`WARN = 'warn'`

`FAIL = 'fail'`

`OMIT = 'omit'`

### Properties

`$baseDir= ''`
Details

Type

`$compression= 'null'`

Compression mode. Available options "gzip", "bzip2", "none" (null).

Default value `null` Details

Type

`$fileSetFiles= 'array'`
Default value `array` Details

Type

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

Type

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

Type

`$longFileMode= 'warn'`
Default value `warn` Details

Type

`$longWarningGiven= 'false'`

Indicates whether the user has been warned about long files already.

Default value `false` Details

Type

`string $prefix= 'null'`

File path prefix in the tar archive

Default value `null` Details

Type
  string

`$tarFile= ''`
Details

Type

### Methods

`archiveIsUpToDate( array $files, \PhingFile $dir ) : boolean`
Parameters

Name | Type | Description
--- | --- | ---
$files | array | array of filenames
$dir | \PhingFile |

Returns

Type | Description
--- | ---
boolean |

`createFileSet( ) : \FileSet`
Add a new fileset. Alias to createTarFileSet() for backwards compatibility.
Returns

Type | Description
--- | ---
\FileSet |

Details

see
  \createTarFileSet()

`createTarFileSet( ) : \FileSet`
Add a new fileset
Returns

Type | Description
--- | ---
\FileSet |

`init( ) :`
Ensures that PEAR lib exists.
`main( ) :`
do the work
Details

throws

`setBasedir( \PhingFile $baseDir ) :`
This is the base directory to look in for things to tar.
Parameters

Name | Type | Description
--- | --- | ---
$baseDir | \PhingFile |

`setCompression( $mode ) :`
Set compression method.

Allowable values are

- none - no compression
- gzip - Gzip compression
- bzip2 - Bzip2 compression

Parameters

Name | Type | Description
--- | --- | ---
$mode |  |

`setDestFile( \PhingFile $destFile ) :`
Set is the name/location of where to create the tar file.
Parameters

Name | Type | Description
--- | --- | ---
$destFile | \PhingFile | The output of the tar

`setIncludeEmptyDirs( boolean $bool ) : void`
Set the include empty dirs flag.
Parameters

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

Details

access
  public

`setLongfile( $mode ) :`
Set how to handle long files, those with a path>100 chars.

Optional, default=warn.

<

p> Allowable values are

- truncate - paths are truncated to the maximum length
- fail - paths greater than the maximim cause a build exception
- warn - paths greater than the maximum cause a warning and GNU is used
- gnu - GNU extensions are used for any paths greater than the maximum.
- omit - paths greater than the maximum are omitted from the archive

Parameters

Name | Type | Description
--- | --- | ---
$mode |  |

`setPrefix( string $prefix ) : void`
Sets the file path prefix for file in the tar file.
Parameters

Name | Type | Description
--- | --- | ---
$prefix | string | Prefix

Documentation was generated by DocBlox 0.13.1.