API15

JArchive/create

From Joomla! Documentation

< API15:JArchive
Revision as of 17:20, 22 March 2010 by Doxiki (talk | contribs) (New page: <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{Description:JArchive/create}} ===...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.

[Edit Descripton]

Template:Description:JArchive/create

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

[Edit See Also] Template:SeeAlso:JArchive/create

Examples[edit]

<CodeExamplesForm />