mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
commit
55f93389ba
@ -31,7 +31,7 @@ use Icinga\Web\ActionController;
|
|||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Web\Widget\Dashboard;
|
use Icinga\Web\Widget\Dashboard;
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Form\Dashboard\AddUrlForm;
|
use Icinga\Form\Dashboard\AddUrlForm;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace Icinga\Web\Form;
|
|||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Session;
|
use Icinga\Web\Session;
|
||||||
use Icinga\Web\Notification;
|
use Icinga\Web\Notification;
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SettingsForm
|
* Class SettingsForm
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Form\Dashboard;
|
namespace Icinga\Form\Dashboard;
|
||||||
|
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Widget\Dashboard;
|
use Icinga\Web\Widget\Dashboard;
|
||||||
use Zend_Form_Element_Text;
|
use Zend_Form_Element_Text;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
# Application and Module Configuration
|
# Application and Module Configuration
|
||||||
|
|
||||||
The \Icinga\Config\Config class is a general purpose service to help you find, load and save
|
The \Icinga\Application\Config class is a general purpose service to help you find, load and save
|
||||||
configuration data. It is used both by the Icinga 2 Web modules and the framework itself. With
|
configuration data. It is used both by the Icinga 2 Web modules and the framework itself. With
|
||||||
INI files as source it enables you to store configuration in a familiar format. Icinga 2 Web
|
INI files as source it enables you to store configuration in a familiar format. Icinga 2 Web
|
||||||
defines some configuration files for its own purposes. Please note that both modules and framework
|
defines some configuration files for its own purposes. Please note that both modules and framework
|
||||||
keep their main configuration in the INI file called config.ini. Here's some example code:
|
keep their main configuration in the INI file called config.ini. Here's some example code:
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
use \Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
|
|
||||||
// Retrieve the default timezone using 'Europe/Berlin' in case it is not set
|
// Retrieve the default timezone using 'Europe/Berlin' in case it is not set
|
||||||
IcingaConfig::app()->global->get('defaultTimezone', 'Europe/Berlin');
|
IcingaConfig::app()->global->get('defaultTimezone', 'Europe/Berlin');
|
||||||
|
@ -31,7 +31,7 @@ namespace Icinga\Application;
|
|||||||
use Icinga\Application\Modules\Manager as ModuleManager;
|
use Icinga\Application\Modules\Manager as ModuleManager;
|
||||||
use Icinga\Application\Platform;
|
use Icinga\Application\Platform;
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
use Zend_Loader_Autoloader;
|
use Zend_Loader_Autoloader;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
|
|
||||||
|
2
library/Icinga/Config/Config.php → library/Icinga/Application/Config.php
Executable file → Normal file
2
library/Icinga/Config/Config.php → library/Icinga/Application/Config.php
Executable file → Normal file
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
namespace Icinga\Config;
|
namespace Icinga\Application;
|
||||||
|
|
||||||
use Zend_Config_Ini;
|
use Zend_Config_Ini;
|
||||||
|
|
@ -29,7 +29,7 @@
|
|||||||
namespace Icinga\Application\Modules;
|
namespace Icinga\Application\Modules;
|
||||||
|
|
||||||
use Icinga\Application\ApplicationBootstrap;
|
use Icinga\Application\ApplicationBootstrap;
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Web\Hook;
|
use Icinga\Web\Hook;
|
||||||
use Zend_Controller_Router_Route as Route;
|
use Zend_Controller_Router_Route as Route;
|
||||||
|
@ -32,7 +32,7 @@ use Icinga\User;
|
|||||||
use Icinga\Authentication\UserBackend;
|
use Icinga\Authentication\UserBackend;
|
||||||
use Icinga\Authentication\Credentials;
|
use Icinga\Authentication\Credentials;
|
||||||
use Icinga\Protocol\Ldap;
|
use Icinga\Protocol\Ldap;
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User authentication backend (@see Icinga\Authentication\UserBackend) for
|
* User authentication backend (@see Icinga\Authentication\UserBackend) for
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
namespace Icinga\Authentication;
|
namespace Icinga\Authentication;
|
||||||
|
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Exception\ConfigurationError as ConfigError;
|
use Icinga\Exception\ConfigurationError as ConfigError;
|
||||||
use Icinga\User;
|
use Icinga\User;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga;
|
namespace Icinga;
|
||||||
|
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Authentication\Manager as AuthManager;
|
use Icinga\Authentication\Manager as AuthManager;
|
||||||
|
|
||||||
class Backend
|
class Backend
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
namespace Icinga\Protocol\Ldap;
|
namespace Icinga\Protocol\Ldap;
|
||||||
|
|
||||||
use Icinga\Application\Platform;
|
use Icinga\Application\Platform;
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
use Icinga\Application\Logger as Log;
|
use Icinga\Application\Logger as Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@ namespace Icinga\Web;
|
|||||||
use Icinga\Authentication\Manager as AuthManager;
|
use Icinga\Authentication\Manager as AuthManager;
|
||||||
use Icinga\Application\Benchmark;
|
use Icinga\Application\Benchmark;
|
||||||
use Icinga\Exception;
|
use Icinga\Exception;
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
use Icinga\Web\Notification;
|
use Icinga\Web\Notification;
|
||||||
use Zend_Layout as ZfLayout;
|
use Zend_Layout as ZfLayout;
|
||||||
use Zend_Controller_Action as ZfController;
|
use Zend_Controller_Action as ZfController;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
namespace Icinga\Web;
|
namespace Icinga\Web;
|
||||||
|
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
namespace Icinga\Web\Widget;
|
namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Exception\ConfigurationError;
|
use Icinga\Exception\ConfigurationError;
|
||||||
use Icinga\Web\Widget\Widget;
|
use Icinga\Web\Widget\Widget;
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
use Icinga\Application\Benchmark;
|
use Icinga\Application\Benchmark;
|
||||||
use Icinga\Application\Icinga;
|
use Icinga\Application\Icinga;
|
||||||
use Icinga\Backend;
|
use Icinga\Backend;
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
use Icinga\Application\Logger;
|
use Icinga\Application\Logger;
|
||||||
use Icinga\Authentication\Manager;
|
use Icinga\Authentication\Manager;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Monitoring;
|
namespace Monitoring;
|
||||||
|
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
use Icinga\Authentication\Manager as AuthManager;
|
use Icinga\Authentication\Manager as AuthManager;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Monitoring;
|
namespace Monitoring;
|
||||||
|
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
use Icinga\Web\Session;
|
use Icinga\Web\Session;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ require 'Zend/Controller/Action.php';
|
|||||||
|
|
||||||
require '../../library/Icinga/Exception/ProgrammingError.php';
|
require '../../library/Icinga/Exception/ProgrammingError.php';
|
||||||
require '../../library/Icinga/Application/Benchmark.php';
|
require '../../library/Icinga/Application/Benchmark.php';
|
||||||
require '../../library/Icinga/Config/Config.php';
|
require '../../library/Icinga/Application/Config.php';
|
||||||
require '../../library/Icinga/Application/Icinga.php';
|
require '../../library/Icinga/Application/Icinga.php';
|
||||||
require '../../library/Icinga/Web/ActionController.php';
|
require '../../library/Icinga/Web/ActionController.php';
|
||||||
require '../../library/Icinga/Web/Notification.php';
|
require '../../library/Icinga/Web/Notification.php';
|
||||||
|
@ -2,27 +2,37 @@
|
|||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
|
||||||
namespace Tests\Icinga\Application;
|
namespace Tests\Icinga\Application;
|
||||||
|
|
||||||
require_once 'Zend/Config/Ini.php';
|
require_once 'Zend/Config/Ini.php';
|
||||||
require_once '../../library/Icinga/Config/Config.php';
|
require_once realpath(__DIR__ . '/../../../../../library/Icinga/Application/Config.php');
|
||||||
|
|
||||||
use Icinga\Config\Config as IcingaConfig;
|
use \Icinga\Application\Config as IcingaConfig;
|
||||||
|
|
||||||
class ConfigTest extends \PHPUnit_Framework_TestCase
|
class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Set up config dir
|
||||||
|
*
|
||||||
|
* Utilizes singleton IcingaConfig
|
||||||
|
*
|
||||||
|
* @backupStaticAttributes enabled
|
||||||
|
*/
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
IcingaConfig::$configDir = dirname(__FILE__) . '/files';
|
IcingaConfig::$configDir = dirname(__FILE__) . '/Config/files';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAppConfig()
|
public function testAppConfig()
|
||||||
{
|
{
|
||||||
$config = IcingaConfig::app();
|
$config = IcingaConfig::app();
|
||||||
$this->assertEquals(1, $config->logging->enable);
|
$this->assertEquals(1, $config->logging->enable, 'Unexpected value retrieved from config file');
|
||||||
// Test non-existent property where null is the default value
|
// Test non-existent property where null is the default value
|
||||||
$this->assertEquals(null, $config->logging->get('disable'));
|
$this->assertEquals(
|
||||||
|
null,
|
||||||
|
$config->logging->get('disable'),
|
||||||
|
'Unexpected default value for non-existent properties'
|
||||||
|
);
|
||||||
// Test non-existent property using zero as the default value
|
// Test non-existent property using zero as the default value
|
||||||
$this->assertEquals(0, $config->logging->get('disable', 0));
|
$this->assertEquals(0, $config->logging->get('disable', 0));
|
||||||
// Test retrieve full section
|
// Test retrieve full section
|
@ -36,7 +36,7 @@ require_once('Zend/Config/Ini.php');
|
|||||||
require_once('Zend/Db.php');
|
require_once('Zend/Db.php');
|
||||||
require_once('../../library/Icinga/Authentication/UserBackend.php');
|
require_once('../../library/Icinga/Authentication/UserBackend.php');
|
||||||
require_once('../../library/Icinga/Protocol/Ldap/Exception.php');
|
require_once('../../library/Icinga/Protocol/Ldap/Exception.php');
|
||||||
require_once('../../library/Icinga/Config/Config.php');
|
require_once('../../library/Icinga/Application/Config.php');
|
||||||
require_once('../../library/Icinga/Authentication/Credentials.php');
|
require_once('../../library/Icinga/Authentication/Credentials.php');
|
||||||
require_once('../../library/Icinga/Authentication/Backend/DbUserBackend.php');
|
require_once('../../library/Icinga/Authentication/Backend/DbUserBackend.php');
|
||||||
require_once('../../library/Icinga/User.php');
|
require_once('../../library/Icinga/User.php');
|
||||||
@ -45,7 +45,7 @@ use Icinga\Authentication\Backend\DbUserBackend;
|
|||||||
use Icinga\Util\Crypto;
|
use Icinga\Util\Crypto;
|
||||||
use Icinga\Authentication\Credentials;
|
use Icinga\Authentication\Credentials;
|
||||||
use Icinga\User;
|
use Icinga\User;
|
||||||
use Icinga\Config\Config;
|
use \Icinga\Application\Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user