Support Joomla!

references:joomla.framework:filesystem:jarchive-create

Table of Contents

create

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage FileSystem Class JArchive Method create Reference create() Never Work in Progress

Creates an archive.

Syntax

void create ( $archive, $files, $compress, $addPath, $removePath, $autoExt, $cleanUp )

$archive string is a string containing the name of the archive to create.
$files mixed is a string containing the name of the file to add or an array of strings containing names of files to add.
$compress string Is the compression algorithm to be used for the archive. This can be either null or ‘tar’ (which will result in no compression), ‘gz’ (which will result in gzip compression) or ‘bz2’ (which will result in bz2 compression, best compression). This parameter is optional, and if omitted, defaults to ‘tar’, which will result in no compression being used. This string is the extension that will be added to the end of the archive name if $autoExt is true.
$addPath string is a string containing the path to add within the archive. This path will be added to the beginning of the path of each file or directory. This parameter is optional and if omitted will default to an empty string, resulting in nothing being added.
$removePath string is a string containing the path to remove within the archive. If this path exists in any of the files, it will be removed. This parameter is optional and if omitted will default to an empty string, resulting in nothing being removed.
$autoExt boolean is a flag which specifies whether or not the extension for the archive should be automatically appended. This parameter is optional and if omitted defaults to false.
$cleanUp boolean is a flag which specifies whether source files should be removed (that is, whether the files that are added to the archive should be deleted from the directory). This parameter is optional and if omitted defaults to false.

Examples

Example

$archive = JArchive::create ('test', array( 'globals.php', 'configuration.php', 'index.php', 'index2.php'), 'tar', 'joomla/', '', true, false );

might produce an archive called ‘test.tar’ in the current base path listing the files ‘joomla/globals.php’, ‘joomla/configuration.php’, ‘joomla/index.php’ and ‘joomla/index2.php’. The files would be added from the current base path.


Discussion

Dan3000, 2006/04/30 11:02:

Should there be a reference that bz2 is the best compression format? Or link the names to wikipedia pages that show the difference in formats? I think this might help developer pick a format.


Full name:
E-Mail:
 
references/joomla.framework/filesystem/jarchive-create.txt (1018 views) · Last modified: 2007/08/15 15:06