Difference between revisions of "JInstallerFile/extensionExistsInSystem"
From Joomla! Documentation
< API16:JInstallerFile
(New page: ===Description===
function used to check if extension is already installed
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JInstallerFile/extensionEx...) |
m (preparing for archive only) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
function used to check if extension is already installed | function used to check if extension is already installed | ||
− | |||
− | |||
− | |||
− | + | ||
+ | <! removed transcluded page call, red link never existed > | ||
===Syntax=== | ===Syntax=== | ||
Line 62: | Line 60: | ||
</source> | </source> | ||
− | + | ||
− | + | <! removed transcluded page call, red link never existed > | |
− | < | ||
− | |||
===Examples=== | ===Examples=== | ||
− | + | === Code Examples === | |
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=extensionExistsInSystem | category=extensionExistsInSystem | ||
category=JInstallerFile | category=JInstallerFile | ||
− | + | namespace=CodeExample | |
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API16]] |
Latest revision as of 20:49, 24 March 2017
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
function used to check if extension is already installed
<! removed transcluded page call, red link never existed >
Syntax[edit]
extensionExistsInSystem($name=null)
Parameter Name | Default Value | Description |
---|---|---|
$name | null | $name The name of the extension to install |
Returns[edit]
boolean True if extension exists
Defined in[edit]
libraries/joomla/installer/adapters/file.php
Importing[edit]
jimport( 'joomla.installer.adapters.file' );
Source Body[edit]
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 transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]