Actions

API16

JInstaller/abort

From Joomla! Documentation

< API16:JInstaller
Revision as of 17:53, 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

Installation abort method

[Edit Descripton]

Description:JInstaller/abort

Syntax

abort($msg=null, $type=null)
Parameter Name Default Value Description
$msg null $msg Abort message from the installer
$type null $type Package type if defined

Returns

boolean True if successful

Defined in

libraries/joomla/installer/installer.php

Importing

jimport( 'joomla.installer.installer' );

Source Body

public function abort($msg=null, $type=null)
{
        // Initialise variables.
        $retval = true;
        $step = array_pop($this->_stepStack);
 
        // Raise abort warning
        if ($msg) {
                JError::raiseWarning(100, $msg);
        }
 
        while ($step != null)
        {
                switch ($step['type'])
                {
                        case 'file' :
                                // remove the file
                                $stepval = JFile::delete($step['path']);
                                break;
 
                        case 'folder' :
                                // remove the folder
                                $stepval = JFolder::delete($step['path']);
                                break;
 
                        case 'query' :
                                // placeholder in case this is necessary in the future
                                break;
 
                        case 'extension' :
                                // Get database connector object
                                $db =& $this->getDBO();
 
                                // Remove the entry from the #__extensions table
                                $query = 'DELETE' .
                                                ' FROM `#__extensions`' .
                                                ' WHERE extension_id = '.(int)$step['id'];
                                $db->setQuery($query);
                                $stepval = $db->Query();
                                break;
 
                        default :
                                if ($type && is_object($this->_adapters[$type])) {
                                        // Build the name of the custom rollback method for the type
                                        $method = '_rollback_'.$step['type'];
                                        // Custom rollback method handler
                                        if (method_exists($this->_adapters[$type], $method)) {
                                                $stepval = $this->_adapters[$type]->$method($step);
                                        }
                                } else {
                                        $stepval = false; // set it to false
                                }
                                break;
                }
 
                // Only set the return value if it is false
                if ($stepval === false) {
                        $retval = false;
                }
 
                // Get the next step and continue
                $step = array_pop($this->_stepStack);
        }
 
        return $retval;
}

[Edit See Also] SeeAlso:JInstaller/abort

Examples

<CodeExamplesForm />