summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2003-08-13 21:16:31 +0000
committerGreg Beaver <cellog@php.net>2003-08-13 21:16:31 +0000
commitbaba5432c9a1aa7e0c9b12dde1cc2830db08054c (patch)
tree9dc339c560a9626ed5e9503e179550f312120fdf
parentf7a70ccc132d013c6db4f5f6b2030b675070b5ae (diff)
downloadphp-git-baba5432c9a1aa7e0c9b12dde1cc2830db08054c.tar.gz
fix uninstall for optional dependencies, bug #25080
-rw-r--r--pear/PEAR/Dependency.php9
-rw-r--r--pear/PEAR/Installer.php9
2 files changed, 15 insertions, 3 deletions
diff --git a/pear/PEAR/Dependency.php b/pear/PEAR/Dependency.php
index 37afd71a36..370270aa71 100644
--- a/pear/PEAR/Dependency.php
+++ b/pear/PEAR/Dependency.php
@@ -151,11 +151,12 @@ class PEAR_Dependency
* Check package dependencies on uninstall
*
* @param string $error The resultant error string
+ * @param string $warning The resultant warning string
* @param string $name Name of the package to test
*
* @return bool true if there were errors
*/
- function checkPackageUninstall(&$error, $package)
+ function checkPackageUninstall(&$error, &$warning, $package)
{
$error = null;
$packages = $this->registry->listPackages();
@@ -169,7 +170,11 @@ class PEAR_Dependency
}
foreach ($deps as $dep) {
if ($dep['type'] == 'pkg' && strcasecmp($dep['name'], $package) == 0) {
- $error .= "Package '$pkg' depends on '$package'\n";
+ if (isset($dep['optional']) && $dep['optional'] == 'yes') {
+ $warning .= "\nWarning: Package '$pkg' optionally depends on '$package'";
+ } else {
+ $error .= "Package '$pkg' depends on '$package'\n";
+ }
}
}
}
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
index 416fab9991..577973dff6 100644
--- a/pear/PEAR/Installer.php
+++ b/pear/PEAR/Installer.php
@@ -774,12 +774,19 @@ class PEAR_Installer extends PEAR_Common
$this->installroot = '';
}
$this->registry = &new PEAR_Registry($php_dir);
+ $filelist = $this->registry->packageInfo($package, 'filelist');
+ if ($filelist == null) {
+ return $this->raiseError("$package not installed");
+ }
if (empty($options['nodeps'])) {
$depchecker = &new PEAR_Dependency($this->registry);
- $error = $depchecker->checkPackageUninstall($errors, $package);
+ $error = $depchecker->checkPackageUninstall($errors, $warning, $package);
if ($error) {
return $this->raiseError($errors . 'uninstall failed');
}
+ if ($warning) {
+ $this->log(0, $warning);
+ }
}
// Delete the files
if (PEAR::isError($err = $this->_deletePackageFiles($package))) {