1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00

Added checkPackageUninstall()

This commit is contained in:
Tomas V.V.Cox
2003-07-08 10:32:23 +00:00
parent dc0426652e
commit 0304ec19ff

View File

@@ -146,6 +146,35 @@ class PEAR_Dependency
return PEAR_DEPENDENCY_BAD_DEPENDENCY;
}
/**
* Check package dependencies on uninstall
*
* @param string $error The resultant error string
* @param string $name Name of the package to test
*
* @return bool true if there were errors
*/
function checkPackageUninstall(&$error, $package)
{
$error = null;
$packages = $this->registry->listPackages();
foreach ($packages as $pkg) {
if ($pkg == $package) {
continue;
}
$deps = $this->registry->packageInfo($pkg, 'release_deps');
if (empty($deps)) {
continue;
}
foreach ($deps as $dep) {
if ($dep['type'] == 'pkg' && strcasecmp($dep['name'], $package) == 0) {
$error .= "Package '$pkg' depends on '$package'\n";
}
}
}
return ($error) ? true : false;
}
/**
* Extension dependencies check method
*