/**
* Method to do any prechecks and setup the uninstall job
*
* @return void
*
* @since 4.0.0
*/
protected function setupUninstall()
{
// Get the admin and site paths for the component
$this->parent->setPath('extension_administrator', Path::clean(JPATH_ADMINISTRATOR . '/components/' . $this->extension->element));
$this->parent->setPath('extension_api', Path::clean(JPATH_API . '/components/' . $this->extension->element));
$this->parent->setPath('extension_site', Path::clean(JPATH_SITE . '/components/' . $this->extension->element));
// Copy the admin path as it's used as a common base
$this->parent->setPath('extension_root', $this->parent->getPath('extension_administrator'));
// Find and load the XML install file for the component
$this->parent->setPath('source', $this->parent->getPath('extension_administrator'));
// Get the package manifest object
// We do findManifest to avoid problem when uninstalling a list of extension: getManifest cache its manifest file
$this->parent->findManifest();
$this->setManifest($this->parent->getManifest());
if (!$this->getManifest()) {
// Make sure we delete the folders if no manifest exists
Folder::delete($this->parent->getPath('extension_administrator'));
Folder::delete($this->parent->getPath('extension_api'));
Folder::delete($this->parent->getPath('extension_site'));
// Remove the menu
$this->_removeAdminMenus($this->extension->extension_id);
// Raise a warning
throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_COMP_UNINSTALL_ERRORREMOVEMANUALLY'));
}
// Attempt to load the admin language file; might have uninstall strings
$this->loadLanguage(JPATH_ADMINISTRATOR . '/components/' . $this->extension->element);
}