Re: Re: Another patch for PEAR/Command/Installer.php

From: Date: Sat, 20 Apr 2002 23:08:58 +0000
Subject: Re: Re: Another patch for PEAR/Command/Installer.php
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-5697@lists.php.net to get a copy of this message
On Sat, 2002-04-20 at 19:38, Tomas V.V.Cox wrote: > "Stig S. Bakken" wrote: > > > > 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"); > > > } > > > } > > > > > System::rm('-r ' . implode(' ', $filelist)); No, that may remove files unrelated to the package being uninstalled. The rmdir hack is fine. - Stig

« previous php.pear.dev (#5697) next »