Back to InstallerAdapter class

Method canUninstallPackageChild

protected bool
canUninstallPackageChild
(mixed $packageId)
Check if a package extension allows its child extensions to be uninstalled individually
Parameters
  • int $packageId The extension ID of the package to check
Returns
  • bool
Since
  • 3.7.0
-
  • This method defaults to true to emulate the behavior of 3.6 and earlier which did not support this lookup

Method canUninstallPackageChild - Source code

/**
 * Check if a package extension allows its child extensions to be uninstalled individually
 *
 * @param   integer  $packageId  The extension ID of the package to check
 *
 * @return  boolean
 *
 * @since   3.7.0
 * @note    This method defaults to true to emulate the behavior of 3.6 and earlier which did not support this lookup
 */
protected function canUninstallPackageChild($packageId)
{
    $package = Table::getInstance('extension');
    // If we can't load this package ID, we have a corrupt database
    if (!$package->load((int) $packageId)) {
        return true;
    }
    $manifestFile = JPATH_MANIFESTS . '/packages/' . $package->element . '.xml';
    $xml = $this->parent->isManifest($manifestFile);
    // If the manifest doesn't exist, we've got some major issues
    if (!$xml) {
        return true;
    }
    $manifest = new PackageManifest($manifestFile);
    return $manifest->blockChildUninstall === false;
}