Actions

API16

JInstallerLanguage/install

From Joomla! Documentation

< API16:JInstallerLanguage
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 install method Note: This behaves badly due to hacks made in the middle of 1.5.x to add the ability to install multiple distinct packs in one install. The preferred method is to use a package to install multiple language packs.

[<! removed edit link to red link >]

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

Syntax

install()


Returns

boolean True on success

Defined in

libraries/joomla/installer/adapters/language.php

Importing

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

Source Body

public function install()
{
        $this->manifest = $this->parent->getManifest();
        $root = &$this->manifest->document;
 
        // Get the client application target
        if ((string)$this->manifest->attributes()->client == 'both')
        {
                JError::raiseWarning(42, JText::_('Instr_Error_Deprecated_format'));
                $element = $this->manifest->site->files;
                if (!$this->_install('site', JPATH_SITE, 0, $element)) {
                        return false;
                }
 
                $element = $this->manifest->administration->files;
                if (!$this->_install('administrator', JPATH_ADMINISTRATOR, 1, $element)) {
                        return false;
                }
                // This causes an issue because we have two eid's, *sigh* nasty hacks!
                return true;
        }
        elseif ($cname = (string)$this->manifest->attributes()->client)
        {
                // Attempt to map the client to a base path
                jimport('joomla.application.helper');
                $client = &JApplicationHelper::getClientInfo($cname, true);
                if ($client === null) {
                        $this->parent->abort(JText::sprintf('Instr_Abort', JText::sprintf('Instr_Error_Unknown_client_type', $cname)));
                        return false;
                }
                $basePath = $client->path;
                $clientId = $client->id;
                $element = $this->manifest->files;
 
                return $this->_install($cname, $basePath, $clientId, $element);
        }
        else
        {
                // No client attribute was found so we assume the site as the client
                $cname = 'site';
                $basePath = JPATH_SITE;
                $clientId = 0;
                $element = $this->manifest->files;
 
                return $this->_install($cname, $basePath, $clientId, $element);
        }
}

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

Examples

<CodeExamplesForm />