Framework: mv Icinga\Config\Config to Icinga\Application\Config
refs #4543
This commit is contained in:
parent
19b98c84a2
commit
93ae6d6811
|
@ -31,7 +31,7 @@ use Icinga\Web\ActionController;
|
|||
use Icinga\Web\Url;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Web\Widget\Dashboard;
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Form\Dashboard\AddUrlForm;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Icinga\Web\Form;
|
|||
use Icinga\Web\Form;
|
||||
use Icinga\Web\Session;
|
||||
use Icinga\Web\Notification;
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
|
||||
/**
|
||||
* Class SettingsForm
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Icinga\Form\Dashboard;
|
||||
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Web\Form;
|
||||
use Icinga\Web\Widget\Dashboard;
|
||||
use Zend_Form_Element_Text;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# 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
|
||||
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
|
||||
keep their main configuration in the INI file called config.ini. Here's some example code:
|
||||
|
||||
<?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
|
||||
IcingaConfig::app()->global->get('defaultTimezone', 'Europe/Berlin');
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Icinga\Application;
|
|||
use Icinga\Application\Modules\Manager as ModuleManager;
|
||||
use Icinga\Application\Platform;
|
||||
use Icinga\Exception\ProgrammingError;
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
use Zend_Loader_Autoloader;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
|
||||
|
|
12
library/Icinga/Config/Config.php → library/Icinga/Application/Config.php
Executable file → Normal file
12
library/Icinga/Config/Config.php → library/Icinga/Application/Config.php
Executable file → Normal file
|
@ -2,31 +2,31 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
/**
|
||||
* This file is part of Icinga 2 Web.
|
||||
*
|
||||
*
|
||||
* Icinga 2 Web - Head for multiple monitoring backends.
|
||||
* Copyright (C) 2013 Icinga Development Team
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*
|
||||
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
||||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
||||
* @author Icinga Development Team <info@icinga.org>
|
||||
*/
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
namespace Icinga\Config;
|
||||
namespace Icinga\Application;
|
||||
|
||||
use Zend_Config_Ini;
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
namespace Icinga\Application\Modules;
|
||||
|
||||
use Icinga\Application\ApplicationBootstrap;
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Web\Hook;
|
||||
use Zend_Controller_Router_Route as Route;
|
||||
|
|
|
@ -32,7 +32,7 @@ use Icinga\User;
|
|||
use Icinga\Authentication\UserBackend;
|
||||
use Icinga\Authentication\Credentials;
|
||||
use Icinga\Protocol\Ldap;
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
|
||||
/**
|
||||
* User authentication backend (@see Icinga\Authentication\UserBackend) for
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace Icinga\Authentication;
|
||||
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Exception\ConfigurationError as ConfigError;
|
||||
use Icinga\User;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Icinga;
|
||||
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Authentication\Manager as AuthManager;
|
||||
|
||||
class Backend
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace Icinga\Protocol\Ldap;
|
||||
|
||||
use Icinga\Application\Platform;
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
use Icinga\Application\Logger as Log;
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Icinga\Web;
|
|||
use Icinga\Authentication\Manager as AuthManager;
|
||||
use Icinga\Application\Benchmark;
|
||||
use Icinga\Exception;
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
use Icinga\Web\Notification;
|
||||
use Zend_Layout as ZfLayout;
|
||||
use Zend_Controller_Action as ZfController;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
namespace Icinga\Web;
|
||||
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Application\Icinga;
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace Icinga\Web\Widget;
|
||||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Exception\ConfigurationError;
|
||||
use Icinga\Web\Widget\Widget;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
use Icinga\Application\Benchmark;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Backend;
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Authentication\Manager;
|
||||
use Icinga\Web\Form;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Monitoring;
|
||||
|
||||
use Icinga\Config\Config as IcingaConfig;
|
||||
use \Icinga\Application\Config as IcingaConfig;
|
||||
use Icinga\Authentication\Manager as AuthManager;
|
||||
use Exception;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Monitoring;
|
||||
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
use Icinga\Web\Session;
|
||||
use Exception;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ require 'Zend/Controller/Action.php';
|
|||
|
||||
require '../../library/Icinga/Exception/ProgrammingError.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/Web/ActionController.php';
|
||||
require '../../library/Icinga/Web/Notification.php';
|
||||
|
|
|
@ -2,27 +2,37 @@
|
|||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
// {{{ICINGA_LICENSE_HEADER}}}
|
||||
|
||||
|
||||
namespace Tests\Icinga\Application;
|
||||
|
||||
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
|
||||
{
|
||||
/**
|
||||
* Set up config dir
|
||||
*
|
||||
* Utilizes singleton IcingaConfig
|
||||
*
|
||||
* @backupStaticAttributes enabled
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
IcingaConfig::$configDir = dirname(__FILE__) . '/files';
|
||||
IcingaConfig::$configDir = dirname(__FILE__) . '/Config/files';
|
||||
}
|
||||
|
||||
public function testAppConfig()
|
||||
{
|
||||
$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
|
||||
$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
|
||||
$this->assertEquals(0, $config->logging->get('disable', 0));
|
||||
// Test retrieve full section
|
|
@ -36,7 +36,7 @@ require_once('Zend/Config/Ini.php');
|
|||
require_once('Zend/Db.php');
|
||||
require_once('../../library/Icinga/Authentication/UserBackend.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/Backend/DbUserBackend.php');
|
||||
require_once('../../library/Icinga/User.php');
|
||||
|
@ -45,7 +45,7 @@ use Icinga\Authentication\Backend\DbUserBackend;
|
|||
use Icinga\Util\Crypto;
|
||||
use Icinga\Authentication\Credentials;
|
||||
use Icinga\User;
|
||||
use Icinga\Config\Config;
|
||||
use \Icinga\Application\Config;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue