API16:JInstaller/install
From Joomla! Documentation
Description
Package installation method
<! removed transcluded page call, red link never existed >
Syntax
install($path=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $path | null | $path Path to package source folder |
Returns
boolean True if successful
Defined in
libraries/joomla/installer/installer.php
Importing
jimport( 'joomla.installer.installer' );
Source Body
public function install($path=null)
{
if ($path && JFolder::exists($path)) {
$this->setPath('source', $path);
}
else
{
$this->abort(JText::_('Install path does not exist'));
return false;
}
if (!$this->setupInstall())
{
$this->abort(JText::_('Unable to detect manifest file'));
return false;
}
$type = (string)$this->manifest->attributes()->type;
if (is_object($this->_adapters[$type]))
{
// Add the languages from the package itself
if (method_exists($this->_adapters[$type], 'loadLanguage'))
{
$this->_adapters[$type]->loadLanguage($path);
}
// Fire the onBeforeExtensionInstall event.
JPluginHelper::importPlugin('installer');
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onBeforeExtensionInstall', array('method'=>'install', 'type'=>$type, 'manifest'=>$this->manifest, 'extension'=>0));
// Run the install
$result = $this->_adapters[$type]->install();
// Fire the onAfterExtensionInstall
$dispatcher->trigger('onAfterExtensionInstall', array('installer'=>clone $this, 'eid'=> $result));
if ($result !== false) {
return true;
}
else {
return false;
}
}
return false;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples