API16

JInstaller/abort

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]

Installation abort method


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

Syntax[edit]

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[edit]

boolean True if successful

Defined in[edit]

libraries/joomla/installer/installer.php

Importing[edit]

jimport( 'joomla.installer.installer' );

Source Body[edit]

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;
}


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

Examples[edit]

Code Examples[edit]