class PackageArchive extends Archive (View source)

This class is responsible for unpacking themes that have been zipped and uploaded to the system.

\@package Pages

Properties

protected string $targetDirectory The directory where this archive will be unzipped. from Archive
protected File $f File helper instance. from Archive

Methods

__construct()

No description

string
uploadZipToTemp(string $file)

Moves an uploaded file to the tmp directory.

from Archive
string
unzip(string $directory)

Unzips a file at a directory level by concatenating ".zip" onto the end of it.

from Archive
string
getArchiveDirectory(string $dir)

Returns either the directory (if the archive itself contains files at the first level) or the subdirectory if, like many archiving programs, we the zip archive is a directory, THEN a list of files.

from Archive
string
install($file, $inplace = false)

Installs a zip file from the passed directory.

uninstall()

No description

Details

__construct()

protected string uploadZipToTemp(string $file)

Moves an uploaded file to the tmp directory.

Parameters

string $file The full path of the file to copy

Return Value

string Return the base name of the file copied to the temporary directory.

protected string unzip(string $directory)

Unzips a file at a directory level by concatenating ".zip" onto the end of it.

unzip("/path/to/files/themes/mytheme") // will unzip "mytheme.zip" .

Parameters

string $directory The base name of the file (without extension, assumed to be in the the temporary directory).

Return Value

string Return the full path of the extracted directory.

protected string getArchiveDirectory(string $dir)

Returns either the directory (if the archive itself contains files at the first level) or the subdirectory if, like many archiving programs, we the zip archive is a directory, THEN a list of files.

Parameters

string $dir The full path of the directory to be analyzed.

Return Value

string Returns the final directory containing the files to be used.

string install($file, $inplace = false)

Installs a zip file from the passed directory.

Parameters

$file
$inplace

Return Value

string Returns the base directory into which the zipfile was unzipped

uninstall()