class InstallerHelper

Installer helper class

Constants

HASH_NOT_VALIDATED

Hash not validated identifier.

HASH_VALIDATED

Hash validated identifier.

HASH_NOT_PROVIDED

Hash not provided identifier.

Methods

static  string|boolean
downloadPackage( string $url, mixed $target = false)

Downloads a package

static  array|boolean
unpack( string $p_filename, boolean $alwaysReturnArray = false)

Unpacks a file and verifies it as a Joomla element package Supports .gz .tar .tar.gz and .zip

static  mixed
detectType( string $p_dir)

Method to detect the extension type from a package directory

static  string
getFilenameFromUrl( string $url)

Gets a file name out of a url

static  boolean
cleanupInstall( string $package, string $resultdir)

Clean up temporary uploaded package and unpacked extension

static  array
splitSql( string $query)

Splits contents of a sql file into array of discreet queries.

static  integer
isChecksumValid( string $packagefile, JUpdate $updateObject)

Return the result of the checksum of a package with the SHA256/SHA384/SHA512 tags in the update server manifest

Details

static string|boolean downloadPackage( string $url, mixed $target = false)

Downloads a package

Parameters

string $url URL of file to download
mixed $target Download target filename or false to get the filename from the URL

Return Value

string|boolean Path to downloaded package or boolean false on failure

static array|boolean unpack( string $p_filename, boolean $alwaysReturnArray = false)

Unpacks a file and verifies it as a Joomla element package Supports .gz .tar .tar.gz and .zip

Parameters

string $p_filename The uploaded package filename or install directory
boolean $alwaysReturnArray If should return false (and leave garbage behind) or return $retval['type']=false

Return Value

array|boolean Array on success or boolean false on failure

static mixed detectType( string $p_dir)

Method to detect the extension type from a package directory

Parameters

string $p_dir Path to package directory

Return Value

mixed Extension type string or boolean false on fail

static string getFilenameFromUrl( string $url)

Gets a file name out of a url

Parameters

string $url URL to get name from

Return Value

string Clean version of the filename or a unique id

static boolean cleanupInstall( string $package, string $resultdir)

Clean up temporary uploaded package and unpacked extension

Parameters

string $package Path to the uploaded package file
string $resultdir Path to the unpacked extension

Return Value

boolean True on success

static array splitSql( string $query)

Splits contents of a sql file into array of discreet queries.

Queries need to be delimited with end of statement marker ';'

Parameters

string $query The SQL statement.

Return Value

array Array of queries

static integer isChecksumValid( string $packagefile, JUpdate $updateObject)

Return the result of the checksum of a package with the SHA256/SHA384/SHA512 tags in the update server manifest

Parameters

string $packagefile Location of the package to be installed
JUpdate $updateObject The Update Object

Return Value

integer one if the hashes match, zero if hashes doesn't match, two if hashes not found