cvs: php4 /pear/PEAR Config.php

From: Date: Fri, 21 Jun 2002 06:08:55 +0000
Subject: cvs: php4 /pear/PEAR Config.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4719@lists.php.net to get a copy of this message
ssb Fri Jun 21 02:08:55 2002 EDT Modified files: /php4/pear/PEAR Config.php Log: * bending over backwards to find sensible defaults Index: php4/pear/PEAR/Config.php diff -u php4/pear/PEAR/Config.php:1.31 php4/pear/PEAR/Config.php:1.32 --- php4/pear/PEAR/Config.php:1.31 Wed Jun 19 19:38:46 2002 +++ php4/pear/PEAR/Config.php Fri Jun 21 02:08:54 2002 @@ -16,7 +16,7 @@ // | Author: Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: Config.php,v 1.31 2002/06/19 23:38:46 cox Exp $ +// $Id: Config.php,v 1.32 2002/06/21 06:08:54 ssb Exp $ require_once 'PEAR.php'; @@ -38,9 +38,13 @@ PHP_BINDIR); define('PEAR_CONFIG_DEFAULT_DOCDIR', PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'docs'); -define('PEAR_CONFIG_DEFAULT_PHPDIR', -// PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib'); - PEAR_INSTALL_DIR); +if (@is_dir(PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib')) { + define('PEAR_CONFIG_DEFAULT_PHPDIR', + PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'lib'); +} else { + define('PEAR_CONFIG_DEFAULT_PHPDIR', + PEAR_INSTALL_DIR); +} define('PEAR_CONFIG_DEFAULT_DATADIR', PEAR_INSTALL_DIR.DIRECTORY_SEPARATOR.'data'); define('PEAR_CONFIG_DEFAULT_TESTDIR', @@ -48,13 +52,14 @@ if (@is_dir(PHP_SYSCONFDIR)) { define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR); } else { + // real bootstrapping nightmare if (OS_WINDOWS) { - if (@is_dir('c:\php')) { - define('PEAR_CONFIG_SYSCONFDIR', 'c:\php'); - } elseif (@is_dir('c:\php4')) { - define('PEAR_CONFIG_SYSCONFDIR', 'c:\php4'); - } elseif (@is_dir('c:\program files\php')) { - define('PEAR_CONFIG_SYSCONFDIR', 'c:\program files\php'); + if (@is_dir(PHP_CONFIG_FILE_PATH)) { + define('PEAR_CONFIG_SYSCONFDIR', PHP_CONFIG_FILE_PATH); + } elseif (@is_dir('c:\winnt') && @file_exists('c:\winnt\php.ini')) { + define('PEAR_CONFIG_SYSCONFDIR', 'c:\winnt'); + } elseif (@is_dir('c:\windows') && @file_exists('c:\windows\php.ini')) { + define('PEAR_CONFIG_SYSCONFDIR', 'c:\windows'); } } if (!defined('PEAR_CONFIG_SYSCONFDIR')) { @@ -240,16 +245,16 @@ $sl = DIRECTORY_SEPARATOR; if (empty($user_file)) { if (OS_WINDOWS) { - $user_file = PHP_SYSCONFDIR . $sl . 'pear.ini'; + $user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini'; } else { $user_file = getenv('HOME') . $sl . '.pearrc'; } } if (empty($system_file)) { if (OS_WINDOWS) { - $system_file = PHP_SYSCONFDIR . $sl . 'pearsys.ini'; + $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini'; } else { - $system_file = PHP_SYSCONFDIR . $sl . 'pear.conf'; + $system_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf'; } } $this->layers = array_keys($this->configuration);

« previous php.pear.cvs (#4719) next »