english/libraries/joomla/installer/adapters/language.php
/**
	 * Custom uninstall method
	 *
	 * @param   string   $tag		The tag of the language to uninstall
	 * @param   integer  $clientId	The id of the client (unused)
	 * @return  mixed    Return value for uninstall method in component uninstall file
	 * @since   11.1
	 */
Custom uninstall method
@param   string   $tag               The tag of the language to uninstall
@param   integer  $clientId  The id of the client (unused)
@return  mixed    Return value for uninstall method in component uninstall file
@since   11.1
Custom uninstall method @param string $tag The tag of the language to uninstall @param integer $clientId The id of the client ( unused ) @return mixed Return value for uninstall method in component uninstall file @since 11 . 1
public function uninstall($eid)
	{
		$extension = JTable::getInstance('extension');
		$extension->load($eid);
		$client = JApplicationHelper::getClientInfo($extension->get('client_id'));
		$element = $extension->get('element');
		if (empty($element))
		{
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_ELEMENT_EMPTY'));
			return false;
		}
		$protected  = $extension->get('protected');
		if ($protected == 1) {
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_PROTECTED'));
			return false;
		}
		$params = JComponentHelper::getParams('com_languages');
		if ($params->get($client->name)==$element) {
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DEFAULT'));
			return false;
		}
		$path = $client->path . '/language/' . $element;
		$this->parent->setPath('source', $path);
		$this->parent->findManifest();
		$this->manifest = $this->parent->getManifest();
		$this->parent->removeFiles($this->manifest->media);
		if (!JFolder::exists($path))
		{
			$extension->delete();
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_PATH_EMPTY'));
			return false;
		}
		if (!JFolder::delete($path))
		{
			JError::raiseWarning(100, JText::_('JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DIRECTORY'));
			return false;
		}
		$extension->delete();
		$db = JFactory::getDbo();
		$query=$db->getQuery(true);
		$query->from('#__users');
		$query->select('*');
		$db->setQuery($query);
		$users = $db->loadObjectList();
		if($client->name == 'administrator') {
			$param_name = 'admin_language';
		} else {
			$param_name = 'language';
		}
		$count = 0;
		foreach ($users as $user) {
			$registry = new JRegistry;
			$registry->loadString($user->params);
			if ($registry->get($param_name)==$element) {
				$registry->set($param_name,'');
				$query=$db->getQuery(true);
				$query->update('#__users');
				$query->set('params='.$db->quote($registry));
				$query->where('id='.(int)$user->id);
				$db->setQuery($query);
				$db->query();
				$count = $count + 1;
			}
		}
		if (!empty($count)) {
			JError::raiseNotice(500, JText::plural('JLIB_INSTALLER_NOTICE_LANG_RESET_USERS', $count));
		}
		return true;
	}
public function uninstall ( $ eid ) { $ extension = JTable :: getInstance ( 'extension' ) ; $ extension -> load ( $ eid ) ; $ client = JApplicationHelper :: getClientInfo ( $ extension -> get ( 'client_id' ) ) ; $ element = $ extension -> get ( 'element' ) ; if ( empty ( $ element ) ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_LANG_UNINSTALL_ELEMENT_EMPTY' ) ) ; return false ; } $ protected = $ extension -> get ( 'protected' ) ; if ( $ protected == 1 ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_LANG_UNINSTALL_PROTECTED' ) ) ; return false ; } $ params = JComponentHelper :: getParams ( 'com_languages' ) ; if ( $ params -> get ( $ client -> name ) == $ element ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DEFAULT' ) ) ; return false ; } $ path = $ client -> path . '/language/' . $ element ; $ this -> parent -> setPath ( 'source' , $ path ) ; $ this -> parent -> findManifest ( ) ; $ this -> manifest = $ this -> parent -> getManifest ( ) ; $ this -> parent -> removeFiles ( $ this -> manifest -> media ) ; if ( ! JFolder :: exists ( $ path ) ) { $ extension -> delete ( ) ; JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_LANG_UNINSTALL_PATH_EMPTY' ) ) ; return false ; } if ( ! JFolder :: delete ( $ path ) ) { JError :: raiseWarning ( 100 , JText :: _ ( 'JLIB_INSTALLER_ERROR_LANG_UNINSTALL_DIRECTORY' ) ) ; return false ; } $ extension -> delete ( ) ; $ db = JFactory :: getDbo ( ) ; $ query = $ db -> getQuery ( true ) ; $ query -> from ( '#__users' ) ; $ query -> select ( '*' ) ; $ db -> setQuery ( $ query ) ; $ users = $ db -> loadObjectList ( ) ; if ( $ client -> name == 'administrator' ) { $ param_name = 'admin_language' ; } else { $ param_name = 'language' ; } $ count = 0 ; foreach ( $ users as $ user ) { $ registry = new JRegistry ; $ registry -> loadString ( $ user -> params ) ; if ( $ registry -> get ( $ param_name ) == $ element ) { $ registry -> set ( $ param_name , '' ) ; $ query = $ db -> getQuery ( true ) ; $ query -> update ( '#__users' ) ; $ query -> set ( 'params=' . $ db -> quote ( $ registry ) ) ; $ query -> where ( 'id=' . ( int ) $ user -> id ) ; $ db -> setQuery ( $ query ) ; $ db -> query ( ) ; $ count = $ count + 1 ; } } if ( ! empty ( $ count ) ) { JError :: raiseNotice ( 500 , JText :: plural ( 'JLIB_INSTALLER_NOTICE_LANG_RESET_USERS' , $ count ) ) ; } return true ; }
Custom uninstall method
 @param   string   $tag               The tag of the language to uninstall
 @param   integer  $clientId  The id of the client (unused)
 @return  mixed    Return value for uninstall method in component uninstall file
 @since   11.1
Custom uninstall method @param string $tag The tag of the language to uninstall @param integer $clientId The id of the client ( unused ) @return mixed Return value for uninstall method in component uninstall file @since 11 . 1
// Load up the extension details // Grab a copy of the client details // Check the element isn't blank to prevent nuking the languages directory...just in case // Check that the language is not protected, Normally en-GB. // verify that it's not the default language for that client // Construct the path from the client, the language and the extension element name // Get the package manifest object and remove media // We do findManifest to avoid problem when uninstalling a list of extension: getManifest cache its manifest file // Check it exists // If the folder doesn't exist lets just nuke the row as well and presume the user killed it for us // If deleting failed we'll leave the extension entry in tact just in case // Remove the extension table entry // Setting the language of users which have this language as the default language // All done!