Re: Another patch for PEAR/Command/Installer.php
| From: | Stig S. Bakken | Date: | Sat, 20 Apr 2002 17:28:45 +0000 |
| Subject: | Re: Another patch for PEAR/Command/Installer.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5690@lists.php.net to get a copy of this message | ||
It's kinda crude, but it works. I'll apply it, thanks.
- Stig
On Sat, 2002-04-20 at 17:25, Martin Jansen wrote:
> Today it's PEAR patching day :). The attached patch removes
> the directory that contained the code, if it's empty, when
> uninstalling a package.
>
> What do you think of this?
>
> - Martin
>
> --
> Martin Jansen, <mail@martin-jansen.de>
> http://www.martin-jansen.de/
>
> ----
>
> Index: Installer.php
> ===================================================================
> RCS file: /repository/php4/pear/PEAR/Installer.php,v
> retrieving revision 1.48
> diff -u -r1.48 Installer.php
> --- Installer.php 13 Apr 2002 06:00:36 -0000 1.48
> +++ Installer.php 20 Apr 2002 15:20:10 -0000
> @@ -109,10 +109,10 @@
> }
> foreach ($filelist as $file => $props) {
> $path = $props['installed_as'];
> - // XXX TODO: do a "rmdir -p dirname($path)" to maintain clean the fs
> if (!@unlink($path)) {
> $this->log(2, "unable to delete: $path");
> } else {
> + @rmdir(dirname($path)); // Delete package directory if it's empty
> $this->log(2, "+ deleted file: $path");
> }
> }
>