english/libraries/joomla/installer/adapters/component.php
/**
	 * Method to remove admin menu references to a component
	 *
	 * @param   object  $component	Component table object
	 *
	 * @return  boolean  True if successful
	 * @since   11.1
	 */
Method to remove admin menu references to a component
@param   object  $component  Component table object

@return  boolean  True if successful
@since   11.1
Method to remove admin menu references to a component @param object $component Component table object @return boolean True if successful @since 11 . 1
protected function _removeAdminMenus(&$row)
	{
		$db		= $this->parent->getDbo();
		$table	= JTable::getInstance('menu');
		$id		= $row->extension_id;
		$query	= $db->getQuery(true);
		$query->select('id');
		$query->from('#__menu');
		$query->where('`client_id` = 1');
		$query->where('`component_id` = '.(int) $id);
		$db->setQuery($query);
		$ids = $db->loadColumn();
		if ($error = $db->getErrorMsg() || empty($ids)){
			JError::raiseWarning('', JText::_('JLIB_INSTALLER_ERROR_COMP_REMOVING_ADMIN_MENUS_FAILED'));
			if ($error && $error != 1) {
				JError::raiseWarning(100, $error);
			}
			return false;
		}
		else {
			foreach($ids as $menuid){
				if (!$table->delete((int) $menuid)) {
					$this->setError($table->getError());
					return false;
				}
			}
			$table->rebuild();
		}
		return true;
	}
protected function _removeAdminMenus ( & $ row ) { $ db = $ this -> parent -> getDbo ( ) ; $ table = JTable :: getInstance ( 'menu' ) ; $ id = $ row -> extension_id ; $ query = $ db -> getQuery ( true ) ; $ query -> select ( 'id' ) ; $ query -> from ( '#__menu' ) ; $ query -> where ( '`client_id` = 1' ) ; $ query -> where ( '`component_id` = ' . ( int ) $ id ) ; $ db -> setQuery ( $ query ) ; $ ids = $ db -> loadColumn ( ) ; if ( $ error = $ db -> getErrorMsg ( ) || empty ( $ ids ) ) { JError :: raiseWarning ( '' , JText :: _ ( 'JLIB_INSTALLER_ERROR_COMP_REMOVING_ADMIN_MENUS_FAILED' ) ) ; if ( $ error && $ error != 1 ) { JError :: raiseWarning ( 100 , $ error ) ; } return false ; } else { foreach ( $ ids as $ menuid ) { if ( ! $ table -> delete ( ( int ) $ menuid ) ) { $ this -> setError ( $ table -> getError ( ) ) ; return false ; } } $ table -> rebuild ( ) ; } return true ; }
Method to remove admin menu references to a component
 @param   object  $component  Component table object
Method to remove admin menu references to a component @param object $component Component table object
// Initialise Variables // Get the ids of the menu items // Check for error // Iterate the items to delete each one. // Rebuild the whole tree