JInstallerModule/discover install: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 50: | Line 50: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=discover_install | category=discover_install | ||
category=JInstallerModule | category=JInstallerModule | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:50, 25 March 2017
Description
Custom discover_install method
<! removed transcluded page call, red link never existed >
Syntax
discover_install()
Returns
void
Defined in
libraries/joomla/installer/adapters/module.php
Importing
jimport( 'joomla.installer.adapters.module' );
Source Body
function discover_install()
{
// Modules are like templates, and are one of the easiest
// If its not in the extensions table we just add it
$client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
$manifestPath = $client->path . DS . 'modules'. DS . $this->parent->extension->element . 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'));
// TODO: Re-evaluate this; should we run installation triggers? postflight perhaps?
$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::_('Module').' '.JText::_('Discover Install').': '.JText::_('Failed to store extension details'));
return false;
}
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples