API16:JInstallerPlugin/discover install
From Joomla! Documentation
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
Custom discover_install method
Description:JInstallerPlugin/discover install
Syntax
discover_install()
Returns
void
Defined in
libraries/joomla/installer/adapters/plugin.php
Importing
jimport( 'joomla.installer.adapters.plugin' );
Source Body
function discover_install() { // Plugins use the extensions table as their primary store // Similar to modules and templates, rather easy // If its not in the extensions table we just add it $client = JApplicationHelper::getClientInfo($this->parent->extension->client_id); if (is_dir($client->path . DS . 'plugins'. DS . $this->parent->extension->folder . DS . $this->parent->extension->element)) { $manifestPath = $client->path . DS . 'plugins'. DS . $this->parent->extension->folder . DS . $this->parent->extension->element . DS . $this->parent->extension->element . '.xml'; } else { $manifestPath = $client->path . DS . 'plugins'. DS . $this->parent->extension->folder . DS . $this->parent->extension->element . '.xml'; } $this->parent->manifest = $this->parent->isManifest($manifestPath); $this->parent->setPath('manifest', $manifestPath); $manifest_details = JApplicationHelper::parseXMLInstallFile($this->parent->getPath('manifest')); $this->parent->extension->manifest_cache = serialize($manifest_details); $this->parent->extension->state = 0; $this->parent->extension->name = $manifest_details['name']; $this->parent->extension->enabled = 1; $this->parent->extension->params = $this->parent->getParams(); if ($this->parent->extension->store()) { return $this->parent->extension->get('extension_id'); } else { JError::raiseWarning(101, JText::_('Plugin').' '.JText::_('Discover Install').': '.JText::_('Failed to store extension details')); return false; } }
[Edit See Also] SeeAlso:JInstallerPlugin/discover install
Examples
<CodeExamplesForm />
