本文整理匯總了PHP中PEAR_Config::noRegistry方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_Config::noRegistry方法的具體用法?PHP PEAR_Config::noRegistry怎麽用?PHP PEAR_Config::noRegistry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR_Config
的用法示例。
在下文中一共展示了PEAR_Config::noRegistry方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createConfig
private function createConfig($root, $pearConfDir)
{
$old = error_reporting(0);
$windows = $this->isWindows();
$ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
$root = preg_replace(array('!\\\\+!', '!/+!', "!{$ds2}+!"), array('/', '/', '/'), $root);
if ($root[0] != '/') {
if ($windows) {
throw new Exception('Root directory must be an absolute path beginning ' . 'with "/", was: "' . $root . '"');
}
if (!preg_match('/^[A-Za-z]:/', $root)) {
throw new Exception('Root directory must be an absolute path beginning ' . 'with "\\" or "C:\\", was: "' . $root . '"');
}
}
if ($windows) {
$root = str_replace('/', '\\', $root);
}
if (!file_exists($pearConfDir) && !@touch($pearConfDir)) {
throw new Exception('Could not create "' . $pearConfDir . '"');
}
$config = new PEAR_Config($pearConfDir, '#no#system#config#', false, false);
if ($root[strlen($root) - 1] == '/') {
$root = substr($root, 0, strlen($root) - 1);
}
$config->noRegistry();
$config->set('php_dir', $windows ? "{$root}" : "{$root}", 'user');
$config->set('data_dir', $windows ? "{$root}\\pear\\data" : "{$root}/data");
$config->set('www_dir', $windows ? "{$root}\\pear\\www" : "{$root}/pear/www");
$config->set('cfg_dir', $windows ? "{$root}\\pear\\cfg" : "{$root}/pear/cfg");
$config->set('ext_dir', $windows ? "{$root}\\pear\\ext" : "{$root}/pear/ext");
$config->set('doc_dir', $windows ? "{$root}\\pear\\docs" : "{$root}/pear/docs");
$config->set('test_dir', $windows ? "{$root}\\pear\\tests" : "{$root}/pear/tests");
$config->set('cache_dir', $windows ? "{$root}\\pear\\cache" : "{$root}/pear/cache");
$config->set('download_dir', $windows ? "{$root}\\pear\\download" : "{$root}/pear/download");
$config->set('temp_dir', $windows ? "{$root}\\pear\\temp" : "{$root}/pear/temp");
$config->set('bin_dir', $windows ? "{$root}\\" : "{$root}/");
$config->writeConfigFile();
error_reporting($old);
return $config;
}
示例2: doConfigCreate
function doConfigCreate($command, $options, $params)
{
if (count($params) != 2) {
return PEAR::raiseError('config-create: must have 2 parameters, root path and ' . 'filename to save as');
}
$root = $params[0];
// Clean up the DIRECTORY_SEPARATOR mess
$ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
$root = preg_replace(array('!\\\\+!', '!/+!', "!{$ds2}+!"), array('/', '/', '/'), $root);
if ($root[0] != '/') {
if (!isset($options['windows'])) {
return PEAR::raiseError('Root directory must be an absolute path beginning ' . 'with "/", was: "' . $root . '"');
}
if (!preg_match('/^[A-Za-z]:/', $root)) {
return PEAR::raiseError('Root directory must be an absolute path beginning ' . 'with "\\" or "C:\\", was: "' . $root . '"');
}
}
$windows = isset($options['windows']);
if ($windows) {
$root = str_replace('/', '\\', $root);
}
if (!file_exists($params[1]) && !@touch($params[1])) {
return PEAR::raiseError('Could not create "' . $params[1] . '"');
}
$params[1] = realpath($params[1]);
$config = new PEAR_Config($params[1], '#no#system#config#', false, false);
if ($root[strlen($root) - 1] == '/') {
$root = substr($root, 0, strlen($root) - 1);
}
$config->noRegistry();
$config->set('php_dir', $windows ? "{$root}\\pear\\php" : "{$root}/pear/php", 'user');
$config->set('data_dir', $windows ? "{$root}\\pear\\data" : "{$root}/pear/data");
$config->set('www_dir', $windows ? "{$root}\\pear\\www" : "{$root}/pear/www");
$config->set('cfg_dir', $windows ? "{$root}\\pear\\cfg" : "{$root}/pear/cfg");
$config->set('ext_dir', $windows ? "{$root}\\pear\\ext" : "{$root}/pear/ext");
$config->set('doc_dir', $windows ? "{$root}\\pear\\docs" : "{$root}/pear/docs");
$config->set('test_dir', $windows ? "{$root}\\pear\\tests" : "{$root}/pear/tests");
$config->set('cache_dir', $windows ? "{$root}\\pear\\cache" : "{$root}/pear/cache");
$config->set('download_dir', $windows ? "{$root}\\pear\\download" : "{$root}/pear/download");
$config->set('temp_dir', $windows ? "{$root}\\pear\\temp" : "{$root}/pear/temp");
$config->set('bin_dir', $windows ? "{$root}\\pear" : "{$root}/pear");
$config->writeConfigFile();
$this->_showConfig($config);
$this->ui->outputData('Successfully created default configuration file "' . $params[1] . '"', $command);
}
示例3: create
public function create()
{
$old = error_reporting(0);
$root = $this->root;
$configFile = $root . '/.pearrc';
$config = new \PEAR_Config($configFile, '#no#system#config#', false, false);
$config->noRegistry();
$config->set('php_dir', $root, 'user');
$config->set('data_dir', "{$root}/pear/data");
$config->set('www_dir', "{$root}/pear/www");
$config->set('cfg_dir', "{$root}/pear/cfg");
$config->set('ext_dir', "{$root}/pear/ext");
$config->set('doc_dir', "{$root}/pear/docs");
$config->set('test_dir', "{$root}/pear/tests");
$config->set('cache_dir', "{$root}/pear/cache");
$config->set('download_dir', "{$root}/pear/download");
$config->set('temp_dir', "{$root}/pear/temp");
$config->set('bin_dir', "{$root}/");
$config->writeConfigFile();
error_reporting($old);
$this->prepare();
}