/**
* Method to do any prechecks and setup the uninstall job
*
* @return void
*
* @since 4.0.0
*/
protected function setupUninstall()
{
$manifestFile = JPATH_MANIFESTS . '/packages/' . $this->extension->element . '.xml';
$manifest = new PackageManifest($manifestFile);
// Set the package root path
$this->parent->setPath('extension_root', JPATH_MANIFESTS . '/packages/' . $manifest->packagename);
// Set the source path for compatibility with the API
$this->parent->setPath('source', $this->parent->getPath('extension_root'));
// Because packages may not have their own folders we cannot use the standard method of finding an installation manifest
if (!file_exists($manifestFile)) {
throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_MISSINGMANIFEST'));
}
$xml = simplexml_load_file($manifestFile);
if (!$xml) {
throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_LOAD_MANIFEST'));
}
// Check for a valid XML root tag.
if ($xml->getName() !== 'extension') {
throw new \RuntimeException(Text::_('JLIB_INSTALLER_ERROR_PACK_UNINSTALL_INVALID_MANIFEST'));
}
$this->setManifest($xml);
// Attempt to load the language file; might have uninstall strings
$this->loadLanguage(JPATH_SITE);
}