Bug #25080 [Com]: packages with optional dependencies can't be uninstalled

From: Date: Wed, 01 Sep 2021 18:51:09 +0000
Subject: Bug #25080 [Com]: packages with optional dependencies can't be uninstalled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236305@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=25080&edit=1 ID: 25080 Comment by: lildurk25080 at gmail dot com Reported by: cellog@php.net Summary: packages with optional dependencies can't be uninstalled Status: Closed Type: Bug Package: PEAR related Operating System: na PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Lil Durk is a private agency dedicated to providing responsible access to legal cannabis for adults aged 19 and older. We’re an exclusively online retailer and wholesaler for recreational cannabis and a trusted source for information about cannabis and cannabis-related issues. We believe our work is meaningful and we take pride in our mandate to promote the socially responsible use of legal cannabis. https://lildurk.com/ Previous Comments: ------------------------------------------------------------------------ [2003-08-13 16:16:33] cellog@php.net This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Forgot this additional patch to Installer.php Index: pear/PEAR/Installer.php =================================================================== RCS file: /repository/php-src/pear/PEAR/Installer.php,v retrieving revision 1.95 diff -u -r1.95 Installer.php --- pear/PEAR/Installer.php 5 Aug 2003 14:31:15 -0000 1.95 +++ pear/PEAR/Installer.php 13 Aug 2003 21:15:46 -0000 @@ -774,11 +774,18 @@ $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 ------------------------------------------------------------------------ [2003-08-13 16:14:07] cellog@php.net Description: ------------ if a package has an optional dependency, it can't be uninstalled if the optional dependency is installed. This patch fixes that Index: pear/PEAR/Dependency.php =================================================================== RCS file: /repository/php-src/pear/PEAR/Dependency.php,v retrieving revision 1.23 diff -u -r1.23 Dependency.php --- pear/PEAR/Dependency.php 3 Aug 2003 13:44:36 -0000 1.23 +++ pear/PEAR/Dependency.php 13 Aug 2003 21:13:31 -0000 @@ -151,11 +151,12 @@ * 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 @@ } 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"; + } } } } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=25080&edit=1

« previous php.bugs (#236305) next »