class UpdateArchive extends Archive (View source)

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, bool $inplace = true)

Installs a zip file from the passed directory.

Details

__construct()

No description

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, bool $inplace = true)

Installs a zip file from the passed directory.

Parameters

$file
bool $inplace

Set to false if $file should be moved to the temporary directory before working on it, set to true if it's already in the temp directory.

Return Value

string

Returns the base directory into which the zipfile was unzipped

See also

Archive::install