Skip to content

Commit

Permalink
Merge branch 'bugfix/drop-zend-config-7147'
Browse files Browse the repository at this point in the history
fixes #7147
  • Loading branch information
Johannes Meyer committed Nov 7, 2014
2 parents 54eda31 + 124f64a commit 94b01cf
Show file tree
Hide file tree
Showing 52 changed files with 933 additions and 382 deletions.
22 changes: 11 additions & 11 deletions application/controllers/ConfigController.php
Expand Up @@ -7,7 +7,7 @@
use Icinga\Application\Modules\Module;
use Icinga\Web\Widget;
use Icinga\Application\Icinga;
use Icinga\Application\Config as IcingaConfig;
use Icinga\Application\Config;
use Icinga\Form\Config\GeneralConfigForm;
use Icinga\Form\Config\AuthenticationBackendReorderForm;
use Icinga\Form\Config\AuthenticationBackendConfigForm;
Expand Down Expand Up @@ -46,7 +46,7 @@ public function devtoolsAction()
public function indexAction()
{
$form = new GeneralConfigForm();
$form->setIniConfig(IcingaConfig::app());
$form->setIniConfig(Config::app());
$form->handleRequest();

$this->view->form = $form;
Expand Down Expand Up @@ -131,7 +131,7 @@ public function moduledisableAction()
public function authenticationAction()
{
$form = new AuthenticationBackendReorderForm();
$form->setIniConfig(IcingaConfig::app('authentication'));
$form->setIniConfig(Config::app('authentication'));
$form->handleRequest();

$this->view->form = $form;
Expand All @@ -145,7 +145,7 @@ public function authenticationAction()
public function createauthenticationbackendAction()
{
$form = new AuthenticationBackendConfigForm();
$form->setIniConfig(IcingaConfig::app('authentication'));
$form->setIniConfig(Config::app('authentication'));
$form->setResourceConfig(ResourceFactory::getResourceConfigs());
$form->setRedirectUrl('config/authentication');
$form->handleRequest();
Expand All @@ -161,7 +161,7 @@ public function createauthenticationbackendAction()
public function editauthenticationbackendAction()
{
$form = new AuthenticationBackendConfigForm();
$form->setIniConfig(IcingaConfig::app('authentication'));
$form->setIniConfig(Config::app('authentication'));
$form->setResourceConfig(ResourceFactory::getResourceConfigs());
$form->setRedirectUrl('config/authentication');
$form->handleRequest();
Expand All @@ -179,7 +179,7 @@ public function removeauthenticationbackendAction()
$form = new ConfirmRemovalForm(array(
'onSuccess' => function ($request) {
$configForm = new AuthenticationBackendConfigForm();
$configForm->setIniConfig(IcingaConfig::app('authentication'));
$configForm->setIniConfig(Config::app('authentication'));
$authBackend = $request->getQuery('auth_backend');

try {
Expand Down Expand Up @@ -212,7 +212,7 @@ public function removeauthenticationbackendAction()
*/
public function resourceAction()
{
$this->view->resources = IcingaConfig::app('resources', true)->toArray();
$this->view->resources = Config::app('resources', true)->toArray();
$this->view->tabs->activate('resources');
}

Expand All @@ -222,7 +222,7 @@ public function resourceAction()
public function createresourceAction()
{
$form = new ResourceConfigForm();
$form->setIniConfig(IcingaConfig::app('resources'));
$form->setIniConfig(Config::app('resources'));
$form->setRedirectUrl('config/resource');
$form->handleRequest();

Expand All @@ -236,7 +236,7 @@ public function createresourceAction()
public function editresourceAction()
{
$form = new ResourceConfigForm();
$form->setIniConfig(IcingaConfig::app('resources'));
$form->setIniConfig(Config::app('resources'));
$form->setRedirectUrl('config/resource');
$form->handleRequest();

Expand All @@ -252,7 +252,7 @@ public function removeresourceAction()
$form = new ConfirmRemovalForm(array(
'onSuccess' => function ($request) {
$configForm = new ResourceConfigForm();
$configForm->setIniConfig(IcingaConfig::app('resources'));
$configForm->setIniConfig(Config::app('resources'));
$resource = $request->getQuery('resource');

try {
Expand All @@ -274,7 +274,7 @@ public function removeresourceAction()

// Check if selected resource is currently used for authentication
$resource = $this->getRequest()->getQuery('resource');
$authConfig = IcingaConfig::app('authentication')->toArray();
$authConfig = Config::app('authentication')->toArray();
foreach ($authConfig as $backendName => $config) {
if (array_key_exists('resource', $config) && $config['resource'] === $resource) {
$form->addError(sprintf(
Expand Down
8 changes: 4 additions & 4 deletions application/controllers/DashboardController.php
Expand Up @@ -93,7 +93,7 @@ public function addurlAction()
);

$configFile = Config::app('dashboard/dashboard')->getConfigFile();
if ($this->writeConfiguration(new Zend_Config($dashboard->toArray()), $configFile)) {
if ($this->writeConfiguration(new Config($dashboard->toArray()), $configFile)) {
$this->redirectNow(Url::fromPath('dashboard', array('pane' => $form->getValue('pane'))));
} else {
$this->render('showConfiguration');
Expand Down Expand Up @@ -151,12 +151,12 @@ public function indexAction()
/**
* Store the given configuration as INI file
*
* @param Zend_Config $config The configuration to store
* @param string $target The path where to store the configuration
* @param Config $config The configuration to store
* @param string $target The path where to store the configuration
*
* @return bool Whether the configuartion has been successfully stored
*/
protected function writeConfiguration(Zend_Config $config, $target)
protected function writeConfiguration(Config $config, $target)
{
$writer = new IniWriter(array('config' => $config, 'filename' => $target));

Expand Down
4 changes: 2 additions & 2 deletions application/controllers/ListController.php
Expand Up @@ -3,9 +3,9 @@
// {{{ICINGA_LICENSE_HEADER}}}

use Icinga\Module\Monitoring\Controller;
use Icinga\Web\Hook;
use Icinga\Web\Url;
use Icinga\Application\Logger;
use Icinga\Application\Config;
use Icinga\Protocol\File\FileReader;
use \Zend_Controller_Action_Exception as ActionError;

Expand Down Expand Up @@ -48,7 +48,7 @@ public function applicationlogAction()
. ' - (?<message>.*)$/'; // message

$loggerWriter = Logger::getInstance()->getWriter();
$resource = new FileReader(new Zend_Config(array(
$resource = new FileReader(new Config(array(
'filename' => $loggerWriter->getPath(),
'fields' => $pattern
)));
Expand Down
4 changes: 2 additions & 2 deletions application/forms/Config/Resource/DbResourceForm.php
Expand Up @@ -5,7 +5,7 @@
namespace Icinga\Form\Config\Resource;

use Exception;
use Zend_Config;
use Icinga\Application\Config;
use Icinga\Web\Form;
use Icinga\Web\Request;
use Icinga\Web\Form\Element\Number;
Expand Down Expand Up @@ -118,7 +118,7 @@ public function onSuccess(Request $request)
public function isValidResource(Form $form)
{
try {
$resource = ResourceFactory::createResource(new Zend_Config($form->getValues()));
$resource = ResourceFactory::createResource(new Config($form->getValues()));
$resource->getConnection()->getConnection();
} catch (Exception $e) {
$form->addError(t('Connectivity validation failed, connection to the given resource not possible.'));
Expand Down
4 changes: 2 additions & 2 deletions application/forms/Config/Resource/LdapResourceForm.php
Expand Up @@ -5,7 +5,7 @@
namespace Icinga\Form\Config\Resource;

use Exception;
use Zend_Config;
use Icinga\Application\Config;
use Icinga\Web\Form;
use Icinga\Web\Request;
use Icinga\Web\Form\Element\Number;
Expand Down Expand Up @@ -104,7 +104,7 @@ public function onSuccess(Request $request)
public function isValidResource(Form $form)
{
try {
$resource = ResourceFactory::createResource(new Zend_Config($form->getValues()));
$resource = ResourceFactory::createResource(new Config($form->getValues()));
$resource->connect();
} catch (Exception $e) {
$form->addError(t('Connectivity validation failed, connection to the given resource not possible.'));
Expand Down
4 changes: 2 additions & 2 deletions application/forms/Config/Resource/LivestatusResourceForm.php
Expand Up @@ -5,7 +5,7 @@
namespace Icinga\Form\Config\Resource;

use Exception;
use Zend_Config;
use Icinga\Application\Config;
use Icinga\Web\Form;
use Icinga\Web\Request;
use Icinga\Application\Icinga;
Expand Down Expand Up @@ -65,7 +65,7 @@ public function onSuccess(Request $request)
public function isValidResource(Form $form)
{
try {
$resource = ResourceFactory::createResource(new Zend_Config($form->getValues()));
$resource = ResourceFactory::createResource(new Config($form->getValues()));
$resource->connect()->disconnect();
} catch (Exception $e) {
$form->addError(t('Connectivity validation failed, connection to the given resource not possible.'));
Expand Down
4 changes: 2 additions & 2 deletions application/forms/Dashboard/AddUrlForm.php
Expand Up @@ -4,7 +4,7 @@

namespace Icinga\Form\Dashboard;

use Icinga\Application\Config as IcingaConfig;
use Icinga\Application\Config;
use Icinga\Web\Widget\Dashboard;
use Icinga\Web\Form;

Expand Down Expand Up @@ -110,7 +110,7 @@ public function createElements(array $formData)
protected function getDashboardPaneSelectionValues()
{
$dashboard = new Dashboard();
$dashboard->readConfig(IcingaConfig::app('dashboard/dashboard'));
$dashboard->readConfig(Config::app('dashboard/dashboard'));
return $dashboard->getPaneKeyTitleArray();
}
}
20 changes: 7 additions & 13 deletions library/Icinga/Application/ApplicationBootstrap.php
Expand Up @@ -6,7 +6,6 @@

use ErrorException;
use Exception;
use Zend_Config;
use Icinga\Application\Modules\Manager as ModuleManager;
use Icinga\Data\ResourceFactory;
use Icinga\Exception\ConfigurationError;
Expand Down Expand Up @@ -57,7 +56,7 @@ abstract class ApplicationBootstrap
/**
* Config object
*
* @var Zend_Config
* @var Config
*/
protected $config;

Expand Down Expand Up @@ -313,12 +312,7 @@ protected function setupModuleManager()
$this->moduleManager = new ModuleManager(
$this,
$this->configDir . '/enabledModules',
explode(
':',
$this->config->global !== null
? $this->config->global->get('modulePath', ICINGAWEB_APPDIR . '/../modules')
: ICINGAWEB_APPDIR . '/../modules'
)
explode(':', $this->config->fromSection('global', 'modulePath', ICINGAWEB_APPDIR . '/../modules'))
);
return $this;
}
Expand Down Expand Up @@ -346,7 +340,7 @@ protected function loadEnabledModules()
protected function setupLogging()
{
Logger::create(
new Zend_Config(
new Config(
array(
'log' => 'syslog'
)
Expand All @@ -367,7 +361,7 @@ protected function loadConfig()
$this->config = Config::app();
} catch (NotReadableError $e) {
Logger::error(new IcingaException('Cannot load application configuration. An exception was thrown:', $e));
$this->config = new Zend_Config(array());
$this->config = new Config();
}
return $this;
}
Expand Down Expand Up @@ -404,9 +398,9 @@ protected function setupErrorHandling()
*/
protected function setupLogger()
{
if ($this->config->logging !== null) {
if (($loggingConfig = $this->config->get('logging')) !== null) {
try {
Logger::create($this->config->logging);
Logger::create($loggingConfig);
} catch (ConfigurationError $e) {
Logger::error($e);
}
Expand Down Expand Up @@ -445,7 +439,7 @@ protected function setupTimezone()
if (! $default) {
$default = 'UTC';
}
$timeZoneString = $this->config->global !== null ? $this->config->global->get('timezone', $default) : $default;
$timeZoneString = $this->config->fromSection('global', 'timezone', $default);
date_default_timezone_set($timeZoneString);
DateTimeFactory::setConfig(array('timezone' => $timeZoneString));
return $this;
Expand Down
4 changes: 2 additions & 2 deletions library/Icinga/Application/Cli.php
Expand Up @@ -4,6 +4,7 @@

namespace Icinga\Application;

use Icinga\Application\Config;
use Icinga\Application\Platform;
use Icinga\Application\ApplicationBootstrap;
use Icinga\Cli\Params;
Expand All @@ -12,7 +13,6 @@
use Icinga\Application\Logger;
use Icinga\Application\Benchmark;
use Icinga\Exception\ProgrammingError;
use Zend_Config;

require_once __DIR__ . '/ApplicationBootstrap.php';

Expand Down Expand Up @@ -49,7 +49,7 @@ protected function bootstrap()
protected function setupLogging()
{
Logger::create(
new Zend_Config(
new Config(
array(
'level' => Logger::INFO,
'log' => 'file',
Expand Down

0 comments on commit 94b01cf

Please sign in to comment.