JArchive/create
From Joomla! Documentation
< API15:JArchive
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
<! removed transcluded page call, red link never existed >
Syntax[edit]
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[edit]
libraries/joomla/filesystem/archive.php
Importing[edit]
jimport( 'joomla.filesystem.archive' );
Source Body[edit]
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[edit]
Code Examples[edit]