PEAR_Config::getDefaultConfigFiles PHP Method

getDefaultConfigFiles() public method

Return the default locations of user and system configuration files
    function getDefaultConfigFiles()
    {
        $sl = DIRECTORY_SEPARATOR;
        if (OS_WINDOWS) {
            return array('user' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini', 'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pearsys.ini');
        }
        return array('user' => getenv('HOME') . $sl . '.pearrc', 'system' => PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.conf');
    }

Usage Example

Beispiel #1
0
        $i++;
    } elseif ($arg == '-T' || $arg == '--test') {
        $test_dir = $argv[$i + 1];
        $i++;
    } elseif ($arg == '--debug') {
        $debug = 1;
    } elseif ($arg == '--extremedebug') {
        $debug = 2;
    } elseif ($arg == '-M' || $arg == '--man') {
        $man_dir = $argv[$i + 1];
        $i++;
    }
}
$config = PEAR_Config::singleton();
if (PEAR::isError($config)) {
    $locs = PEAR_Config::getDefaultConfigFiles();
    die("ERROR: One of {$locs['user']} or {$locs['system']} is corrupt, please remove them and try again");
}
// make sure we use only default values
$config_layers = $config->getLayers();
foreach ($config_layers as $layer) {
    if ($layer == 'default') {
        continue;
    }
    $config->removeLayer($layer);
}
$keys = $config->getKeys();
if ($debug) {
    $config->set('verbose', 5, 'default');
} else {
    $config->set('verbose', 0, 'default');