cvs: php4 /pear/PEAR Registry.php
| From: | Tomas V.V.Cox | Date: | Mon, 23 Jun 2003 11:28:47 +0000 |
| Subject: | cvs: php4 /pear/PEAR Registry.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-11138@lists.php.net to get a copy of this message | ||
cox Mon Jun 23 07:28:47 2003 EDT
Modified files:
/php4/pear/PEAR Registry.php
Log:
Another fix to the case insensitive uninstall problem
Index: php4/pear/PEAR/Registry.php
diff -u php4/pear/PEAR/Registry.php:1.44 php4/pear/PEAR/Registry.php:1.45
--- php4/pear/PEAR/Registry.php:1.44 Mon Jun 23 01:23:20 2003
+++ php4/pear/PEAR/Registry.php Mon Jun 23 07:28:47 2003
@@ -18,7 +18,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Registry.php,v 1.44 2003/06/23 05:23:20 mj Exp $
+// $Id: Registry.php,v 1.45 2003/06/23 11:28:47 cox Exp $
/*
TODO:
@@ -98,6 +98,17 @@
$this->statedir = $pear_install_dir.$ds.'.registry';
$this->filemap = $pear_install_dir.$ds.'.filemap';
$this->lockfile = $pear_install_dir.$ds.'.lock';
+ // XXX Compatibility code should be removed in the future
+ // rename all registry files if any to lowercase
+ if (!OS_WINDOWS && $handle = opendir($this->statedir)) {
+ $dest = $this->statedir . DIRECTORY_SEPARATOR;
+ while (false !== ($file = readdir($handle))) {
+ if (preg_match('/^.*[A-Z].*\.reg$/', $file)) {
+ rename($dest . $file, $dest . strtolower($file));
+ }
+ }
+ closedir($handle);
+ }
if (!file_exists($this->filemap)) {
$this->rebuildFileMap();
}
@@ -155,24 +166,7 @@
*/
function _packageFileName($package)
{
- if (is_file("{$this->statedir}/{$package}.reg")) {
- return "{$this->statedir}/{$package}.reg";
- }
-
- /**
- * Iterate through the directory to find the matching
- * registry file, even if it has been provided in
- * another case (foobar vs. FooBar)
- */
- $package = strtolower($package);
- if ($handle = opendir($this->statedir)) {
- while (false !== ($file = readdir($handle))) {
- if (strtolower($file) == "{$package}.reg") {
- return "{$this->statedir}/{$file}";
- }
- }
- closedir($handle);
- }
+ return $this->statedir . DIRECTORY_SEPARATOR . strtolower($package) . '.reg';
}
// }}}