Actions

API16

JInstaller/install

From Joomla! Documentation

< API16:JInstaller
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Package installation method

[<! removed edit link to red link >]

<! 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 edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />