Actions

API16

JInstaller/discover install

From Joomla! Documentation

< API16:JInstaller
Revision as of 17:53, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.

[Edit Descripton]

Description:JInstaller/discover install

Contents

Syntax

discover_install($eid=null)
Parameter Name Default Value Description
$eid null

Defined in

libraries/joomla/installer/installer.php

Importing

jimport( 'joomla.installer.installer' );

Source Body

function discover_install($eid=null)
{
        if ($eid)
        {
                $this->extension =& JTable::getInstance('extension');
                if (!$this->extension->load($eid))
                {
                        $this->abort(JText::_('Failed to load extension details'));
                        return false;
                }
                if ($this->extension->state != -1)
                {
                        $this->abort(JText::_('Extension is already installed'));
                        return false;
                }
 
                // Lazy load the adapter
                if (!isset($this->_adapters[$this->extension->type]) || !is_object($this->_adapters[$this->extension->type]))
                {
                        if (!$this->setAdapter($this->extension->type)) {
                                return false;
                        }
                }
 
                if (is_object($this->_adapters[$this->extension->type]))
                {
                        if (method_exists($this->_adapters[$this->extension->type], 'discover_install'))
                        {
                                // Fire the onBeforeExtensionInstall event.
                                JPluginHelper::importPlugin('installer');
                                $dispatcher =& JDispatcher::getInstance();
                                $dispatcher->trigger('onBeforeExtensionInstall', array('method'=>'discover_install', 'type'=>$this->extension->get('type'), 'manifest'=>null, 'extension'=>$this->extension->get('extension_id')));
 
                                // Run the install
                                $result = $this->_adapters[$this->extension->type]->discover_install();
                                // Fire the onAfterExtensionInstall
                                $dispatcher->trigger('onAfterExtensionInstall', array('installer'=>clone $this, 'eid'=> $result));
                                if ($result !== false) return true; else return false;
                        }
                        else
                        {
                                $this->abort(JText::_('Method not supported for this extension type'));
                                return false;
                        }
                }
                return false;
        }
        else
        {
                $this->abort(JText::_('Extension is not a valid'));
                return false;
        }
}

[Edit See Also] SeeAlso:JInstaller/discover install

Examples

<CodeExamplesForm />