Installer

Extends \JAdapter

Joomla base installer class

since

3.1

Methods

__construct

Constructor

__construct(string $basepath, string $classprefix = null, string $adapterfolder = null) 
inherited
since

1.6

Arguments

$basepath

stringBase Path of the adapters

$classprefix

stringClass prefix of adapters

$adapterfolder

stringName of folder to append to base path

abort

Installation abort method

abort(string $msg = null, string $type = null) : boolean
since

3.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

3.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

3.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

3.1

Arguments

$cid

integerWhere to copy the installfile [optional: defaults to 1 (admin)]

Response

booleanTrue on success, False on error

discover

Extension discover method

discover() : array<mixed,\Joomla\CMS\Installer\InstallerExtension>

Asks each adapter to find extensions

since

3.1

Response

array<mixed,\Joomla\CMS\Installer\InstallerExtension>

discover_install

Discovered package installation method

discover_install(integer $eid = null) : boolean
since

3.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

3.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

3.1

Response

booleanTrue on success, False on error

generateManifestCache

Generates a manifest cache

generateManifestCache() : string
since

3.1

Response

stringserialised manifest data

getAdapter

Return an adapter.

getAdapter(string $name, array $options = array()) : \JAdapterInstance|boolean
inherited
since

1.6

Arguments

$name

stringName of adapter to return

$options

arrayAdapter options

Response

\JAdapterInstance|booleanAdapter of type 'name' or false

getAdapters

Gets a list of available install adapters.

getAdapters(array $options = array(), array $custom = array()) : array
since

3.4

note

As of 4.0, this method will only return the names of available adapters and will not instantiate them and store to the $_adapters class var.

Arguments

$options

arrayAn array of options to inject into the adapter

$custom

arrayArray of custom install adapters

Response

arrayAn array of available install adapters.

getDbo

Get the database connector object

getDbo() : \JDatabaseDriver
inherited
since

1.6

Response

\JDatabaseDriverDatabase connector object

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
static
since

3.1

Arguments

$basepath

stringBase Path of the adapters

$classprefix

stringClass prefix of adapters

$adapterfolder

stringName of folder to append to base path

Response

\Joomla\CMS\Installer\InstallerAn installer object

getManifest

Get the installation manifest object

getManifest() : \SimpleXMLElement
since

3.1

Response

\SimpleXMLElementManifest 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

stringJSON string of parameter values

getPath

Get an installer path by name

getPath(string $name, string $default = null) : string
since

3.1

Arguments

$name

stringPath name

$default

stringDefault value

Response

stringPath

getRedirectUrl

Get the redirect location

getRedirectUrl() : string
since

3.1

Response

stringRedirect location (or null)

install

Package installation method

install(string $path = null) : boolean
since

3.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) : \SimpleXMLElement|null
since

3.1

Arguments

$file

stringAn xmlfile path to check

Response

\SimpleXMLElement|nullA \SimpleXMLElement, or null if the file failed to parse

isOverwrite

Get the allow overwrite switch

isOverwrite() : boolean
since

3.1

Response

booleanAllow overwrite switch

isPackageUninstall

Get whether this installer is uninstalling extensions which are part of a package

isPackageUninstall() : boolean
since

3.7.0

Response

boolean

isUpgrade

Get the upgrade switch

isUpgrade() : boolean
since

3.1

Response

boolean

loadAdapter

Method to load an adapter instance

loadAdapter(string $adapter, array $options = array()) : \Joomla\CMS\Installer\InstallerAdapter
since

3.4

throws

\InvalidArgumentException

Arguments

$adapter

stringAdapter name

$options

arrayAdapter options

Response

\Joomla\CMS\Installer\InstallerAdapter

loadAllAdapters

Loads all adapters.

loadAllAdapters(array $options = array()) : void
inherited
since

1.6

Arguments

$options

arrayAdapter options

loadMD5Sum

Loads an MD5SUMS file into an associative array

loadMD5Sum(string $filename) : array
since

3.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

3.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

3.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

3.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

3.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

3.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

3.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
static

XML Root tag should be 'install' except for languages which use meta file.

since

3.0.0

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

3.1

Arguments

$step

arrayInstaller step

refreshManifestCache

Refreshes the manifest cache stored in #__extensions

refreshManifestCache(integer $eid) : boolean
since

3.1

Arguments

$eid

integerExtension ID

Response

boolean

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

3.1

Arguments

$element

objectThe XML node to process

$cid

integerApplication ID of application to remove from

Response

booleanTrue on success

setAdapter

Set an adapter by name

setAdapter(string $name,  &$adapter = null, array $options = array()) : boolean
inherited
since

1.6

Arguments

$name

stringAdapter name

$adapter

$options

arrayAdapter options

Response

booleanTrue if successful

setOverwrite

Set the allow overwrite switch

setOverwrite(boolean $state = false) : boolean
since

3.1

Arguments

$state

booleanOverwrite switch state

Response

booleanTrue it state is set, false if it is not

setPackageUninstall

Set whether this installer is uninstalling extensions which are part of a package

setPackageUninstall(boolean $uninstall) : void
since

3.7.0

Arguments

$uninstall

booleanTrue 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

stringPath name

$value

stringPath

setRedirectUrl

Set the redirect location

setRedirectUrl(string $newurl) : void
since

3.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

3.1

Arguments

$schema

\SimpleXMLElementSchema Tag

$eid

integerExtension ID

setUpgrade

Set the upgrade switch

setUpgrade(boolean $state = false) : boolean
since

3.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(string $route = 'install', boolean $returnAdapter = false) : boolean|\Joomla\CMS\Installer\InstallerAdapter
since

3.1

Arguments

$route

stringThe install route being followed

$returnAdapter

booleanFlag to return the instantiated adapter

Response

boolean|\Joomla\CMS\Installer\InstallerAdapterInstallerAdapter object if explicitly requested otherwise boolean

uninstall

Package uninstallation method

uninstall(string $type, mixed $identifier, integer $cid) : boolean
since

3.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

3.1

Arguments

$path

stringPath to package source folder

Response

booleanTrue if successful

Properties

paths

Array of paths needed by the installer

since

3.1

Type(s)

array

upgrade

True if package is an upgrade

since

3.1

Type(s)

boolean

manifestClass

The manifest trigger class

since

3.1

Type(s)

object

overwrite

True if existing files can be overwritten

since

3.0.0

Type(s)

boolean

stepStack

Stack of installation steps

  • Used for installation rollback
since

3.1

Type(s)

array

extension

Extension Table Entry

since

3.1

Type(s)

\Joomla\CMS\Table\Extension

message

The output from the install/uninstall scripts

since

3.1

Type(s)

string

manifest

The installation manifest XML object

since

3.1

Type(s)

object

extension_message

The extension message that appears

since

3.1

Type(s)

string

redirect_url

The redirect URL if this extension (can be null if no redirect)

since

3.1

Type(s)

string

packageUninstall

Flag if the uninstall process was triggered by uninstalling a package

since

3.7.0

Type(s)

boolean

instance

Installer instance container.

static deprecated
since

3.1

deprecated

4.0

Type(s)

\Joomla\CMS\Installer\Installer

instances

Installer instances container.

static
since

3.4

Type(s)

array<mixed,\Joomla\CMS\Installer\Installer>

_adapters

Associative array of adapters

inherited
since

1.6

Type(s)

array<mixed,\JAdapterInstance>

_adapterfolder

Adapter Folder

inherited
since

1.6

Type(s)

string

_classprefix

Adapter Class Prefix

inherited
since

1.6

Type(s)

string

_basepath

Base Path for the adapter instance

inherited
since

1.6

Type(s)

string

_db

Database Connector Object

inherited
since

1.6

Type(s)

\JDatabaseDriver