Actions

API15

JArchive/create

From Joomla! Documentation

< API15:JArchive
Revision as of 17:20, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[Edit Descripton]

Description:JArchive/create

Contents

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;
}

[Edit See Also] SeeAlso:JArchive/create

Examples

<CodeExamplesForm />