english/libraries/joomla/installer/adapters/package.php
/**
	 * Custom uninstall method
	 *
	 * @param	int		$id	The id of the package to uninstall
	 *
	 * @return	boolean	True on success
	 * @since	11.1
	 */
Custom uninstall method
@param       int             $id     The id of the package to uninstall

@return      boolean True on success
@since       11.1
Custom uninstall method @param int $id The id of the package to uninstall @return boolean True on success @since 11 . 1
function uninstall($id)
	{
		$row	= null;
		$retval = true;
		$row = JTable::getInstance('extension');
		$row->load($id);
		if ($row->protected) {
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_WARNCOREPACK'));
			return false;
		}
		$manifestFile = JPATH_MANIFESTS . '/packages/' . $row->get('element') .'.xml';
		$manifest = new JPackageManifest($manifestFile);
		$this->parent->setPath('extension_root', JPATH_MANIFESTS . '/packages/' . $manifest->packagename);
		if (!file_exists($manifestFile))
		{
						JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MISSINGMANIFEST'));
			return false;
		}
		$xml =JFactory::getXML($manifestFile);
		if (!$xml)
		{
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_LOAD_MANIFEST'));
			return false;
		}
		if ($xml->getName() != 'install' && $xml->getName() != 'extension')
		{
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_INVALID_MANIFEST'));
			return false;
		}
		$error = false;
		foreach ($manifest->filelist as $extension)
		{
			$tmpInstaller = new JInstaller();
			$id = $this->_getExtensionID($extension->type, $extension->id, $extension->client, $extension->group);
			$client = JApplicationHelper::getClientInfo($extension->client,true);
			if ($id)
			{
				if(!$tmpInstaller->uninstall($extension->type, $id, $client->id)) {
					$error = true;
					JError::raiseWarning(100, JText::sprintf('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_NOT_PROPER', basename($extension->filename)));
				}
			} else {
				JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION'));
			}
		}
		$this->parent->removeFiles($xml->languages);
		if (!$error) {
			JFile::delete($manifestFile);
			$row->delete();
		}
		else {
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MANIFEST_NOT_REMOVED'));
		}
		return $retval;
	}
function uninstall ( $ id ) { $ row = null ; $ retval = true ; $ row = JTable :: getInstance ( 'extension' ) ; $ row -> load ( $ id ) ; if ( $ row -> protected ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_PACK_UNINSTALL_WARNCOREPACK' ) ) ; return false ; } $ manifestFile = JPATH_MANIFESTS . '/packages/' . $ row -> get ( 'element' ) . '.xml' ; $ manifest = new JPackageManifest ( $ manifestFile ) ; $ this -> parent -> setPath ( 'extension_root' , JPATH_MANIFESTS . '/packages/' . $ manifest -> packagename ) ; if ( ! file_exists ( $ manifestFile ) ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MISSINGMANIFEST' ) ) ; return false ; } $ xml = JFactory :: getXML ( $ manifestFile ) ; if ( ! $ xml ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_PACK_UNINSTALL_LOAD_MANIFEST' ) ) ; return false ; } if ( $ xml -> getName ( ) != 'install' && $ xml -> getName ( ) != 'extension' ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_PACK_UNINSTALL_INVALID_MANIFEST' ) ) ; return false ; } $ error = false ; foreach ( $ manifest -> filelist as $ extension ) { $ tmpInstaller = new JInstaller ( ) ; $ id = $ this -> _getExtensionID ( $ extension -> type , $ extension -> id , $ extension -> client , $ extension -> group ) ; $ client = JApplicationHelper :: getClientInfo ( $ extension -> client , true ) ; if ( $ id ) { if ( ! $ tmpInstaller -> uninstall ( $ extension -> type , $ id , $ client -> id ) ) { $ error = true ; JError :: raiseWarning ( 100 , JText :: sprintf ( 'JLIB_INSTALLER_ERROR_PACK_UNINSTALL_NOT_PROPER' , basename ( $ extension -> filename ) ) ) ; } } else { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION' ) ) ; } } $ this -> parent -> removeFiles ( $ xml -> languages ) ; if ( ! $ error ) { JFile :: delete ( $ manifestFile ) ; $ row -> delete ( ) ; } else { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MANIFEST_NOT_REMOVED' ) ) ; } return $ retval ; }
Custom uninstall method
 @param       int             $id     The id of the package to uninstall
Custom uninstall method @param int $id The id of the package to uninstall
// Initialise variables. // Set the package root path // Because packages may not have their own folders we cannot use the standard method of finding an installation manifest // TODO: Fail?
 // If we cannot load the XML file return false /*
		 * Check for a valid XML root tag.
		 * @todo: Remove backwards compatability in a future version
		 * Should be 'extension', but for backward compatability we will accept 'install'.
		 */ // Remove any language files // clean up manifest file after we're done if there were no errors // Return the result up the line