API16

JInstallerTemplate/discover install

< API16:JInstallerTemplate

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

Perform an install from a discovered extension


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

Syntax

discover_install()


Defined in

libraries/joomla/installer/adapters/template.php

Importing

jimport( 'joomla.installer.adapters.template' );

Source Body

function discover_install()
{
        // Templates 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.'templates'.DS.$this->parent->extension->element.DS.'templateDetails.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::_('Template').' '.JText::_('Discover Install').': '.JText::_('Failed to store extension details'));
                return false;
        }
}


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

Examples

Code Examples


Advertisement