SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 482 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

JArchive allows us to
easily unpack archive files using the archive adapters. An adapter handles a specific
type of archive. This list details the core archive adapters:
BZIP2
GZIP
TAR
ZIP
Before we start using this library we must always import it:
jimport('joomla.filesystem.archive');
We will start by exploring the use of JArchive to unpack archives. To do this we need
to use the extract() method. We pass two parameters to this method: the path to
the archive file and the path to directory to which we want to extract the contents.
This example extracts an archive to the 'temp' directory in the current component:
if (!JArchive::extract($pathToArchive, $destination))
{
// handle failed archive extraction
}
When we use the extract() method we are invoking an archive adapter that
is automatically selected based upon the file extension. This list describes the
supported archive format extensions:
.bz2
.bzip2
.gz
.gzip
??? ??? ??? ??? ??? ??? ??? ???
Chapter 12
[ 355 ]
.tar
.tbz2
.tgz
.


Pages:
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494