Actions

API16

JInstallerLanguage/uninstall

From Joomla! Documentation

< API16:JInstallerLanguage
Revision as of 17:49, 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

Custom uninstall method

[Edit Descripton]

Description:JInstallerLanguage/uninstall

Syntax

uninstall($eid)
Parameter Name Default Value Description
$eid $tag The tag of the language to uninstall

Returns

mixed Return value for uninstall method in component uninstall file

Defined in

libraries/joomla/installer/adapters/language.php

Importing

jimport( 'joomla.installer.adapters.language' );

Source Body

public function uninstall($eid)
{
        // load up the extension details
        $extension = JTable::getInstance('extension');
        $extension->load($eid);
 
        // check the element isn't blank to prevent nuking the languages directory...just in case
        $element = $extension->get('element');
        if (empty($element))
        {
                JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Element is empty, cannot uninstall files'));
                return false;
        }
 
        // grab a copy of the client details
        $client = JApplicationHelper::getClientInfo($extension->get('client_id'));
        // construct the path from the client, the language and the extension element name
        $path = $client->path.DS.'language'.DS.$element;
 
        // check it exists
        if (!JFolder::exists($path))
        {
                JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Language path is empty, cannot uninstall files'));
                return false;
        }
 
        if (!JFolder::delete($path))
        {
                JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('UNABLE_TO_REMOVE_LANGUAGE_DIRECTORY'));
                return false;
        }
 
        // Remove the extension table entry
        $extension->delete();
 
        // All done!
        return true;
}

[Edit See Also] SeeAlso:JInstallerLanguage/uninstall

Examples

<CodeExamplesForm />