API16

JInstallerLibrary/update

From Joomla! Documentation

< API16:JInstallerLibrary
Revision as of 22:02, 13 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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]

Custom update method public boolean True on success 1.5


[<! removed edit link to red link >]

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

Syntax[edit]

update()


Returns[edit]

boolean True on success

Defined in[edit]

libraries/joomla/installer/adapters/library.php

Importing[edit]

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

Source Body[edit]

function update()
{
        // since this is just files, an update removes old files
        // Get the extension manifest object
        $this->manifest = $this->parent->getManifest();

        // Set the extensions name
        $name = (string)$this->manifest->name;
        $name = JFilterInput::getInstance()->clean($name, 'string');
        $element = str_replace('.xml','',basename($this->parent->getPath('manifest')));
        $this->set('name', $name);
        $this->set('element', $element);
        $installer = new JInstaller(); // we don't want to compromise this instance!
        $db = &$this->parent->getDbo();
        $db->setQuery('SELECT extension_id FROM #__extensions WHERE type="library" AND element = "'. $element .'"');
        $result = $db->loadResult();
        if ($result) {
                // already installed, which would make sense
                $installer->uninstall('library', $result);
        }
        // now create the new files
        return $this->install();
}

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

Examples[edit]

<CodeExamplesForm />