class JInstaller extends JAdapter


Located at : UKNOWVA_ROOT/libraries/joomla/installer/installer.php

Joomla base installer class

Properties

object $manifestClass The manifest trigger class
JTableExtension $extension Extension Table Entry
string $message The output from the install/uninstall scripts
object $manifest The installation manifest XML object

Methods

__construct()

Constructor

string
__toString()

Magic method to convert the object to a string gracefully.

from JObject
mixed
def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

from JObject
mixed
get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

from JObject
array
getProperties(boolean $public = true)

Returns an associative array of object properties.

from JObject
string
getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

from JObject
array
getErrors()

Return all errors, if any.

from JObject
mixed
set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

from JObject
boolean
setProperties(mixed $properties)

Set the object properties based on a named array/hash.

from JObject
void
setError(string $error)

Add an error message.

from JObject
string
toString() deprecated

No description

from JObject
object
getDBO()

Get the database connector object

from JAdapter
boolean
setAdapter(string $name, object $adapter = null, array $options = array())

Set an adapter by name

from JAdapter
object
getAdapter(string $name, array $options = array())

Return an adapter.

from JAdapter
void
loadAllAdapters(array $options = array())

Loads all adapters.

from JAdapter
static object
getInstance()

Returns the global Installer object, only creating it if it doesn't already exist.

boolean
getOverwrite()

Get the allow overwrite switch

boolean
setOverwrite(boolean $state = false)

Set the allow overwrite switch

string
getRedirectURL()

Get the redirect location

setRedirectURL(string $newurl)

Set the redirect location

boolean
getUpgrade()

Get the upgrade switch

boolean
setUpgrade(boolean $state = false)

Set the upgrade switch

object
getManifest()

Get the installation manifest object

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

Get an installer path by name

void
setPath(string $name, string $value)

Sets an installer path by name

void
pushStep(array $step)

Pushes a step onto the installer stack for rolling back steps

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

Installation abort method

boolean
install(string $path = null)

Package installation method

discover_install($eid = null)

No description

array
discover()

Extension discover method Asks each adapter to find extensions

boolean
update(string $path = null)

Package update method

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

Package uninstallation method

mixed
refreshManifestCache(integer $eid)

Refreshes the manifest cache stored in #__extensions

boolean
setupInstall()

Prepare for installation: this method sets the installation directory, finds and checks the installation file and verifies the installation type.

mixed
parseQueries(JXMLElement $element)

Backward compatible method to parse through a queries element of the installation manifest file and take appropriate action.

mixed
parseSQLFiles(object $element)

Method to extract the name of a discreet installation sql file from the installation manifest file.

void
setSchemaVersion(JXMLElement $schema, integer $eid)

Set the schema version for an extension by looking at its latest update

boolean
parseSchemaUpdates(JXMLElement $schema, integer $eid)

Method to process the updates for an item

boolean
parseFiles(JXMLElement $element, integer $cid, array $oldFiles = null, array $oldMD5 = null)

Method to parse through a files element of the installation manifest and take appropriate action.

boolean
parseLanguages(JXMLElement $element, integer $cid)

Method to parse through a languages element of the installation manifest and take appropriate action.

boolean
parseMedia(JXMLElement $element, integer $cid)

Method to parse through a media element of the installation manifest and take appropriate action.

string
getParams()

Method to parse the parameters of an extension, build the INI string for its default parameters, and return the INI string.

boolean
copyFiles(array $files, boolean $overwrite = null)

Copyfiles

boolean
removeFiles(object $element, integer $cid)

Method to parse through a files element of the installation manifest and remove the files that were installed

boolean
copyManifest(integer $cid = 1)

Copies the installation manifest file to the extension folder in the given client

boolean
findManifest()

Tries to find the package manifest file

mixed
isManifest(string $file)

Is the XML file a valid Joomla installation manifest file

string
generateManifestCache()

Generates a manifest cache

object
cleanDiscoveredExtension(string $type, string $element, string $folder = '', integer $client)

Cleans up discovered extensions if they're being installed some other way

array
findDeletedFiles(array $old_files, array $new_files)

Compares two "files" entries to find deleted files/folders

array
loadMD5Sum(string $filename)

Loads an MD5SUMS file into an associative array

Details

at line 113
JObject __construct()

Constructor

Return Value

JObject

in JObject at line 56
string __toString()

Magic method to convert the object to a string gracefully.

Return Value

string The classname.

in JObject at line 70
mixed def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed

in JObject at line 88
mixed get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed The value of the property.

See also

getProperties()

in JObject at line 107
array getProperties(boolean $public = true)

Returns an associative array of object properties.

Parameters

boolean $public If true, returns only the public properties.

Return Value

array

See also

get()

in JObject at line 133
string getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

Parameters

integer $i Option error index.
boolean $toString Indicates if JError objects should return their error message.

Return Value

string Error message

in JObject at line 165
array getErrors()

Return all errors, if any.

Return Value

array Array of error messages or JErrors.

in JObject at line 180
mixed set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

Parameters

string $property The name of the property.
mixed $value The value of the property to set.

Return Value

mixed Previous value of the property.

in JObject at line 198
boolean setProperties(mixed $properties)

Set the object properties based on a named array/hash.

Parameters

mixed $properties Either an associative array or another object.

Return Value

boolean

See also

set()

in JObject at line 222
void setError(string $error)

Add an error message.

Parameters

string $error Error message.

Return Value

void

in JObject at line 235
string toString() deprecated

deprecated 12.1 Use magic method __toString()

Return Value

string

See also

__toString()

in JAdapter at line 90
object getDBO()

Get the database connector object

Return Value

object Database connector object

in JAdapter at line 106
boolean setAdapter(string $name, object $adapter = null, array $options = array())

Set an adapter by name

Parameters

string $name Adapter name
object $adapter Adapter object
array $options Adapter options

Return Value

boolean True if successful

in JAdapter at line 141
object getAdapter(string $name, array $options = array())

Return an adapter.

Parameters

string $name Name of adapter to return
array $options Adapter options

Return Value

object Adapter of type 'name' or false

in JAdapter at line 163
void loadAllAdapters(array $options = array())

Loads all adapters.

Parameters

array $options Adapter options

Return Value

void

at line 125
static object getInstance()

Returns the global Installer object, only creating it if it doesn't already exist.

Return Value

object An installer object

at line 141
boolean getOverwrite()

Get the allow overwrite switch

Return Value

boolean Allow overwrite switch

at line 154
boolean setOverwrite(boolean $state = false)

Set the allow overwrite switch

Parameters

boolean $state Overwrite switch state

Return Value

boolean True it state is set, false if it is not

at line 174
string getRedirectURL()

Get the redirect location

Return Value

string Redirect location (or null)

at line 185
setRedirectURL(string $newurl)

Set the redirect location

Parameters

string $newurl New redirect location

at line 196
boolean getUpgrade()

Get the upgrade switch

Return Value

boolean

at line 209
boolean setUpgrade(boolean $state = false)

Set the upgrade switch

Parameters

boolean $state Upgrade switch state

Return Value

boolean True if upgrade, false otherwise

at line 229
object getManifest()

Get the installation manifest object

Return Value

object Manifest object

at line 247
string getPath(string $name, string $default = null)

Get an installer path by name

Parameters

string $name Path name
string $default Default value

Return Value

string Path

at line 261
void setPath(string $name, string $value)

Sets an installer path by name

Parameters

string $name Path name
string $value Path

Return Value

void

at line 274
void pushStep(array $step)

Pushes a step onto the installer stack for rolling back steps

Parameters

array $step Installer step

Return Value

void

at line 288
boolean abort(string $msg = null, string $type = null)

Installation abort method

Parameters

string $msg Abort message from the installer
string $type Package type if defined

Return Value

boolean True if successful

at line 376
boolean install(string $path = null)

Package installation method

Parameters

string $path Path to package source folder

Return Value

boolean True if successful

at line 430
discover_install($eid = null)

Parameters

$eid

at line 495
array discover()

Extension discover method Asks each adapter to find extensions

Return Value

array JExtension

at line 525
boolean update(string $path = null)

Package update method

Parameters

string $path Path to package source folder

Return Value

boolean True if successful

at line 578
boolean uninstall(string $type, mixed $identifier, integer $cid)

Package uninstallation method

Parameters

string $type Package type
mixed $identifier Package identifier for adapter
integer $cid Application ID; deprecated in 1.6

Return Value

boolean True if successful

at line 611
mixed refreshManifestCache(integer $eid)

Refreshes the manifest cache stored in #__extensions

Parameters

integer $eid Extension ID

Return Value

mixed void on success, false on error @todo missing return value ?

at line 669
boolean setupInstall()

Prepare for installation: this method sets the installation directory, finds and checks the installation file and verifies the installation type.

Return Value

boolean True on success

at line 698
mixed parseQueries(JXMLElement $element)

Backward compatible method to parse through a queries element of the installation manifest file and take appropriate action.

Parameters

JXMLElement $element The XML node to process

Return Value

mixed Number of queries processed or False on error

at line 739
mixed parseSQLFiles(object $element)

Method to extract the name of a discreet installation sql file from the installation manifest file.

Parameters

object $element The XML node to process

Return Value

mixed Number of queries processed or False on error

at line 826
void setSchemaVersion(JXMLElement $schema, integer $eid)

Set the schema version for an extension by looking at its latest update

Parameters

JXMLElement $schema Schema Tag
integer $eid Extension ID

Return Value

void

at line 881
boolean parseSchemaUpdates(JXMLElement $schema, integer $eid)

Method to process the updates for an item

Parameters

JXMLElement $schema The XML node to process
integer $eid Extension Identifier

Return Value

boolean Result of the operations

at line 996
boolean parseFiles(JXMLElement $element, integer $cid, array $oldFiles = null, array $oldMD5 = null)

Method to parse through a files element of the installation manifest and take appropriate action.

Parameters

JXMLElement $element The XML node to process
integer $cid Application ID of application to install to
array $oldFiles List of old files (JXMLElement's)
array $oldMD5 List of old MD5 sums (indexed by filename with value as MD5)

Return Value

boolean True on success

at line 1105
boolean parseLanguages(JXMLElement $element, integer $cid)

Method to parse through a languages element of the installation manifest and take appropriate action.

Parameters

JXMLElement $element The XML node to process
integer $cid Application ID of application to install to

Return Value

boolean True on success

at line 1207
boolean parseMedia(JXMLElement $element, integer $cid)

Method to parse through a media element of the installation manifest and take appropriate action.

Parameters

JXMLElement $element The XML node to process
integer $cid Application ID of application to install to

Return Value

boolean True on success

at line 1282
string getParams()

Method to parse the parameters of an extension, build the INI string for its default parameters, and return the INI string.

Return Value

string INI string of parameter values

at line 1333
boolean copyFiles(array $files, boolean $overwrite = null)

Copyfiles

Copy files from source directory to the target directory

Parameters

array $files Array with filenames
boolean $overwrite True if existing files can be replaced

Return Value

boolean True on success

at line 1428
boolean removeFiles(object $element, integer $cid)

Method to parse through a files element of the installation manifest and remove the files that were installed

Parameters

object $element The XML node to process
integer $cid Application ID of application to remove from

Return Value

boolean True on success

at line 1570
boolean copyManifest(integer $cid = 1)

Copies the installation manifest file to the extension folder in the given client

Parameters

integer $cid Where to copy the installfile [optional: defaults to 1 (admin)]

Return Value

boolean True on success, False on error

at line 1596
boolean findManifest()

Tries to find the package manifest file

Return Value

boolean True on success, False on error

at line 1651
mixed isManifest(string $file)

Is the XML file a valid Joomla installation manifest file

Parameters

string $file An xmlfile path to check

Return Value

mixed A JXMLElement, or null if the file failed to parse

at line 1699
string generateManifestCache()

Generates a manifest cache

Return Value

string serialised manifest data

at line 1715
object cleanDiscoveredExtension(string $type, string $element, string $folder = '', integer $client)

Cleans up discovered extensions if they're being installed some other way

Parameters

string $type The type of extension (component, etc)
string $element Unique element identifier (e.g. com_content)
string $folder The folder of the extension (plugins; e.g. system)
integer $client The client application (administrator or site)

Return Value

object Result of query

at line 1732
array findDeletedFiles(array $old_files, array $new_files)

Compares two "files" entries to find deleted files/folders

Parameters

array $old_files An array of JXMLElement objects that are the old files
array $new_files An array of JXMLElement objects that are the new files

Return Value

array An array with the delete files and folders in findDeletedFiles[files] and findDeletedFiles[folders] resepctively

at line 1818
array loadMD5Sum(string $filename)

Loads an MD5SUMS file into an associative array

Parameters

string $filename Filename to load

Return Value

array Associative array with filenames as the index and the MD5 as the value