本文整理汇总了PHP中Icinga\Application\Config::module方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::module方法的具体用法?PHP Config::module怎么用?PHP Config::module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icinga\Application\Config
的用法示例。
在下文中一共展示了Config::module方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
protected function init()
{
$cfg = Config::module('pnp4nagios')->getSection('pnp4nagios');
$this->configDir = rtrim($cfg->get('config_dir', $this->configDir), '/');
$this->baseUrl = rtrim($cfg->get('base_url', $this->baseUrl), '/');
$this->readPnpConfig();
}
示例2: createElements
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.
*/
public function createElements(array $formData = array())
{
$config = Config::module('monitoring');
parent::createElements($formData);
$this->addElements(array(array('checkbox', 'all_services', array('label' => $this->translate('All Services'), 'value' => (bool) $config->get('settings', 'hostcheck_all_services', false), 'description' => $this->translate('Schedule check for all services on the hosts and the hosts themselves.')))));
return $this;
}
示例3: fromConfig
/**
* Create menu from the application's menu config file plus the config files from all enabled modules
*
* @return self
*/
public static function fromConfig()
{
$menu = new static('menu');
$manager = Icinga::app()->getModuleManager();
try {
$menuConfigs = array(Config::app('menu'));
} catch (NotReadableError $e) {
Logger::error($e);
$menuConfigs = array();
}
try {
$modules = $manager->listEnabledModules();
} catch (NotReadableError $e) {
Logger::error($e);
$modules = array();
}
foreach ($modules as $moduleName) {
try {
$moduleMenuConfig = Config::module($moduleName, 'menu');
} catch (NotReadableError $e) {
Logger::error($e);
$moduleMenuConfig = array();
}
if (!empty($moduleMenuConfig)) {
$menuConfigs[] = $moduleMenuConfig;
}
}
return $menu->loadMenuItems($menu->flattenConfigs($menuConfigs));
}
示例4: db
protected function db()
{
$resourceName = Config::module('director')->get('db', 'resource');
if (!$resourceName) {
return false;
}
return Db::fromResourceName($resourceName);
}
示例5: createElements
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.
*/
public function createElements(array $formData = array())
{
$this->addElement('textarea', 'comment', array('required' => true, 'label' => $this->translate('Comment'), 'description' => $this->translate('If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.')));
if (!$this->getBackend()->isIcinga2()) {
$this->addElement('checkbox', 'persistent', array('label' => $this->translate('Persistent'), 'value' => (bool) Config::module('monitoring')->get('settings', 'comment_persistent', true), 'description' => $this->translate('If you uncheck this option, the comment will automatically be deleted the next time Icinga is' . ' restarted.')));
}
return $this;
}
示例6: fromConfig
/**
* {@inheritdoc}
*/
public static function fromConfig()
{
$backend = parent::fromConfig();
// TODO: move this to log types #11636
$resourceConfig = Config::module('elasticsearch')->getSection('elasticsearch');
$backend->setIndex($resourceConfig->get('logstash_pattern', 'logstash-*'));
return $backend;
}
示例7: createElements
/**
* {@inheritdoc}
*/
public function createElements(array $formData = array())
{
$config = Config::module('monitoring');
$this->addElements(array(array('textarea', 'comment', array('required' => true, 'label' => $this->translate('Comment'), 'description' => $this->translate('If you work with other administrators, you may find it useful to share information about the' . ' the host or service that is having problems. Make sure you enter a brief description of' . ' what you are doing.'))), array('checkbox', 'forced', array('label' => $this->translate('Forced'), 'value' => (bool) $config->get('settings', 'custom_notification_forced', false), 'description' => $this->translate('If you check this option, the notification is sent out regardless of time restrictions and' . ' whether or not notifications are enabled.')))));
if (!$this->getBackend()->isIcinga2()) {
$this->addElement('checkbox', 'broadcast', array('label' => $this->translate('Broadcast'), 'value' => (bool) $config->get('settings', 'custom_notification_broadcast', false), 'description' => $this->translate('If you check this option, the notification is sent out to all normal and escalated contacts.')));
}
return $this;
}
示例8: fetchFiles
public function fetchFiles()
{
$files = array();
$storage = new LegacyStorage(Config::module('businessprocess')->getSection('global'));
foreach ($storage->listProcesses() as $name => $title) {
$files['processes/' . $name . '.bp'] = $storage->getSource($name);
}
return $files;
}
示例9: init
protected function init()
{
$cfg = Config::module('graphite')->getSection('graphite');
$this->baseUrl = rtrim($cfg->get('base_url', $this->baseUrl), '/');
$this->metricPrefix = $cfg->get('metric_prefix', $this->metricPrefix);
$this->serviceMacro = $cfg->get('service_name_template', $this->serviceMacro);
$this->hostMacro = $cfg->get('host_name_template', $this->hostMacro);
$this->imageUrlMacro = $cfg->get('graphite_args_template', $this->imageUrlMacro);
$this->largeImageUrlMacro = $cfg->get('graphite_large_args_template', $this->largeImageUrlMacro);
}
示例10: getConfig
/**
* Get transport configuration
*
* @return Config
* @throws ConfigurationError
*/
public static function getConfig()
{
if (!isset(self::$config)) {
self::$config = Config::module('monitoring', 'instances');
if (self::$config->isEmpty()) {
throw new ConfigurationError('No instances have been configured in \'%s\'.', self::$config->getConfigFile());
}
}
return self::$config;
}
示例11: init
protected function init()
{
$cfg = Config::module('graphite')->getSection('graphite');
$this->baseUrl = rtrim($cfg->get('base_url', $this->baseUrl), '/');
$this->legacyMode = filter_var($cfg->get('legacy_mode', $this->legacyMode), FILTER_VALIDATE_BOOLEAN);
$this->serviceMacro = $cfg->get('service_name_template', $this->serviceMacro);
$this->hostMacro = $cfg->get('host_name_template', $this->hostMacro);
$this->imageUrlMacro = $cfg->get('graphite_args_template', $this->imageUrlMacro);
$this->largeImageUrlMacro = $cfg->get('graphite_large_args_template', $this->largeImageUrlMacro);
}
示例12: db
protected function db()
{
if ($this->db === null) {
$resourceName = Config::module('director')->get('db', 'resource');
if ($resourceName) {
$this->db = Db::fromResourceName($resourceName);
}
}
return $this->db;
}
示例13: getDirectories
protected function getDirectories()
{
return Config::module('fileshipper', 'directories');
$config = Config::module('fileshipper', 'directories');
$dirs = array();
foreach ($config as $key => $c) {
$dirs[$key] = (object) $c->toArray();
}
return $dirs;
}
示例14: getConfig
/**
* Get transport configuration
*
* @return Config
*
* @throws ConfigurationError
*/
public static function getConfig()
{
if (static::$config === null) {
$config = Config::module('monitoring', 'commandtransports');
if ($config->isEmpty()) {
throw new ConfigurationError(mt('monitoring', 'No command transports have been configured in "%s".'), $config->getConfigFile());
}
static::$config = $config;
}
return static::$config;
}
示例15: ssldir
public function ssldir($subdir = null)
{
if ($this->ssldir === null) {
$this->ssldir = dirname(Config::module('puppetdb')->getConfigFile()) . '/ssl';
}
if ($subdir === null) {
return $this->ssldir;
} else {
return $this->ssldir . '/' . $subdir;
}
}