API16

JInstaller/update

From Joomla! Documentation

< API16:JInstaller

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]

Package update method


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

Syntax[edit]

update($path=null)
Parameter Name Default Value Description
$path null $path Path to package source folder

Returns[edit]

boolean True if successful

Defined in[edit]

libraries/joomla/installer/installer.php

Importing[edit]

jimport( 'joomla.installer.installer' );

Source Body[edit]

public function update($path=null)
{
        if ($path && JFolder::exists($path)) {
                $this->setPath('source', $path);
        }
        else {
                $this->abort(JText::_('Update path does not exist'));
        }

        if (!$this->setupInstall()) {
                return $this->abort(JText::_('Unable to detect manifest file'));
        }

        $type = (string)$this->manifest->attributes()->type;

        if (is_object($this->_adapters[$type]))
        {
                // Add the languages from the package itself
                if (method_exists($this->_adapters[$type], 'loadLanguage'))
                {
                        $this->_adapters[$type]->loadLanguage($path);
                }
                // Fire the onBeforeExtensionUpdate event.
                JPluginHelper::importPlugin('installer');
                $dispatcher =& JDispatcher::getInstance();
                $dispatcher->trigger('onBeforeExtensionUpdate', array('type'=>$type, 'manifest'=>$this->manifest));
                // Run the update
                $result = $this->_adapters[$type]->update();
                // Fire the onAfterExtensionUpdate
                $dispatcher->trigger('onAfterExtensionUpdate', array('installer'=>clone $this, 'eid'=> $result));
                if ($result !== false) {
                        return true;
                }
                else {
                        return false;
                }
        }
        return false;
}


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

Examples[edit]

Code Examples[edit]