API16

JInstaller/install

From Joomla! Documentation

< API16:JInstaller

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Package installation method


<! removed transcluded page call, red link never existed >

Syntax[edit]

install($path=null)
Parameter Name Default Value Description
$path null $path Path to package source folder

Returns[edit]

boolean True if successful

Defined in[edit]

libraries/joomla/installer/installer.php

Importing[edit]

jimport( 'joomla.installer.installer' );

Source Body[edit]

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[edit]

Code Examples[edit]