Actions

API16

JInstaller/update

From Joomla! Documentation

< API16:JInstaller
Revision as of 22:00, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Package update method

[<! removed edit link to red link >]

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

Syntax

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

Returns

boolean True if successful

Defined in

libraries/joomla/installer/installer.php

Importing

jimport( 'joomla.installer.installer' );

Source Body

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 edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />