本文整理匯總了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;
}