Installer
Extends Adapter Implements \Joomla\Database\DatabaseAwareInterfaceJoomla base installer class
since |
3.1 |
---|---|
package |
Joomla CMS |
Methods
__construct
Class constructor, overridden in descendant classes.
__construct(mixed properties = null) : mixed
since |
1.7.0 |
---|
Arguments
- properties
mixed
Either and associative array or another object to set the initial properties of the object.
Response
mixed
__toString
Magic method to convert the object to a string gracefully.
__toString() : string
since |
1.7.0 |
---|---|
deprecated |
3.1.4 Classes should provide their own __toString() implementation. |
Response
string
The classname.
abort
Installation abort method
abort(string msg = null, string type = null) : bool
since |
3.1 |
---|
Arguments
- msg
string
Abort message from the installer- type
string
Package type if defined
Response
bool
True if successful
cleanDiscoveredExtension
Cleans up discovered extensions if they're being installed some other way
cleanDiscoveredExtension(string type, string element, string folder = '', int client) : object
since |
3.1 |
---|
Arguments
- type
string
The type of extension (component, etc)- element
string
Unique element identifier (e.g. com_content)- folder
string
The folder of the extension (plugins; e.g. system)- client
int
The client application (administrator or site)
Response
object
Result of query
copyFiles
Copyfiles
copyFiles(array files, bool overwrite = null) : bool
Copy files from source directory to the target directory
since |
3.1 |
---|
Arguments
- files
array
Array with filenames- overwrite
bool
True if existing files can be replaced
Response
bool
True on success
copyManifest
Copies the installation manifest file to the extension folder in the given client
copyManifest(int cid = 1) : bool
since |
3.1 |
---|
Arguments
- cid
int
Where to copy the installfile [optional: defaults to 1 (admin)]
Response
bool
True on success, False on error
def
Sets a default value if not already assigned
def(string property, mixed default = null) : mixed
since |
1.7.0 |
---|
Arguments
- property
string
The name of the property.- default
mixed
The default value.
Response
mixed
discover
Extension discover method
discover() : \Joomla\CMS\Installer\InstallerExtension[]
Asks each adapter to find extensions
since |
3.1 |
---|
Response
\Joomla\CMS\Installer\InstallerExtension[]
discover_install
Discovered package installation method
discover_install(int eid = null) : bool
since |
3.1 |
---|
Arguments
- eid
int
Extension ID
Response
bool
True if successful
findDeletedFiles
Compares two "files" entries to find deleted files/folders
findDeletedFiles(array oldFiles, array newFiles) : array
since |
3.1 |
---|
Arguments
- oldFiles
array
An array of \SimpleXMLElement objects that are the old files- newFiles
array
An array of \SimpleXMLElement objects that are the new files
Response
array
An array with the delete files and folders in findDeletedFiles[files] and findDeletedFiles[folders] respectively
findManifest
Tries to find the package manifest file
findManifest() : bool
since |
3.1 |
---|
Response
bool
True on success, False on error
generateManifestCache
Generates a manifest cache
generateManifestCache() : string
since |
3.1 |
---|
Response
string
serialised 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 |
1.7.0 |
---|---|
see | CMSObject::getProperties() |
Arguments
- property
string
The name of the property.- default
mixed
The default value.
Response
mixed
The value of the property.
getAdapter
Return an adapter.
getAdapter(string name, array options = array()) : static|bool
since |
1.6 |
---|
Arguments
- name
string
Name of adapter to return- options
array
Adapter options
Response
static|bool
Adapter of type 'name' or false
getAdapters
Gets a list of available install adapters.
getAdapters(array options = array(), array custom = array()) : string[]
since |
3.4 |
---|
Arguments
- options
array
An array of options to inject into the adapter- custom
array
Array of custom install adapters
Response
string[]
An array of the class names of available install adapters.
getDbo
Get the database connector object
getDbo() : \Joomla\Database\DatabaseDriver
since |
1.6 |
---|
Response
\Joomla\Database\DatabaseDriver
Database connector object
getError
Get the most recent error message.
getError(int i = null, bool toString = true) : string
since |
1.7.0 |
---|---|
deprecated |
3.1.4 JError has been deprecated |
Arguments
- i
int
Option error index.- toString
bool
Indicates if Exception objects should return their error message.
Response
string
Error message
getErrors
Return all errors, if any.
getErrors() : array
since |
1.7.0 |
---|---|
deprecated |
3.1.4 JError has been deprecated |
Response
array
Array of error messages.
getInstance
Returns the global Installer object, only creating it if it doesn't already exist.
getInstance(string basepath = __DIR__, string classprefix = '\Joomla\CMS\Installer\Adapter', string adapterfolder = 'Adapter') : \Joomla\CMS\Installer\Installer
since |
3.1 |
---|
Arguments
- basepath
string
Base Path of the adapters- classprefix
string
Class prefix of adapters- adapterfolder
string
Name of folder to append to base path
Response
\Joomla\CMS\Installer\Installer
An installer object
getManifest
Get the installation manifest object
getManifest() : \SimpleXMLElement
since |
3.1 |
---|
Response
\SimpleXMLElement
Manifest object
getParams
Method to parse the parameters of an extension, build the JSON string for its default parameters, and return the JSON string.
getParams() : string
since |
3.1 |
---|---|
note |
This method must always return a JSON compliant string |
Response
string
JSON string of parameter values
getPath
Get an installer path by name
getPath(string name, string default = null) : string
since |
3.1 |
---|
Arguments
- name
string
Path name- default
string
Default value
Response
string
Path
getProperties
Returns an associative array of object properties.
getProperties(bool public = true) : array
since |
1.7.0 |
---|---|
see | CMSObject::get() |
Arguments
- public
bool
If true, returns only the public properties.
Response
array
getRedirectUrl
Get the redirect location
getRedirectUrl() : string
since |
3.1 |
---|
Response
string
Redirect location (or null)
install
Package installation method
install(string path = null) : bool
since |
3.1 |
---|
Arguments
- path
string
Path to package source folder
Response
bool
True if successful
isManifest
Is the XML file a valid Joomla installation manifest file.
isManifest(string file) : \SimpleXMLElement|null
since |
3.1 |
---|
Arguments
- file
string
An xmlfile path to check
Response
\SimpleXMLElement|null
A \SimpleXMLElement, or null if the file failed to parse
isOverwrite
Get the allow overwrite switch
isOverwrite() : bool
since |
3.1 |
---|
Response
bool
Allow overwrite switch
isPackageUninstall
Get whether this installer is uninstalling extensions which are part of a package
isPackageUninstall() : bool
since |
3.7.0 |
---|
Response
bool
isUpgrade
Get the upgrade switch
isUpgrade() : bool
since |
3.1 |
---|
Response
bool
loadAdapter
Method to load an adapter instance
loadAdapter(string adapter, array options = array()) : \Joomla\CMS\Installer\InstallerAdapter
since |
3.4 |
---|---|
throws |
|
Arguments
- adapter
string
Adapter name- options
array
Adapter options
Response
\Joomla\CMS\Installer\InstallerAdapter
loadAllAdapters
Loads all adapters.
loadAllAdapters(array options = array()) : void
since |
1.6 |
---|
Arguments
- options
array
Adapter options
loadMD5Sum
Loads an MD5SUMS file into an associative array
loadMD5Sum(string filename) : array
since |
3.1 |
---|
Arguments
- filename
string
Filename to load
Response
array
Associative 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, int cid, array oldFiles = null, array oldMD5 = null) : bool
since |
3.1 |
---|
Arguments
- element
\SimpleXMLElement
The XML node to process- cid
int
Application ID of application to install to- oldFiles
array
List of old files (SimpleXMLElement's)- oldMD5
array
List of old MD5 sums (indexed by filename with value as MD5)
Response
bool
True on success
parseLanguages
Method to parse through a languages element of the installation manifest and take appropriate action.
parseLanguages(\SimpleXMLElement element, int cid) : bool
since |
3.1 |
---|
Arguments
- element
\SimpleXMLElement
The XML node to process- cid
int
Application ID of application to install to
Response
bool
True on success
parseMedia
Method to parse through a media element of the installation manifest and take appropriate action.
parseMedia(\SimpleXMLElement element, int cid) : bool
since |
3.1 |
---|
Arguments
- element
\SimpleXMLElement
The XML node to process- cid
int
Application ID of application to install to
Response
bool
True 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 |
3.1 |
---|
Arguments
- element
\SimpleXMLElement
The XML node to process
Response
mixed
Number of queries processed or False on error
parseSchemaUpdates
Method to process the updates for an item
parseSchemaUpdates(\SimpleXMLElement schema, int eid) : bool|int
since |
3.1 |
---|
Arguments
- schema
\SimpleXMLElement
The XML node to process- eid
int
Extension Identifier
Response
bool|int
Number of SQL updates executed; false on failure.
parseSQLFiles
Method to extract the name of a discreet installation sql file from the installation manifest file.
parseSQLFiles(object element) : mixed
since |
3.1 |
---|
Arguments
- element
object
The XML node to process
Response
mixed
Number 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 |
3.0.0 |
---|
Arguments
- path
string
Full path to XML file.
Response
array
XML metadata.
pushStep
Pushes a step onto the installer stack for rolling back steps
pushStep(array step) : void
since |
3.1 |
---|
Arguments
- step
array
Installer step
refreshManifestCache
Refreshes the manifest cache stored in #__extensions
refreshManifestCache(int eid) : bool
since |
3.1 |
---|
Arguments
- eid
int
Extension ID
Response
bool
removeFiles
Method to parse through a files element of the installation manifest and remove the files that were installed
removeFiles(object element, int cid) : bool
since |
3.1 |
---|
Arguments
- element
object
The XML node to process- cid
int
Application ID of application to remove from
Response
bool
True 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 |
1.7.0 |
---|
Arguments
- property
string
The name of the property.- value
mixed
The value of the property to set.
Response
mixed
Previous value of the property.
setAdapter
Set an adapter by name
setAdapter(string name, object &adapter = null, array options = array()) : bool
since |
1.6 |
---|
Arguments
- name
string
Adapter name- adapter
object
Adapter object- options
array
Adapter options
Response
bool
True if successful
setError
Add an error message.
setError(string error) : void
since |
1.7.0 |
---|---|
deprecated |
3.1.4 JError has been deprecated |
Arguments
- error
string
Error message.
setOverwrite
Set the allow overwrite switch
setOverwrite(bool state = false) : bool
since |
3.1 |
---|
Arguments
- state
bool
Overwrite switch state
Response
bool
True it state is set, false if it is not
setPackageUninstall
Set whether this installer is uninstalling extensions which are part of a package
setPackageUninstall(bool uninstall) : void
since |
3.7.0 |
---|
Arguments
- uninstall
bool
True if a package triggered the uninstall, false otherwise
setPath
Sets an installer path by name
setPath(string name, string value) : void
since |
3.1 |
---|
Arguments
- name
string
Path name- value
string
Path
setProperties
Set the object properties based on a named array/hash.
setProperties(mixed properties) : bool
since |
1.7.0 |
---|---|
see | CMSObject::set() |
Arguments
- properties
mixed
Either an associative array or another object.
Response
bool
setRedirectUrl
Set the redirect location
setRedirectUrl(string newurl) : void
since |
3.1 |
---|
Arguments
- newurl
string
New redirect location
setSchemaVersion
Set the schema version for an extension by looking at its latest update
setSchemaVersion(\SimpleXMLElement schema, int eid) : void
since |
3.1 |
---|
Arguments
- schema
\SimpleXMLElement
Schema Tag- eid
int
Extension ID
setUpgrade
Set the upgrade switch
setUpgrade(bool state = false) : bool
since |
3.1 |
---|
Arguments
- state
bool
Upgrade switch state
Response
bool
True 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(string route = 'install', bool returnAdapter = false) : bool|\Joomla\CMS\Installer\InstallerAdapter
since |
3.1 |
---|
Arguments
- route
string
The install route being followed- returnAdapter
bool
Flag to return the instantiated adapter
Response
bool|\Joomla\CMS\Installer\InstallerAdapter
InstallerAdapter object if explicitly requested otherwise boolean
splitSql
Splits a string of multiple queries into an array of individual queries.
splitSql(string|null sql) : array
This is different than DatabaseDriver::splitSql. It supports the special CAN FAIL comment marker which indicates that a SQL statement could fail without raising an error during the installation.
since |
4.2.0 |
---|
Arguments
- sql
string|null
Input SQL string with which to split into individual queries.
Response
array
uninstall
Package uninstallation method
uninstall(string type, mixed identifier) : bool
since |
3.1 |
---|
Arguments
- type
string
Package type- identifier
mixed
Package identifier for adapter
Response
bool
True if successful
update
Package update method
update(string path = null) : bool
since |
3.1 |
---|
Arguments
- path
string
Path to package source folder
Response
bool
True if successful
updateSchemaTable
Update the schema table with the latest version
updateSchemaTable(int eid, string version, bool update = false) : void
since |
4.2.0 |
---|
Arguments
- eid
int
Extension ID.- version
string
Latest schema version ID.- update
bool
Should I run an update against an existing record or insert a new one?
Constants
CAN_FAIL_MARKER
A comment marker to indicate that an update SQL query may fail without triggering an update error.
Value | '/** CAN FAIL **/' |
---|---|
since |
4.2.0 |
CAN_FAIL_MARKER_LENGTH
The length of the CAN_FAIL_MARKER string
Value | 16 |
---|---|
since |
4.2.0 |
Properties
redirect_url
The redirect URL if this extension (can be null if no redirect)
packageUninstall
Flag if the uninstall process was triggered by uninstalling a package
_db
Database Connector Object
since |
1.6 |
---|
Type(s)
\Joomla\Database\DatabaseDriver
_errors
An array of error messages or Exception objects.