API16

API16:JInstallerLanguage/discover install

From Joomla! Documentation

Revision as of 22:49, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Custom discover install method Basically updates the manifest cache and leaves everything alone <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Custom discover install method Basically updates the manifest cache and leaves everything alone

[Edit Descripton]

Template:Description:JInstallerLanguage/discover install

Syntax

discover_install()


Defined in

libraries/joomla/installer/adapters/language.php

Importing

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

Source Body

function discover_install()
{
        // Need to find to find where the XML file is since we don't store this normally
        $client = JApplicationHelper::getClientInfo($this->parent->extension->client_id);
        $short_element = $this->parent->extension->element;
        $manifestPath = $client->path . DS . 'language'. DS . $short_element . DS . $short_element . '.xml';
        $this->parent->manifest = $this->parent->isManifest($manifestPath);
        $this->parent->setPath('manifest', $manifestPath);
        $this->parent->setPath('source', $client->path . DS . 'language'. DS . $short_element);
        $this->parent->setPath('extension_root', $this->parent->getPath('source'));
        $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();
        try {
                $this->parent->extension->store();
        }
        catch(JException $e)
        {
                JError::raiseWarning(101, JText::_('Language').' '.JText::_('Discover Install').': '.JText::_('Failed to store extension details'));
                return false;
        }
        return $this->parent->extension->get('extension_id');
}

[Edit See Also] Template:SeeAlso:JInstallerLanguage/discover install

Examples

<CodeExamplesForm />