Actions

API16

JInstallerLibrary/discover install

From Joomla! Documentation

< API16:JInstallerLibrary
Revision as of 22:01, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
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

[<! removed edit link to red link >]

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

Syntax

discover_install()


Returns

void

Defined in

libraries/joomla/installer/adapters/library.php

Importing

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

Source Body

function discover_install()
{
        /* Libraries are a strange beast, they are actually references to files
         * There are two parts to a library which are disjunct in their locations
         * 1) The manifest file (stored in /JPATH_MANIFESTS/libraries)
         * 2) The actual files (stored in /JPATH_LIBRARIES/libraryname)
         * Thus installation of a library is the process of dumping files
         * in two different places. As such it is impossible to perform
         * any operation beyond mere registration of a library under the presumption
         * that the files exist in the appropriate location so that come uninstall
         * time they can be adequately removed.
         */
 
        $manifestPath = JPATH_MANIFESTS . DS . 'libraries' . 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 true;
        }
        else
        {
                JError::raiseWarning(101, JText::_('Plugin').' '.JText::_('Discover Install').': '.JText::_('Failed to store extension details'));
                return false;
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />