Actions

API15

JInstaller/update

From Joomla! Documentation

< API15:JInstaller
Revision as of 16:23, 22 March 2010 by Doxiki (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

[Edit Descripton]

Description:JInstaller/update

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

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'));
        }
 
        /*
         * LEGACY CHECK
         */
        $root           =& $this->_manifest->document;
        $version        = $root->attributes('version');
        $rootName       = $root->name();
        $config         = &JFactory::getConfig();
        if ((version_compare($version, '1.5', '<') || $rootName == 'mosinstall') && !$config->getValue('config.legacy')) {
                return $this->abort(JText::_('MUSTENABLELEGACY'));
        }
 
        $type = $root->attributes('type');
 
        // Needed for legacy reasons ... to be deprecated in next minor release
        if ($type == 'mambot') {
                $type = 'plugin';
        }
 
        if (is_object($this->_adapters[$type])) {
                return $this->_adapters[$type]->update();
        }
        return false;
}

[Edit See Also] SeeAlso:JInstaller/update

Examples

<CodeExamplesForm />