JInstaller
Extends \JAdapterJoomla base installer class
This class allows for simple but smart objects with get and set methods and an internal error handler.
| package |
Joomla.Platform |
|---|---|
| subpackage |
Installer |
| since |
11.1 |
Methods
__construct
Class constructor, overridden in descendant classes.
__construct(mixed $properties = null)
| since |
11.1 |
|---|
Arguments
- $properties
mixedEither and associative array or another object to set the initial properties of the object.
__toString
Magic method to convert the object to a string gracefully.
__toString() : string
| since |
11.1 |
|---|---|
| deprecated |
12.3 Classes should provide their own __toString() implementation. |
Response
stringThe classname.
abort
Installation abort method
abort(string $msg = null, string $type = null) : boolean
| since |
11.1 |
|---|
Arguments
- $msg
stringAbort message from the installer- $type
stringPackage type if defined
Response
booleanTrue if successful
cleanDiscoveredExtension
Cleans up discovered extensions if they're being installed some other way
cleanDiscoveredExtension(string $type, string $element, string $folder = '', integer $client) : object
| since |
11.1 |
|---|
Arguments
- $type
stringThe type of extension (component, etc)- $element
stringUnique element identifier (e.g. com_content)- $folder
stringThe folder of the extension (plugins; e.g. system)- $client
integerThe client application (administrator or site)
Response
objectResult of query
copyFiles
Copyfiles
copyFiles(array $files, boolean $overwrite = null) : boolean
Copy files from source directory to the target directory
| since |
11.1 |
|---|
Arguments
- $files
arrayArray with filenames- $overwrite
booleanTrue if existing files can be replaced
Response
booleanTrue on success
copyManifest
Copies the installation manifest file to the extension folder in the given client
copyManifest(integer $cid = 1) : boolean
| since |
11.1 |
|---|
Arguments
- $cid
integerWhere to copy the installfile [optional: defaults to 1 (admin)]
Response
booleanTrue on success, False on error
def
Sets a default value if not alreay assigned
def(string $property, mixed $default = null) : mixed
| since |
11.1 |
|---|
Arguments
- $property
stringThe name of the property.- $default
mixedThe default value.
Response
mixed
discover
Extension discover method Asks each adapter to find extensions
discover() : array
| since |
11.1 |
|---|
Response
arrayJExtension
discover_install
Discovered package installation method
discover_install(integer $eid = null) : boolean
| since |
11.1 |
|---|
Arguments
- $eid
integerExtension ID
Response
booleanTrue if successful
findDeletedFiles
Compares two "files" entries to find deleted files/folders
findDeletedFiles(array $old_files, array $new_files) : array
| since |
11.1 |
|---|
Arguments
- $old_files
arrayAn array of SimpleXMLElement objects that are the old files- $new_files
arrayAn array of SimpleXMLElement objects that are the new files
Response
arrayAn array with the delete files and folders in findDeletedFiles[files] and findDeletedFiles[folders] respectively
findManifest
Tries to find the package manifest file
findManifest() : boolean
| since |
1.0 |
|---|
Response
booleanTrue on success, False on error
generateManifestCache
Generates a manifest cache
generateManifestCache() : string
| since |
11.1 |
|---|
Response
stringserialised manifest data
get
Returns a property of the object or the default value if the property is not set.
get(string $property, mixed $default = null) : mixed
| since |
11.1 |
|---|---|
| see | \JObject::getProperties() |
Arguments
- $property
stringThe name of the property.- $default
mixedThe default value.
Response
mixedThe value of the property.
getAdapter
Return an adapter.
getAdapter(string $name, array $options = array()) : object
| since |
11.1 |
|---|
Arguments
- $name
stringName of adapter to return- $options
arrayAdapter options
Response
objectAdapter of type 'name' or false
getDBO
Get the database connector object
getDBO() : \JDatabase
getError
Get the most recent error message.
getError(integer $i = null, boolean $toString = true) : string
| since |
11.1 |
|---|---|
| see | \JError |
| deprecated |
12.3 JError has been deprecated |
Arguments
- $i
integerOption error index.- $toString
booleanIndicates if JError objects should return their error message.
Response
stringError message
getErrors
Return all errors, if any.
getErrors() : array
| since |
11.1 |
|---|---|
| see | \JError |
| deprecated |
12.3 JError has been deprecated |
Response
arrayArray of error messages or JErrors.
getInstance
Returns the global Installer object, only creating it if it doesn't already exist.
getInstance() : object
| since |
11.1 |
|---|
Response
objectAn installer object
getManifest
Get the installation manifest object
getManifest() : object
| since |
11.1 |
|---|
Response
objectManifest object
getOverwrite
Get the allow overwrite switch
getOverwrite() : boolean
| since |
11.1 |
|---|---|
| deprecated |
12.1 Use JInstaller::isOverwrite() |
Response
booleanAllow overwrite switch
getParams
Method to parse the parameters of an extension, build the INI string for its default parameters, and return the INI string.
getParams() : string
| since |
11.1 |
|---|
Response
stringINI string of parameter values
getPath
Get an installer path by name
getPath(string $name, string $default = null) : string
| since |
11.1 |
|---|
Arguments
- $name
stringPath name- $default
stringDefault value
Response
stringPath
getProperties
Returns an associative array of object properties.
getProperties(boolean $public = true) : array
| since |
11.1 |
|---|---|
| see | \JObject::get() |
Arguments
- $public
booleanIf true, returns only the public properties.
Response
array
getRedirectURL
Get the redirect location
getRedirectURL() : string
| since |
11.1 |
|---|
Response
stringRedirect location (or null)
getUpgrade
Get the upgrade switch
getUpgrade() : boolean
| since |
11.1 |
|---|---|
| deprecated |
12.1 Use JInstaller::isUpgrade() |
Response
boolean
install
Package installation method
install(string $path = null) : boolean
| since |
11.1 |
|---|
Arguments
- $path
stringPath to package source folder
Response
booleanTrue if successful
isManifest
Is the XML file a valid Joomla installation manifest file.
isManifest(string $file) : mixed
| since |
11.1 |
|---|
Arguments
- $file
stringAn xmlfile path to check
Response
mixedA JXMLElement, or null if the file failed to parse
isOverwrite
Get the allow overwrite switch
isOverwrite() : boolean
| since |
11.4 |
|---|
Response
booleanAllow overwrite switch
isUpgrade
Get the upgrade switch
isUpgrade() : boolean
| since |
11.4 |
|---|
Response
boolean
loadAllAdapters
Loads all adapters.
loadAllAdapters(array $options = array()) : void
| since |
11.1 |
|---|
Arguments
- $options
arrayAdapter options
loadMD5Sum
Loads an MD5SUMS file into an associative array
loadMD5Sum(string $filename) : array
| since |
11.1 |
|---|
Arguments
- $filename
stringFilename to load
Response
arrayAssociative array with filenames as the index and the MD5 as the value
parseFiles
Method to parse through a files element of the installation manifest and take appropriate action.
parseFiles(\SimpleXMLElement $element, integer $cid, array $oldFiles = null, array $oldMD5 = null) : boolean
| since |
11.1 |
|---|
Arguments
- $element
\SimpleXMLElementThe XML node to process- $cid
integerApplication ID of application to install to- $oldFiles
arrayList of old files (SimpleXMLElement's)- $oldMD5
arrayList of old MD5 sums (indexed by filename with value as MD5)
Response
booleanTrue on success
parseLanguages
Method to parse through a languages element of the installation manifest and take appropriate action.
parseLanguages(\SimpleXMLElement $element, integer $cid) : boolean
| since |
11.1 |
|---|
Arguments
- $element
\SimpleXMLElementThe XML node to process- $cid
integerApplication ID of application to install to
Response
booleanTrue on success
parseMedia
Method to parse through a media element of the installation manifest and take appropriate action.
parseMedia(\SimpleXMLElement $element, integer $cid) : boolean
| since |
11.1 |
|---|
Arguments
- $element
\SimpleXMLElementThe XML node to process- $cid
integerApplication ID of application to install to
Response
booleanTrue on success
parseQueries
Backward compatible method to parse through a queries element of the installation manifest file and take appropriate action.
parseQueries(\SimpleXMLElement $element) : mixed
| since |
11.1 |
|---|
Arguments
- $element
\SimpleXMLElementThe XML node to process
Response
mixedNumber of queries processed or False on error
parseSchemaUpdates
Method to process the updates for an item
parseSchemaUpdates(\SimpleXMLElement $schema, integer $eid) : boolean
| since |
11.1 |
|---|
Arguments
- $schema
\SimpleXMLElementThe XML node to process- $eid
integerExtension Identifier
Response
booleanResult of the operations
parseSQLFiles
Method to extract the name of a discreet installation sql file from the installation manifest file.
parseSQLFiles(object $element) : mixed
| since |
11.1 |
|---|
Arguments
- $element
objectThe XML node to process
Response
mixedNumber of queries processed or False on error
parseXMLInstallFile
Parse a XML install manifest file.
parseXMLInstallFile(string $path) : array
XML Root tag should be 'install' except for languages which use meta file.
| since |
12.1 |
|---|
Arguments
- $path
stringFull path to XML file.
Response
arrayXML metadata.
pushStep
Pushes a step onto the installer stack for rolling back steps
pushStep(array $step) : void
| since |
11.1 |
|---|
Arguments
- $step
arrayInstaller step
refreshManifestCache
Refreshes the manifest cache stored in #__extensions
refreshManifestCache(integer $eid) : mixed
| since |
11.1 |
|---|
Arguments
- $eid
integerExtension ID
Response
mixedvoid on success, false on error @todo missing return value ?
removeFiles
Method to parse through a files element of the installation manifest and remove the files that were installed
removeFiles(object $element, integer $cid) : boolean
| since |
11.1 |
|---|
Arguments
- $element
objectThe XML node to process- $cid
integerApplication ID of application to remove from
Response
booleanTrue on success
set
Modifies a property of the object, creating it if it does not already exist.
set(string $property, mixed $value = null) : mixed
| since |
11.1 |
|---|
Arguments
- $property
stringThe name of the property.- $value
mixedThe value of the property to set.
Response
mixedPrevious value of the property.
setAdapter
Set an adapter by name
setAdapter(string $name, &$adapter = null, array $options = array()) : boolean
| since |
11.1 |
|---|
Arguments
- $name
stringAdapter name- $adapter
- $options
arrayAdapter options
Response
booleanTrue if successful
setError
Add an error message.
setError(string $error) : void
| since |
11.1 |
|---|---|
| see | \JError |
| deprecated |
12.3 JError has been deprecated |
Arguments
- $error
stringError message.
setOverwrite
Set the allow overwrite switch
setOverwrite(boolean $state = false) : boolean
| since |
11.1 |
|---|
Arguments
- $state
booleanOverwrite switch state
Response
booleanTrue it state is set, false if it is not
setPath
Sets an installer path by name
setPath(string $name, string $value) : void
| since |
11.1 |
|---|
Arguments
- $name
stringPath name- $value
stringPath
setProperties
Set the object properties based on a named array/hash.
setProperties(mixed $properties) : boolean
| since |
11.1 |
|---|---|
| see | \JObject::set() |
Arguments
- $properties
mixedEither an associative array or another object.
Response
boolean
setRedirectURL
Set the redirect location
setRedirectURL(string $newurl) : void
| since |
11.1 |
|---|
Arguments
- $newurl
stringNew redirect location
setSchemaVersion
Set the schema version for an extension by looking at its latest update
setSchemaVersion(\SimpleXMLElement $schema, integer $eid) : void
| since |
11.1 |
|---|
Arguments
- $schema
\SimpleXMLElementSchema Tag- $eid
integerExtension ID
setUpgrade
Set the upgrade switch
setUpgrade(boolean $state = false) : boolean
| since |
11.1 |
|---|
Arguments
- $state
booleanUpgrade switch state
Response
booleanTrue if upgrade, false otherwise
setupInstall
Prepare for installation: this method sets the installation directory, finds and checks the installation file and verifies the installation type.
setupInstall() : boolean
| since |
11.1 |
|---|
Response
booleanTrue on success
toString
Converts the object to a string (the class name).
toString() : string
uninstall
Package uninstallation method
uninstall(string $type, mixed $identifier, integer $cid) : boolean
| since |
11.1 |
|---|
Arguments
- $type
stringPackage type- $identifier
mixedPackage identifier for adapter- $cid
integerApplication ID; deprecated in 1.6
Response
booleanTrue if successful
update
Package update method
update(string $path = null) : boolean
| since |
11.1 |
|---|
Arguments
- $path
stringPath to package source folder
Response
booleanTrue if successful
Properties
_paths
Array of paths needed by the installer
| since |
11.1 |
|---|
Type(s)
array
_upgrade
True if package is an upgrade
| since |
11.1 |
|---|
Type(s)
boolean
manifestClass
The manifest trigger class
| since |
11.1 |
|---|
Type(s)
object
_overwrite
True if existing files can be overwritten
| since |
11.1 |
|---|
Type(s)
boolean
_stepStack
Stack of installation steps
- Used for installation rollback
| since |
11.1 |
|---|
Type(s)
array
message
The output from the install/uninstall scripts
| since |
11.1 |
|---|
Type(s)
string
manifest
The installation manifest XML object
| since |
11.1 |
|---|
Type(s)
object
extension_message
The extension message that appears
| since |
11.1 |
|---|
Type(s)
string
redirect_url
The redirect URL if this extension (can be null if no redirect)
| since |
11.1 |
|---|
Type(s)
string
_adapters
Associative array of adapters
| since |
11.1 |
|---|
Type(s)
array
_adapterfolder
Adapter Folder
| since |
11.1 |
|---|
Type(s)
string
_classprefix
Adapter Class Prefix
| since |
11.1 |
|---|
Type(s)
string
_basepath
Base Path for the adapter instance
| since |
11.1 |
|---|
Type(s)
string
_errors
An array of error messages or Exception objects.