/**
* Method to finalise the uninstallation processing
*
* @return boolean
*
* @since 4.0.0
* @throws \RuntimeException
*/
protected function finaliseUninstall() : bool
{
$db = $this->parent->getDbo();
// Remove the schema version
$query = $db->getQuery(true)->delete($db->quoteName('#__schemas'))->where($db->quoteName('extension_id') . ' = :extension_id')->bind(':extension_id', $this->extension->extension_id, ParameterType::INTEGER);
$db->setQuery($query);
$db->execute();
// Clobber any possible pending updates
$update = Table::getInstance('update');
$uid = $update->find(['element' => $this->extension->element, 'type' => $this->type]);
if ($uid) {
$update->delete($uid);
}
File::delete(JPATH_MANIFESTS . '/packages/' . $this->extension->element . '.xml');
$folder = $this->parent->getPath('extension_root');
if (Folder::exists($folder)) {
Folder::delete($folder);
}
$this->extension->delete();
return true;
}