Framework: mv Icinga\Config\Config to Icinga\Application\Config

refs #4543
This commit is contained in:
Eric Lippmann 2013-08-12 15:02:25 +02:00
parent 19b98c84a2
commit 93ae6d6811
24 changed files with 42 additions and 32 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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');

View File

@ -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;

View 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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;
/**

View File

@ -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;

View File

@ -28,7 +28,7 @@
*/
namespace Icinga\Web;
use Icinga\Config\Config as IcingaConfig;
use \Icinga\Application\Config as IcingaConfig;
use Icinga\Application\Icinga;
/**

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -2,7 +2,7 @@
namespace Monitoring;
use Icinga\Config\Config;
use \Icinga\Application\Config;
use Icinga\Web\Session;
use Exception;

View File

@ -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';

View File

@ -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

View File

@ -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;
/**
*