本文整理汇总了PHP中CB\Config::loadConfigFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::loadConfigFile方法的具体用法?PHP Config::loadConfigFile怎么用?PHP Config::loadConfigFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CB\Config
的用法示例。
在下文中一共展示了Config::loadConfigFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreateSolrConfigsetsSymlinks
public function testCreateSolrConfigsetsSymlinks()
{
$cfg = \CB\Config::loadConfigFile(\CB_DOC_ROOT . 'config.ini');
$result = \CB\Install\createSolrConfigsetsSymlinks($cfg);
$this->assertTrue($result['success'], ' creates symplink return errors');
$this->assertTrue(file_exists($result['links']['log']), 'solr logs configset symlink not created : ' . $result['links']['log']);
$this->assertTrue(file_exists($result['links']['default']), 'solr default configset symlink not created : ' . $result['links']['default']);
}
示例2: testcliLoadConfig
public function testcliLoadConfig()
{
$configFile = \UnitTest\Helpers::getConfigFilenameTPL();
$cfg = \CB\Install\cliLoadConfig(['config' => $configFile]);
$realConf = \CB\Config::loadConfigFile($configFile);
// test if loaded solr_port is equal with real solr_port
$this->assertEquals($cfg['solr_port'], $realConf['solr_port']);
$cfg = \CB\Install\cliLoadConfig(['config' => $configFile, 'solr_port' => 8180]);
$this->assertEquals($cfg['solr_port'], 8180);
$cfg = \CB\Install\cliLoadConfig(['config' => $configFile, 'su_db_pass' => '1234567', 'core_root_pass' => '1234567']);
$this->assertEquals($cfg['su_db_pass'], '1234567');
$this->assertEquals($cfg['core_root_pass'], '1234567');
$cfg = \CB\Install\cliLoadConfig(['su_db_pass' => '1234567', 'core_root_pass' => '1234567']);
$this->assertEquals($cfg['su_db_pass'], '1234567');
$this->assertEquals($cfg['core_root_pass'], '1234567');
}
示例3: cliLoadConfig
/**
* load config from CLI parameters and set respective FLAGS for install
* @param array $options
*/
function cliLoadConfig($options = null)
{
$cfg = null;
if (empty($options)) {
$options = cliGetAllOptions();
}
$configFile = cliGetConfigFile($options);
if (!empty($configFile) && file_exists($configFile)) {
$cfg = \CB\Config::loadConfigFile($configFile);
if (count($cfg)) {
\CB\Cache::set('RUN_SETUP_INTERACTIVE_MODE', false);
}
\CB\Cache::set('RUN_SETUP_CFG', $cfg);
if (isset($cfg['overwrite_create_backups']) && $cfg['overwrite_create_backups'] == 'n') {
\CB\Cache::set('RUN_SETUP_CREATE_BACKUPS', false);
} else {
\CB\Cache::set('RUN_SETUP_CREATE_BACKUPS', true);
}
} else {
\CB\Cache::set('RUN_SETUP_CREATE_BACKUPS', true);
}
//define working mode
if (!empty($cfg)) {
// define('CB\\CB\Cache::get('RUN_SETUP_INTERACTIVE_MODE')', false);
\CB\Cache::set('RUN_SETUP_INTERACTIVE_MODE', false);
// $cfg = $cfg + $options['config'];
} else {
\CB\Cache::set('RUN_SETUP_INTERACTIVE_MODE', true);
}
// initialize default values in cofig if not detected
$defaultValues = getDefaultConfigValues();
if (is_array($cfg)) {
$cfg = $cfg + $defaultValues;
} else {
$cfg = $defaultValues;
}
if (\CB\Util\checkKeyExists(array_keys($options), getParamPhrase())) {
foreach ($options as $OptKey => $OptValue) {
$cfg[$OptKey] = $OptValue;
}
}
return $cfg;
}
示例4: catch
// we include config_platform that will load config.ini if exist and will define $cfg variable
// If config.ini doesnt exist it wil raise an exception: Can't load config file
try {
require_once $cbHome . 'httpsdocs/config_platform.php';
} catch (\Exception $e) {
//config.ini could not exist
//we don't need to do anything here because this script will create confing.ini in result
//we just use values form config.ini as defaults, if it exists
}
// detect working mode (interactive or not)
if (empty($options)) {
$options = getopt('f:', array('file:'));
}
$configFile = empty($options['f']) ? @$options['file'] : $options['f'];
if (!empty($configFile) && file_exists($configFile)) {
$options['config'] = \CB\Config::loadConfigFile($configFile);
\CB\Cache::set('RUN_SETUP_CFG', $options['config']);
if (isset($options['config']['overwrite_create_backups']) && $options['config']['overwrite_create_backups'] == 'n') {
\CB\Cache::set('RUN_SETUP_CREATE_BACKUPS', false);
} else {
\CB\Cache::set('RUN_SETUP_CREATE_BACKUPS', true);
}
} else {
\CB\Cache::set('RUN_SETUP_CREATE_BACKUPS', true);
}
//define working mode
if (!empty($options['config'])) {
// define('CB\\CB\Cache::get('RUN_SETUP_INTERACTIVE_MODE')', false);
\CB\Cache::set('RUN_SETUP_INTERACTIVE_MODE', false);
// $cfg = $options['config'];
} else {
示例5: getCredentialUserData
public static function getCredentialUserData($username)
{
$data = ['username' => 'root', 'userpass' => 'test'];
switch ($username) {
case 'root':
$test_cnf_filename = static::getConfigFilename();
$test_cnf = Config::loadConfigFile($test_cnf_filename);
if (isset($test_cnf['core_root_pass'])) {
$data['userpass'] = $test_cnf['core_root_pass'];
}
break;
default:
$data['userpass'] = 'test';
}
return $data;
}