API16

JInstallerLanguage/uninstall

< API16:JInstallerLanguage

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

Custom uninstall method


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

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


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

Examples

Code Examples


Advertisement