本文整理汇总了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();
}