API16

JInstaller/uninstall: Difference between revisions

From Joomla! Documentation

m clean up
m preparing for archive only
 
Line 67: Line 67:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=uninstall
  category=uninstall
  category=JInstaller
  category=JInstaller
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 01:49, 25 March 2017

Description

Package uninstallation method


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

Syntax

uninstall($type, $identifier, $cid=0)
Parameter Name Default Value Description
$type $type Package type
$identifier $identifier Package identifier for adapter
$cid 0 $cid Application ID; deprecated in 1.6

Returns

boolean True if successful

Defined in

libraries/joomla/installer/installer.php

Importing

jimport( 'joomla.installer.installer' );

Source Body

public function uninstall($type, $identifier, $cid=0)
{
        if (!isset($this->_adapters[$type]) || !is_object($this->_adapters[$type]))
        {
                if (!$this->setAdapter($type)) {
                        return false; // we failed to get the right adapter
                }
        }
        if (is_object($this->_adapters[$type]))
        {
                // We don't load languages here, we get the extension adapter to work it out
                // Fire the onBeforeExtensionUninstall event.
                JPluginHelper::importPlugin('installer');
                $dispatcher =& JDispatcher::getInstance();
                $dispatcher->trigger('onBeforeExtensionUninstall', array('eid' => $identifier));
                // Run the uninstall
                $result = $this->_adapters[$type]->uninstall($identifier);
                // Fire the onAfterExtensionInstall
                $dispatcher->trigger('onAfterExtensionUninstall', array('installer'=>clone $this, 'eid'=> $identifier, 'result' => $result));
                return $result;
        }
        return false;
}


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

Examples

Code Examples