From 994c70ef20a4e9600902f5576c7627d9e367ccd0 Mon Sep 17 00:00:00 2001 From: "Tomas V.V.Cox" Date: Sun, 29 Jun 2003 17:44:29 +0000 Subject: [PATCH] - Workarround to the PEAR_INSTALL_DIR empty constant - Remove the layer in $reg->layers too --- pear/PEAR/Config.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pear/PEAR/Config.php b/pear/PEAR/Config.php index d162d705d3..44d23e2117 100644 --- a/pear/PEAR/Config.php +++ b/pear/PEAR/Config.php @@ -26,6 +26,11 @@ require_once 'System.php'; * @var object */ $GLOBALS['_PEAR_Config_instance'] = null; +if (!defined('PEAR_INSTALL_DIR') || !PEAR_INSTALL_DIR) { + $PEAR_INSTALL_DIR = PHP_LIBDIR . DIRECTORY_SEPARATOR . 'pear'; +} else { + $PEAR_INSTALL_DIR = PEAR_INSTALL_DIR; +} // Below we define constants with default values for all configuration // parameters except username/password. All of them can have their @@ -61,11 +66,11 @@ if (getenv('PHP_PEAR_HTTP_PROXY')) { if (getenv('PHP_PEAR_INSTALL_DIR')) { define('PEAR_CONFIG_DEFAULT_PHP_DIR', getenv('PHP_PEAR_INSTALL_DIR')); } else { - if (@is_dir(PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) { + if (@is_dir($PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) { define('PEAR_CONFIG_DEFAULT_PHP_DIR', - PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib'); + $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib'); } else { - define('PEAR_CONFIG_DEFAULT_PHP_DIR', PEAR_INSTALL_DIR); + define('PEAR_CONFIG_DEFAULT_PHP_DIR', $PEAR_INSTALL_DIR); } } @@ -89,7 +94,7 @@ if (getenv('PHP_PEAR_DOC_DIR')) { define('PEAR_CONFIG_DEFAULT_DOC_DIR', getenv('PHP_PEAR_DOC_DIR')); } else { define('PEAR_CONFIG_DEFAULT_DOC_DIR', - PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs'); + $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs'); } // Default for bin_dir @@ -104,7 +109,7 @@ if (getenv('PHP_PEAR_DATA_DIR')) { define('PEAR_CONFIG_DEFAULT_DATA_DIR', getenv('PHP_PEAR_DATA_DIR')); } else { define('PEAR_CONFIG_DEFAULT_DATA_DIR', - PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data'); + $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data'); } // Default for test_dir @@ -112,7 +117,7 @@ if (getenv('PHP_PEAR_TEST_DIR')) { define('PEAR_CONFIG_DEFAULT_TEST_DIR', getenv('PHP_PEAR_TEST_DIR')); } else { define('PEAR_CONFIG_DEFAULT_TEST_DIR', - PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests'); + $PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'tests'); } // Default for cache_dir @@ -1004,6 +1009,7 @@ class PEAR_Config extends PEAR { if (isset($this->configuration[$layer])) { unset($this->configuration[$layer]); + $this->layers = array_keys($this->configuration); return true; } return false; -- 2.50.1