Back to LanguageAdapter class

Method install

public bool|int
install
()
Custom install method
Returns
  • bool|int The extension ID on success, boolean false on failure
Since
  • 3.1

Method install - Source code

/**
 * 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.
 *
 * @return  boolean|integer  The extension ID on success, boolean false on failure
 *
 * @since   3.1
 */
public function install()
{
    $source = $this->parent->getPath('source');
    if (!$source) {
        $this->parent->setPath('source', ApplicationHelper::getClientInfo($this->parent->extension->client_id)->path . '/language/' . $this->parent->extension->element);
    }
    $this->setManifest($this->parent->getManifest());
    // Get the client application target
    if ($cname = (string) $this->getManifest()->attributes()->client) {
        // Attempt to map the client to a base path
        $client = ApplicationHelper::getClientInfo($cname, true);
        if ($client === null) {
            $this->parent->abort(Text::sprintf('JLIB_INSTALLER_ABORT', Text::sprintf('JLIB_INSTALLER_ERROR_UNKNOWN_CLIENT_TYPE', $cname)));
            return false;
        }
        $basePath = $client->path;
        $clientId = $client->id;
        $element = $this->getManifest()->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->getManifest()->files;
        return $this->_install($cname, $basePath, $clientId, $element);
    }
}