Actions

API16

JInstallerFile/extensionExistsInSystem

From Joomla! Documentation

< API16:JInstallerFile
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

function used to check if extension is already installed

[<! removed edit link to red link >]

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

Syntax

extensionExistsInSystem($name=null)
Parameter Name Default Value Description
$name null $name The name of the extension to install

Returns

boolean True if extension exists

Defined in

libraries/joomla/installer/adapters/file.php

Importing

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

Source Body

private function extensionExistsInSystem($name = null)
{
 
        // Get a database connector object
        $db =& $this->parent->getDBO();
 
        $query = 'SELECT `extension_id`' .
                        ' FROM `#__extensions`' .
                        ' WHERE name = '.$db->Quote($name) .
                        ' AND type = "file"';
 
        $db->setQuery($query);
 
        try {
                $db->Query();
        } catch(JException $e) {
                // Install failed, roll back changes
                $this->parent->abort(JText::_('Files').' '.JText::_($this->route).': '.$db->stderr(true));
                return false;
        }
        $id = $db->loadResult();
 
        if (empty($id))
        return false;
 
        return true;
 
}

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

Examples

<CodeExamplesForm />