API15:JArchive/create
From Joomla! Documentation
<! removed transcluded page call, red link never existed >
Syntax
create($archive, $files, $compress= 'tar', $addPath= '', $removePath= '', $autoExt=false, $cleanUp=false)
| Parameter Name | Default Value | Description |
|---|---|---|
| $archive | The name of the archive | |
| $files | The name of a single file or an array of files | |
| $compress | 'tar' | The compression for the archive |
| $addPath | Path to add within the archive | |
| $removePath | Path to remove within the archive | |
| $autoExt | false | Automatically append the extension for the archive |
| $cleanUp | false | Remove for source files |
Defined in
libraries/joomla/filesystem/archive.php
Importing
jimport( 'joomla.filesystem.archive' );
Source Body
function create($archive, $files, $compress = 'tar', $addPath = '', $removePath = '', $autoExt = false, $cleanUp = false)
{
jimport( 'pear.archive_tar.Archive_Tar' );
if (is_string($files)) {
$files = array ($files);
}
if ($autoExt) {
$archive .= '.'.$compress;
}
$tar = new Archive_Tar( $archive, $compress );
$tar->setErrorHandling(PEAR_ERROR_PRINT);
$tar->createModify( $files, $addPath, $removePath );
if ($cleanUp) {
JFile::delete( $files );
}
return $tar;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples