From 376e9aa16056e5e19f8a144963f0236ecfeb7f60 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Tue, 26 Aug 2014 14:29:55 +0200 Subject: [PATCH 01/18] Rename hook base classes Adding suffix "Hook" to every base class. This simplifies development because you don't need to alias bases classes in your concrete hook classes refs #6928 --- library/Icinga/Web/Hook/{Grapher.php => GrapherHook.php} | 2 +- library/Icinga/Web/Hook/{Ticket.php => TicketHook.php} | 2 +- library/Icinga/Web/Hook/{TopBar.php => TopBarHook.php} | 4 ++-- .../Hook/{TimelineProvider.php => TimelineProviderHook.php} | 2 +- modules/monitoring/library/Monitoring/Web/Hook/TopBar.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) rename library/Icinga/Web/Hook/{Grapher.php => GrapherHook.php} (99%) rename library/Icinga/Web/Hook/{Ticket.php => TicketHook.php} (97%) rename library/Icinga/Web/Hook/{TopBar.php => TopBarHook.php} (81%) rename modules/monitoring/library/Monitoring/Web/Hook/{TimelineProvider.php => TimelineProviderHook.php} (96%) diff --git a/library/Icinga/Web/Hook/Grapher.php b/library/Icinga/Web/Hook/GrapherHook.php similarity index 99% rename from library/Icinga/Web/Hook/Grapher.php rename to library/Icinga/Web/Hook/GrapherHook.php index 28de49604..e2fea304a 100644 --- a/library/Icinga/Web/Hook/Grapher.php +++ b/library/Icinga/Web/Hook/GrapherHook.php @@ -14,7 +14,7 @@ namespace Icinga\Web\Hook; * @author Icinga-Web Team * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License */ -class Grapher +class GrapherHook { /** * Whether this grapher provides preview images diff --git a/library/Icinga/Web/Hook/Ticket.php b/library/Icinga/Web/Hook/TicketHook.php similarity index 97% rename from library/Icinga/Web/Hook/Ticket.php rename to library/Icinga/Web/Hook/TicketHook.php index f9c1b495e..bb9a129b4 100644 --- a/library/Icinga/Web/Hook/Ticket.php +++ b/library/Icinga/Web/Hook/TicketHook.php @@ -14,7 +14,7 @@ namespace Icinga\Web\Hook; * @author Icinga-Web Team * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License */ -abstract class Ticket +abstract class TicketHook { /** * Constructor must live without arguments right now diff --git a/library/Icinga/Web/Hook/TopBar.php b/library/Icinga/Web/Hook/TopBarHook.php similarity index 81% rename from library/Icinga/Web/Hook/TopBar.php rename to library/Icinga/Web/Hook/TopBarHook.php index d32f6d1fd..695d81109 100644 --- a/library/Icinga/Web/Hook/TopBar.php +++ b/library/Icinga/Web/Hook/TopBarHook.php @@ -10,7 +10,7 @@ use \Zend_View; /** * Hook to extend topbar items */ -interface TopBar +abstract class TopBarHook { /** * Function to generate top bar content @@ -20,5 +20,5 @@ interface TopBar * * @return string */ - public function getHtml($request, $view); + abstract public function getHtml($request, $view); } diff --git a/modules/monitoring/library/Monitoring/Web/Hook/TimelineProvider.php b/modules/monitoring/library/Monitoring/Web/Hook/TimelineProviderHook.php similarity index 96% rename from modules/monitoring/library/Monitoring/Web/Hook/TimelineProvider.php rename to modules/monitoring/library/Monitoring/Web/Hook/TimelineProviderHook.php index cafe68c17..e265086ab 100644 --- a/modules/monitoring/library/Monitoring/Web/Hook/TimelineProvider.php +++ b/modules/monitoring/library/Monitoring/Web/Hook/TimelineProviderHook.php @@ -9,7 +9,7 @@ use Icinga\Module\Monitoring\Timeline\TimeRange; /** * Base class for TimeLine providers */ -abstract class TimelineProvider +abstract class TimelineProviderHook { /** * Return the names by which to group entries diff --git a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php index 32efaca9a..9433bf805 100644 --- a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php +++ b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Web\Hook; -use Icinga\Web\Hook\TopBar as IcingaTopBar; +use Icinga\Web\Hook\TopBarHook; use Icinga\Module\Monitoring\DataView\StatusSummary as StatusSummaryView; use Icinga\Web\Request; use Zend_View; @@ -12,7 +12,7 @@ use Zend_View; /** * Render status summary into the topbar of icinga */ -class TopBar implements IcingaTopBar +class TopBar extends TopBarHook { /** * Function to generate top bar content From 7e5b5a0b30856c7904a18563e39e57c90efaa02f Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 27 Aug 2014 09:35:43 +0200 Subject: [PATCH 02/18] Hook/Grapher: Rework hook interface Rework interface based on specification and changed consumer calls. refs #6932 --- library/Icinga/Web/Hook/GrapherHook.php | 63 +++++++++++++++---- .../controllers/ShowController.php | 11 ++-- 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/library/Icinga/Web/Hook/GrapherHook.php b/library/Icinga/Web/Hook/GrapherHook.php index e2fea304a..99ab8a8f6 100644 --- a/library/Icinga/Web/Hook/GrapherHook.php +++ b/library/Icinga/Web/Hook/GrapherHook.php @@ -4,6 +4,8 @@ namespace Icinga\Web\Hook; +use Icinga\Exception\ProgrammingError; + /** * Icinga Web Grapher Hook base class * @@ -14,7 +16,7 @@ namespace Icinga\Web\Hook; * @author Icinga-Web Team * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License */ -class GrapherHook +abstract class GrapherHook { /** * Whether this grapher provides preview images @@ -56,9 +58,13 @@ class GrapherHook /** * Whether a graph for the given host[, service [, plot]] exists * + * @param string $host + * @param string $service + * @param string $plot + * * @return bool */ - public function hasGraph($host, $service = null, $plot = null) + public function has($host, $service = null, $plot = null) { return false; } @@ -66,13 +72,47 @@ class GrapherHook /** * Get a preview image for the given host[, service [, plot]] exists * - * WARNING: We are not sure yet whether this will remain as is + * @param string $host + * @param string $service + * @param string $plot * - * @return string + * @return string + * + * @throws ProgrammingError */ - public function getPreviewImage($host, $service = null, $plot = null) + public function getPreviewHtml($host, $service = null, $plot = null) { - throw new Exception('This backend has no preview images'); + throw new ProgrammingError('This backend has no preview images'); + } + + /** + * Whether a tiny graph for the given host[, service [, plot]] exists + * + * @param string $host + * @param string $service + * @param string $plot + * + * @return bool + */ + public function hasTinyPreview($host, $service = null, $plot = null) + { + return false; + } + + /** + * Get a tiny preview image for the given host[, service [, plot]] exists + * + * @param string $host + * @param string $service + * @param string $plot + * + * @return string + * + * @throws ProgrammingError + */ + public function getTinyPreviewHtml($host, $service = null, $plot = null) + { + throw new ProgrammingError('This backend has no tiny preview images'); } /** @@ -80,10 +120,11 @@ class GrapherHook * * WARNING: We are not sure yet whether this will remain as is * - * @return string + * @param string $host + * @param string $service + * @param string $plot + * + * @return string */ - public function getGraphUrl($host, $service = null, $plot = null) - { - throw new Exception('This backend has no images'); - } + abstract function getGraphUrl($host, $service = null, $plot = null); } diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index d503ba512..55b57cd52 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -25,6 +25,9 @@ class Monitoring_ShowController extends Controller */ protected $backend; + /** + * @var Hook\GrapherHook + */ protected $grapher; /** @@ -61,8 +64,8 @@ class Monitoring_ShowController extends Controller . ' on ' . $o->host_name; $this->getTabs()->activate('service'); $o->populate(); - if ($this->grapher && $this->grapher->hasGraph($o->host_name, $o->service_description)) { - $this->view->grapherHtml = $this->grapher->getPreviewImage($o->host_name, $o->service_description); + if ($this->grapher && $this->grapher->hasPreviews($o->host_name, $o->service_description)) { + $this->view->grapherHtml = $this->grapher->getPreviewHtml($o->host_name, $o->service_description); } } @@ -76,8 +79,8 @@ class Monitoring_ShowController extends Controller $this->getTabs()->activate('host'); $this->view->title = $o->host_name; $o->populate(); - if ($this->grapher && $this->grapher->hasGraph($o->host_name)) { - $this->view->grapherHtml = $this->grapher->getPreviewImage($o->host_name); + if ($this->grapher && $this->grapher->hasPreviews($o->host_name)) { + $this->view->grapherHtml = $this->grapher->getPreviewHtml($o->host_name); } } From 5abf41edef8f1678df6a50f6167a085c822c377f Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 27 Aug 2014 10:19:27 +0200 Subject: [PATCH 03/18] Hook/ConfigurationTab: Remove deprecated implementation ConfigurationTab hook is not used anywhere. Test is removed also. --- .../Hook/Configuration/ConfigurationTab.php | 145 ------------------ .../Configuration/ConfigurationTabBuilder.php | 107 ------------- .../ConfigurationTabInterface.php | 27 ---- .../ConfigurationTabBuilderTest.php | 72 --------- .../Configuration/ConfigurationTabTest.php | 79 ---------- 5 files changed, 430 deletions(-) delete mode 100644 library/Icinga/Web/Hook/Configuration/ConfigurationTab.php delete mode 100644 library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php delete mode 100644 library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php delete mode 100644 test/php/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilderTest.php delete mode 100644 test/php/library/Icinga/Web/Hook/Configuration/ConfigurationTabTest.php diff --git a/library/Icinga/Web/Hook/Configuration/ConfigurationTab.php b/library/Icinga/Web/Hook/Configuration/ConfigurationTab.php deleted file mode 100644 index 28538687b..000000000 --- a/library/Icinga/Web/Hook/Configuration/ConfigurationTab.php +++ /dev/null @@ -1,145 +0,0 @@ -setModuleName($name); - - if ($title === null) { - $this->setTitle($name); - } - } - - if ($url !== null) { - $this->setUrl($url); - } - - if ($title !== null) { - $this->setTitle($title); - } - } - - /** - * Setter for title - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * Getter for title - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Setter for url - * @param string $url - */ - public function setUrl($url) - { - $this->url = $url; - } - - /** - * Getter for url - * @return string - */ - public function getUrl() - { - return $this->url; - } - - /** - * Setter for module name - * @param string $moduleName - */ - public function setModuleName($moduleName) - { - $this->moduleName = $moduleName; - } - - private function assertConfiguration() - { - if (!$this->moduleName) { - throw new ProgrammingError('moduleName is missing'); - } - - if (!$this->getUrl()) { - throw new ProgrammingError('url is missing'); - } - - if (!$this->getTitle()) { - throw new ProgrammingError('title is missing'); - } - } - - /** - * Returns a tab configuration to build configuration links - * @return array - */ - public function getTab() - { - $this->assertConfiguration(); - - return array( - 'title' => $this->getTitle(), - 'url' => $this->getUrl() - ); - } - - /** - * Return the tab key - * @return string - */ - public function getModuleName() - { - $this->assertConfiguration(); - return $this->moduleName; - } -} diff --git a/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php b/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php deleted file mode 100644 index c84073e1e..000000000 --- a/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php +++ /dev/null @@ -1,107 +0,0 @@ -setTabs($tabs); - - $this->initializeSystemConfigurationTabs(); - } - - /** - * Setter for tabs - * @param \Icinga\Web\Widget\Tabs $tabs - */ - public function setTabs($tabs) - { - $this->tabs = $tabs; - } - - /** - * Getter for tabs - * @return \Icinga\Web\Widget\Tabs - */ - public function getTabs() - { - return $this->tabs; - } - - /** - * Build the tabs - * - */ - public function build() - { - /** @var ConfigurationTab $configTab */ - $configTab = null; - foreach (Hook::all(self::HOOK_NAMESPACE) as $configTab) { - if (!$configTab instanceof ConfigurationTabInterface) { - throw new ProgrammingError('tab not instance of ConfigTabInterface'); - } - - $this->getTabs()->add($configTab->getModuleName(), $configTab->getTab()); - } - } - - /** - * Initialize system configuration tabs - */ - public function initializeSystemConfigurationTabs() - { - $configurationTab = new ConfigurationTab( - 'configuration', - 'configuration/index', - 'Configuration' - ); - - // Display something about us - Hook::registerObject( - ConfigurationTabBuilder::HOOK_NAMESPACE, - $configurationTab->getModuleName(), - $configurationTab - ); - - $modulesOverviewTab = new ConfigurationTab( - 'modules', - 'modules/overview', - 'Modules' - ); - - Hook::registerObject( - ConfigurationTabBuilder::HOOK_NAMESPACE, - $modulesOverviewTab->getModuleName(), - $modulesOverviewTab - ); - } -} diff --git a/library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php b/library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php deleted file mode 100644 index 064bd8450..000000000 --- a/library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -build(); - $tabs = $builder->getTabs(); - - $this->assertInstanceOf('Icinga\\Web\\Widget\\Tab', $tabs->get('configuration')); - } - - public function testTabCreation1() - { - $widget = new Tabs(); - $builder = new ConfigurationTabBuilder($widget); - - $tab1 = new ConfigurationTab('test1', '/test1', 'TEST1'); - $tab2 = new ConfigurationTab('test2', '/test2', 'TEST2'); - $tab3 = new ConfigurationTab('test3', '/test3', 'TEST3'); - - Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test1', $tab1); - Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test2', $tab2); - Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'test3', $tab3); - - $builder->build(); - - $this->assertCount(5, $builder->getTabs()); - } - - /** - * @expectedException Icinga\Exception\ProgrammingError - * @expectedExceptionMessage tab not instance of ConfigTabInterface - */ - public function testTabCreation2() - { - $widget = new Tabs(); - $builder = new ConfigurationTabBuilder($widget); - - $tab = Mockery::mock('Tab'); - Hook::registerObject(ConfigurationTabBuilder::HOOK_NAMESPACE, 'misc', $tab); - $builder->build(); - - $this->assertCount(5, $builder->getTabs()); - } -} diff --git a/test/php/library/Icinga/Web/Hook/Configuration/ConfigurationTabTest.php b/test/php/library/Icinga/Web/Hook/Configuration/ConfigurationTabTest.php deleted file mode 100644 index 6f9fdaeb1..000000000 --- a/test/php/library/Icinga/Web/Hook/Configuration/ConfigurationTabTest.php +++ /dev/null @@ -1,79 +0,0 @@ -assertEquals('test1', $tab->getModuleName()); - - $testArray = array( - 'title' => 'TEST_TITLE', - 'url' => '/test/$555' - ); - - $this->assertEquals($testArray, $tab->getTab()); - } - - public function testCreate2() - { - $tab = new ConfigurationTab( - 'test2', - '/test/$666' - ); - - $this->assertEquals('test2', $tab->getModuleName()); - - $testArray = array( - 'title' => 'test2', - 'url' => '/test/$666' - ); - - $this->assertEquals($testArray, $tab->getTab()); - } - - /** - * @expectedException Icinga\Exception\ProgrammingError - * @expectedExceptionMessage moduleName is missing - */ - public function testException1() - { - $tab = new ConfigurationTab(); - $tab->getTab(); - } - - /** - * @expectedException Icinga\Exception\ProgrammingError - * @expectedExceptionMessage url is missing - */ - public function testException2() - { - $tab = new ConfigurationTab(); - $tab->setModuleName('DING1'); - $tab->getTab(); - } - - /** - * @expectedException Icinga\Exception\ProgrammingError - * @expectedExceptionMessage title is missing - */ - public function testException3() - { - $tab = new ConfigurationTab(); - $tab->setModuleName('DING1'); - $tab->setUrl('/ding/dong'); - $tab->getTab(); - } -} From 87a59675011a4cf284d8e44c4fb66042ad84c39f Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 27 Aug 2014 11:16:44 +0200 Subject: [PATCH 04/18] Remove leading backslashes from the targets of use statements - use \Exception; + use Exception; --- .../controllers/DashboardController.php | 2 +- application/controllers/StaticController.php | 2 +- .../Config/Authentication/BaseBackendForm.php | 4 ++-- .../Config/Authentication/DbBackendForm.php | 4 ++-- .../Config/Authentication/LdapBackendForm.php | 4 ++-- .../Config/Authentication/ReorderForm.php | 2 +- application/forms/Config/LoggingForm.php | 2 +- application/forms/Preference/GeneralForm.php | 18 +++++++++--------- application/views/helpers/FormDateTime.php | 2 +- .../views/helpers/FormTriStateCheckbox.php | 2 +- library/Icinga/Application/functions.php | 2 +- library/Icinga/Chart/Primitive/Rect.php | 4 ++-- .../Commandpipe/Transport/Transport.php | 2 +- library/Icinga/Protocol/Ldap/Connection.php | 2 +- .../Statusdat/View/MonitoringObjectList.php | 8 ++++---- .../User/Preferences/PreferencesStore.php | 2 +- .../Web/Form/Decorator/ConditionalHidden.php | 2 +- .../Icinga/Web/Form/Element/DateTimePicker.php | 6 +++--- .../Web/Form/Element/TriStateCheckbox.php | 4 ++-- .../Web/Form/Validator/DateFormatValidator.php | 2 +- .../Web/Form/Validator/DateTimeValidator.php | 6 +++--- .../Web/Form/Validator/TimeFormatValidator.php | 2 +- .../Web/Form/Validator/TriStateValidator.php | 2 +- .../Form/Validator/WritablePathValidator.php | 4 ++-- library/Icinga/Web/Hook/TopBarHook.php | 4 ++-- .../Icinga/Web/Session/SessionNamespace.php | 6 +++--- .../controllers/IcingawebController.php | 2 +- .../controllers/ModuleController.php | 2 +- modules/doc/run.php | 2 +- .../controllers/ConfigController.php | 2 +- .../controllers/MonitoringCommands.php | 2 +- .../controllers/TimelineController.php | 6 +++--- .../forms/Command/AcknowledgeForm.php | 8 ++++---- .../forms/Command/MultiCommandFlagForm.php | 8 ++++---- .../Command/SingleArgumentCommandForm.php | 2 +- .../Command/SubmitPassiveCheckResultForm.php | 2 +- .../forms/Config/Backend/CreateBackendForm.php | 2 +- .../Config/Instance/CreateInstanceForm.php | 4 ++-- .../forms/Config/Instance/EditInstanceForm.php | 4 ++-- .../views/helpers/ResolveMacros.php | 2 +- modules/monitoring/bin/action/list.inc.php | 2 +- .../Backend/Ido/Query/StatusSummaryQuery.php | 2 +- .../Exception/UnsupportedBackendException.php | 2 +- .../library/Monitoring/Timeline/TimeEntry.php | 2 +- .../library/Monitoring/Timeline/TimeLine.php | 8 ++++---- .../views/helpers/MonitoringFlagsTest.php | 2 +- .../views/helpers/MonitoringPropertiesTest.php | 2 +- .../views/helpers/ResolveMacrosTest.php | 4 ++-- .../Translation/Cli/TranslationCommand.php | 2 +- .../Config/Authentication/ReorderFormTest.php | 4 ++-- .../library/Icinga/Application/ConfigTest.php | 2 +- .../library/Icinga/Chart/GraphChartTest.php | 4 ++-- test/php/library/Icinga/Chart/PieChartTest.php | 4 ++-- .../Protocol/Commandpipe/CommandPipeTest.php | 2 +- .../library/Icinga/Protocol/Ldap/QueryTest.php | 2 +- 55 files changed, 96 insertions(+), 96 deletions(-) diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index 108117959..dc48dd7f3 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Config; +use Zend_Config; use Icinga\Web\Url; use Icinga\Logger\Logger; use Icinga\Config\PreservingIniWriter; diff --git a/application/controllers/StaticController.php b/application/controllers/StaticController.php index 3a15b1b1e..51b5fdb62 100644 --- a/application/controllers/StaticController.php +++ b/application/controllers/StaticController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Controller_Action_Exception as ActionException; +use Zend_Controller_Action_Exception as ActionException; use Icinga\Web\Controller\ActionController; use Icinga\Application\Icinga; use Icinga\Logger\Logger; diff --git a/application/forms/Config/Authentication/BaseBackendForm.php b/application/forms/Config/Authentication/BaseBackendForm.php index 7a34f236a..f670b25c1 100644 --- a/application/forms/Config/Authentication/BaseBackendForm.php +++ b/application/forms/Config/Authentication/BaseBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use \Zend_Config; -use \Zend_Form_Element_Checkbox; +use Zend_Config; +use Zend_Form_Element_Checkbox; use Icinga\Web\Form; use Icinga\Data\ResourceFactory; use Icinga\Web\Form\Decorator\HelpText; diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 2c57b82e2..82594280b 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use \Exception; -use \Zend_Config; +use Exception; +use Zend_Config; use Icinga\Data\ResourceFactory; use Icinga\Authentication\DbConnection; use Icinga\Authentication\Backend\DbUserBackend; diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index ee90fa95c..89f446795 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use \Exception; -use \Zend_Config; +use Exception; +use Zend_Config; use Icinga\Web\Form; use Icinga\Data\ResourceFactory; use Icinga\Authentication\Backend\LdapUserBackend; diff --git a/application/forms/Config/Authentication/ReorderForm.php b/application/forms/Config/Authentication/ReorderForm.php index a074febea..b4c3cd9b7 100644 --- a/application/forms/Config/Authentication/ReorderForm.php +++ b/application/forms/Config/Authentication/ReorderForm.php @@ -4,7 +4,7 @@ namespace Icinga\Form\Config\Authentication; -use \Zend_Config; +use Zend_Config; use Icinga\Web\Form; /** diff --git a/application/forms/Config/LoggingForm.php b/application/forms/Config/LoggingForm.php index b3b4089c8..1fcb30fa5 100644 --- a/application/forms/Config/LoggingForm.php +++ b/application/forms/Config/LoggingForm.php @@ -4,7 +4,7 @@ namespace Icinga\Form\Config; -use \Zend_Config; +use Zend_Config; use Icinga\Web\Form; use Icinga\Application\Icinga; use Icinga\Web\Form\Validator\WritablePathValidator; diff --git a/application/forms/Preference/GeneralForm.php b/application/forms/Preference/GeneralForm.php index 204ddc51d..5b9a1b95f 100644 --- a/application/forms/Preference/GeneralForm.php +++ b/application/forms/Preference/GeneralForm.php @@ -4,15 +4,15 @@ namespace Icinga\Form\Preference; -use \DateTimeZone; -use \Zend_Config; -use \Zend_Form_Element_Text; -use \Zend_Form_Element_Select; -use \Zend_View_Helper_DateFormat; -use \Icinga\Web\Form; -use \Icinga\Web\Form\Validator\TimeFormatValidator; -use \Icinga\Web\Form\Validator\DateFormatValidator; -use \Icinga\Util\Translator; +use DateTimeZone; +use Zend_Config; +use Zend_Form_Element_Text; +use Zend_Form_Element_Select; +use Zend_View_Helper_DateFormat; +use Icinga\Web\Form; +use Icinga\Web\Form\Validator\TimeFormatValidator; +use Icinga\Web\Form\Validator\DateFormatValidator; +use Icinga\Util\Translator; /** * General user preferences diff --git a/application/views/helpers/FormDateTime.php b/application/views/helpers/FormDateTime.php index 07d5fb930..19a9cc3c5 100644 --- a/application/views/helpers/FormDateTime.php +++ b/application/views/helpers/FormDateTime.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_View_Helper_FormElement; +use Zend_View_Helper_FormElement; /** * Helper to generate a "datetime" element diff --git a/application/views/helpers/FormTriStateCheckbox.php b/application/views/helpers/FormTriStateCheckbox.php index 695c9af56..b69114a11 100644 --- a/application/views/helpers/FormTriStateCheckbox.php +++ b/application/views/helpers/FormTriStateCheckbox.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_View_Helper_FormElement; +use Zend_View_Helper_FormElement; /** * Helper to generate a "datetime" element diff --git a/library/Icinga/Application/functions.php b/library/Icinga/Application/functions.php index cfa5620ba..422dfeab7 100644 --- a/library/Icinga/Application/functions.php +++ b/library/Icinga/Application/functions.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Icinga\Util\Translator; +use Icinga\Util\Translator; if (extension_loaded('gettext')) { function t($messageId) diff --git a/library/Icinga/Chart/Primitive/Rect.php b/library/Icinga/Chart/Primitive/Rect.php index 36b63912f..fc389e204 100644 --- a/library/Icinga/Chart/Primitive/Rect.php +++ b/library/Icinga/Chart/Primitive/Rect.php @@ -4,8 +4,8 @@ namespace Icinga\Chart\Primitive; -use \DomElement; -use \Icinga\Chart\Render\RenderContext; +use DomElement; +use Icinga\Chart\Render\RenderContext; use Icinga\Chart\Format; /** diff --git a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php index c5a5b3883..59119cf13 100644 --- a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php +++ b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php @@ -4,7 +4,7 @@ namespace Icinga\Protocol\Commandpipe\Transport; -use \Zend_Config; +use Zend_Config; /** * Interface for Transport classes handling the concrete access to the command pipe diff --git a/library/Icinga/Protocol/Ldap/Connection.php b/library/Icinga/Protocol/Ldap/Connection.php index edd99d021..531a399c8 100644 --- a/library/Icinga/Protocol/Ldap/Connection.php +++ b/library/Icinga/Protocol/Ldap/Connection.php @@ -8,7 +8,7 @@ use Icinga\Protocol\Ldap\Exception as LdapException; use Icinga\Application\Platform; use Icinga\Application\Config; use Icinga\Logger\Logger; -use \Zend_Config; +use Zend_Config; /** * Backend class managing all the LDAP stuff for you. diff --git a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php index 8c6fdf0bc..e9a7e1bc9 100644 --- a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php +++ b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php @@ -4,10 +4,10 @@ namespace Icinga\Protocol\Statusdat\View; -use \Iterator; -use \Countable; -use \ArrayAccess; -use \Exception; +use Iterator; +use Countable; +use ArrayAccess; +use Exception; /** * Wrapper around an array of monitoring objects that can be enhanced with an optional diff --git a/library/Icinga/User/Preferences/PreferencesStore.php b/library/Icinga/User/Preferences/PreferencesStore.php index 749d054dc..b8121eb25 100644 --- a/library/Icinga/User/Preferences/PreferencesStore.php +++ b/library/Icinga/User/Preferences/PreferencesStore.php @@ -4,7 +4,7 @@ namespace Icinga\User\Preferences; -use \Zend_Config; +use Zend_Config; use Icinga\User; use Icinga\User\Preferences; use Icinga\Data\ResourceFactory; diff --git a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php index 5d29caee4..c24f637ba 100644 --- a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php +++ b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Decorator; -use \Zend_Form_Decorator_Abstract; +use Zend_Form_Decorator_Abstract; /** * Decorator to hide elements using a >noscript< tag instead of diff --git a/library/Icinga/Web/Form/Element/DateTimePicker.php b/library/Icinga/Web/Form/Element/DateTimePicker.php index 911e26322..dd48bd7f2 100644 --- a/library/Icinga/Web/Form/Element/DateTimePicker.php +++ b/library/Icinga/Web/Form/Element/DateTimePicker.php @@ -5,9 +5,9 @@ namespace Icinga\Web\Form\Element; use Icinga\Web\Form\Validator\DateTimeValidator; -use \Zend_Form_Element_Text; -use \Zend_Form_Element; -use \Icinga\Util\DateTimeFactory; +use Zend_Form_Element_Text; +use Zend_Form_Element; +use Icinga\Util\DateTimeFactory; /** * Datetime form element which returns the input as Unix timestamp after the input has been proven valid. Utilizes diff --git a/library/Icinga/Web/Form/Element/TriStateCheckbox.php b/library/Icinga/Web/Form/Element/TriStateCheckbox.php index fb6ffb692..45763880d 100644 --- a/library/Icinga/Web/Form/Element/TriStateCheckbox.php +++ b/library/Icinga/Web/Form/Element/TriStateCheckbox.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Form\Element; -use \Icinga\Web\Form\Validator\TriStateValidator; -use \Zend_Form_Element_Xhtml; +use Icinga\Web\Form\Validator\TriStateValidator; +use Zend_Form_Element_Xhtml; /** * A checkbox that can display three different states: diff --git a/library/Icinga/Web/Form/Validator/DateFormatValidator.php b/library/Icinga/Web/Form/Validator/DateFormatValidator.php index 2b2a413fd..b11629cbf 100644 --- a/library/Icinga/Web/Form/Validator/DateFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/DateFormatValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; +use Zend_Validate_Abstract; /** * Validator that checks if a textfield contains a correct date format diff --git a/library/Icinga/Web/Form/Validator/DateTimeValidator.php b/library/Icinga/Web/Form/Validator/DateTimeValidator.php index 952ac6c86..f1952f7d4 100644 --- a/library/Icinga/Web/Form/Validator/DateTimeValidator.php +++ b/library/Icinga/Web/Form/Validator/DateTimeValidator.php @@ -4,9 +4,9 @@ namespace Icinga\Web\Form\Validator; -use \Icinga\Util\DateTimeFactory; -use \Zend_Validate_Abstract; -use \Icinga\Exception\ProgrammingError; +use Icinga\Util\DateTimeFactory; +use Zend_Validate_Abstract; +use Icinga\Exception\ProgrammingError; /** * Validator that checks if a textfield contains a correct date format diff --git a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php index 1715f7fdb..a02581cfa 100644 --- a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; +use Zend_Validate_Abstract; /** * Validator that checks if a textfield contains a correct time format diff --git a/library/Icinga/Web/Form/Validator/TriStateValidator.php b/library/Icinga/Web/Form/Validator/TriStateValidator.php index f05f35b27..e51e00e21 100644 --- a/library/Icinga/Web/Form/Validator/TriStateValidator.php +++ b/library/Icinga/Web/Form/Validator/TriStateValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; +use Zend_Validate_Abstract; class TriStateValidator extends Zend_Validate_Abstract { diff --git a/library/Icinga/Web/Form/Validator/WritablePathValidator.php b/library/Icinga/Web/Form/Validator/WritablePathValidator.php index 1381da9c7..8387c5cf5 100644 --- a/library/Icinga/Web/Form/Validator/WritablePathValidator.php +++ b/library/Icinga/Web/Form/Validator/WritablePathValidator.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; -use \Icinga\Application\Config as IcingaConfig; +use Zend_Validate_Abstract; +use Icinga\Application\Config as IcingaConfig; /** * Validator that interprets the value as a path and checks if it's writable diff --git a/library/Icinga/Web/Hook/TopBarHook.php b/library/Icinga/Web/Hook/TopBarHook.php index 695d81109..fb637015d 100644 --- a/library/Icinga/Web/Hook/TopBarHook.php +++ b/library/Icinga/Web/Hook/TopBarHook.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Hook; -use \Icinga\Web\Request; -use \Zend_View; +use Icinga\Web\Request; +use Zend_View; /** * Hook to extend topbar items diff --git a/library/Icinga/Web/Session/SessionNamespace.php b/library/Icinga/Web/Session/SessionNamespace.php index 8862d343f..682991aed 100644 --- a/library/Icinga/Web/Session/SessionNamespace.php +++ b/library/Icinga/Web/Session/SessionNamespace.php @@ -4,9 +4,9 @@ namespace Icinga\Web\Session; -use \Exception; -use \ArrayIterator; -use \IteratorAggregate; +use Exception; +use ArrayIterator; +use IteratorAggregate; /** * Container for session values diff --git a/modules/doc/application/controllers/IcingawebController.php b/modules/doc/application/controllers/IcingawebController.php index 967a2b768..ecbe3a6ee 100644 --- a/modules/doc/application/controllers/IcingawebController.php +++ b/modules/doc/application/controllers/IcingawebController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Controller_Action_Exception; +use Zend_Controller_Action_Exception; use Icinga\Application\Icinga; use Icinga\Module\Doc\DocController; diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php index 40913368c..fa6c69d19 100644 --- a/modules/doc/application/controllers/ModuleController.php +++ b/modules/doc/application/controllers/ModuleController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Controller_Action_Exception; +use Zend_Controller_Action_Exception; use Icinga\Application\Icinga; use Icinga\Module\Doc\DocController; use Icinga\Module\Doc\Exception\DocException; diff --git a/modules/doc/run.php b/modules/doc/run.php index 7392e4c22..5edb69093 100644 --- a/modules/doc/run.php +++ b/modules/doc/run.php @@ -1,6 +1,6 @@ isCli()) { diff --git a/modules/monitoring/application/controllers/ConfigController.php b/modules/monitoring/application/controllers/ConfigController.php index f0982c29a..f0322dc3f 100644 --- a/modules/monitoring/application/controllers/ConfigController.php +++ b/modules/monitoring/application/controllers/ConfigController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Exception; +use Exception; use Icinga\Config\PreservingIniWriter; use Icinga\Web\Controller\ModuleActionController; diff --git a/modules/monitoring/application/controllers/MonitoringCommands.php b/modules/monitoring/application/controllers/MonitoringCommands.php index faa04114e..16b713d4c 100644 --- a/modules/monitoring/application/controllers/MonitoringCommands.php +++ b/modules/monitoring/application/controllers/MonitoringCommands.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Icinga\Module\Monitoring\Command\Meta; +use Icinga\Module\Monitoring\Command\Meta; /** * Class MonitoringCommands diff --git a/modules/monitoring/application/controllers/TimelineController.php b/modules/monitoring/application/controllers/TimelineController.php index 3fa621f3e..2f9b1339d 100644 --- a/modules/monitoring/application/controllers/TimelineController.php +++ b/modules/monitoring/application/controllers/TimelineController.php @@ -2,9 +2,9 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \DateTime; -use \DateInterval; -use \Zend_Config; +use DateTime; +use DateInterval; +use Zend_Config; use Icinga\Web\Url; use Icinga\Util\Format; use Icinga\Application\Config; diff --git a/modules/monitoring/application/forms/Command/AcknowledgeForm.php b/modules/monitoring/application/forms/Command/AcknowledgeForm.php index 364c3c20a..4ac4901b0 100644 --- a/modules/monitoring/application/forms/Command/AcknowledgeForm.php +++ b/modules/monitoring/application/forms/Command/AcknowledgeForm.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Form\Command; -use \Icinga\Web\Form\Element\DateTimePicker; -use \Icinga\Protocol\Commandpipe\Comment; -use \Icinga\Util\DateTimeFactory; -use \Icinga\Module\Monitoring\Command\AcknowledgeCommand; +use Icinga\Web\Form\Element\DateTimePicker; +use Icinga\Protocol\Commandpipe\Comment; +use Icinga\Util\DateTimeFactory; +use Icinga\Module\Monitoring\Command\AcknowledgeCommand; /** * Form for problem acknowledgements diff --git a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php index 6d49580a0..e413848c8 100644 --- a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php +++ b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Form\Command; -use \Icinga\Web\Form\Element\TriStateCheckbox; -use \Icinga\Web\Form; -use \Zend_Form_Element_Hidden; -use \Zend_Form; +use Icinga\Web\Form\Element\TriStateCheckbox; +use Icinga\Web\Form; +use Zend_Form_Element_Hidden; +use Zend_Form; /** * A form to edit multiple command flags of multiple commands at once. When some commands have diff --git a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php index 7333ccdac..d7228ebdf 100644 --- a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php +++ b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Monitoring\Form\Command; use Zend_Controller_Request_Abstract; -use \Zend_Form_Element_Hidden; +use Zend_Form_Element_Hidden; use Icinga\Module\Monitoring\Command\AcknowledgeCommand; use Icinga\Module\Monitoring\Command\SingleArgumentCommand; diff --git a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php index de2965565..c2c9151f3 100644 --- a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php +++ b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Form\Command; -use \Icinga\Exception\ProgrammingError; +use Icinga\Exception\ProgrammingError; /** * Form for submitting passive check results diff --git a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php index 513dea238..6acc210ae 100644 --- a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php +++ b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Form\Config\Backend; -use \Zend_Config; +use Zend_Config; /** * Extended EditBackendForm for creating new Backends diff --git a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php index 705804bb9..077e02183 100644 --- a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php @@ -4,8 +4,8 @@ namespace Icinga\Module\Monitoring\Form\Config\Instance; -use \Icinga\Web\Form; -use \Zend_Config; +use Icinga\Web\Form; +use Zend_Config; /** * Form for creating new instances diff --git a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php index e2a091c0f..f74b091df 100644 --- a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php @@ -4,8 +4,8 @@ namespace Icinga\Module\Monitoring\Form\Config\Instance; -use \Zend_Config; -use \Icinga\Web\Form; +use Zend_Config; +use Icinga\Web\Form; /** * Form for editing existing instances diff --git a/modules/monitoring/application/views/helpers/ResolveMacros.php b/modules/monitoring/application/views/helpers/ResolveMacros.php index b0f007b19..24471449c 100644 --- a/modules/monitoring/application/views/helpers/ResolveMacros.php +++ b/modules/monitoring/application/views/helpers/ResolveMacros.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_View_Helper_Abstract; +use Zend_View_Helper_Abstract; use Icinga\Module\Monitoring\Object\AbstractObject; class Zend_View_Helper_ResolveMacros extends Zend_View_Helper_Abstract diff --git a/modules/monitoring/bin/action/list.inc.php b/modules/monitoring/bin/action/list.inc.php index 65a0ca61d..01fd35131 100644 --- a/modules/monitoring/bin/action/list.inc.php +++ b/modules/monitoring/bin/action/list.inc.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Icinga\Module\Monitoring\Backend; +use Icinga\Module\Monitoring\Backend; use Icinga\Util\Format; $backend = Backend::getInstance($params->shift('backend')); diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php index ce61c8f1b..75db67b55 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query; -use \Zend_Db_Select; +use Zend_Db_Select; class StatusSummaryQuery extends IdoQuery { diff --git a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php index b0cd1b445..3e1468e36 100644 --- a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php +++ b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Exception; -use \Exception; +use Exception; class UnsupportedBackendException extends Exception { diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php b/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php index 615999bdb..bd83a42cd 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Timeline; -use \DateTime; +use DateTime; use Icinga\Web\Url; use Icinga\Exception\ProgrammingError; diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php index fa5af9141..2b0158bf1 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Timeline; -use \DateTime; -use \Exception; -use \ArrayIterator; -use \IteratorAggregate; +use DateTime; +use Exception; +use ArrayIterator; +use IteratorAggregate; use Icinga\Data\Filter\Filter; use Icinga\Web\Hook; use Icinga\Web\Session; diff --git a/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php b/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php index 961aefca5..f50b07893 100644 --- a/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php +++ b/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers; -use \Zend_View_Helper_MonitoringFlags; +use Zend_View_Helper_MonitoringFlags; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringFlags.php'); diff --git a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php index aa13df35e..5a476aaef 100644 --- a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php +++ b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php @@ -4,7 +4,7 @@ namespace Test\Modules\Monitoring\Application\Views\Helpers; -use \Zend_View_Helper_MonitoringProperties; +use Zend_View_Helper_MonitoringProperties; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringProperties.php'); diff --git a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php index 374578947..a14f64ae7 100644 --- a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php +++ b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Modules\Monitoring\Application\Views\Helpers; -use \Mockery; -use \Zend_View_Helper_ResolveMacros; +use Mockery; +use Zend_View_Helper_ResolveMacros; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/ResolveMacros.php'); diff --git a/modules/translation/library/Translation/Cli/TranslationCommand.php b/modules/translation/library/Translation/Cli/TranslationCommand.php index 417d9d6ed..b3cfc6de4 100644 --- a/modules/translation/library/Translation/Cli/TranslationCommand.php +++ b/modules/translation/library/Translation/Cli/TranslationCommand.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Translation\Cli; -use \Exception; +use Exception; use Icinga\Cli\Command; /** diff --git a/test/php/application/forms/Config/Authentication/ReorderFormTest.php b/test/php/application/forms/Config/Authentication/ReorderFormTest.php index a61efc48a..808806f1a 100644 --- a/test/php/application/forms/Config/Authentication/ReorderFormTest.php +++ b/test/php/application/forms/Config/Authentication/ReorderFormTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Form\Config\Authentication; -use \Mockery; -use \Zend_Config; +use Mockery; +use Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Form\Config\Authentication\ReorderForm; diff --git a/test/php/library/Icinga/Application/ConfigTest.php b/test/php/library/Icinga/Application/ConfigTest.php index bc39afecd..e99b17b2e 100644 --- a/test/php/library/Icinga/Application/ConfigTest.php +++ b/test/php/library/Icinga/Application/ConfigTest.php @@ -5,7 +5,7 @@ namespace Tests\Icinga\Application; use Icinga\Test\BaseTestCase; -use \Icinga\Application\Config as IcingaConfig; +use Icinga\Application\Config as IcingaConfig; class ConfigTest extends BaseTestCase { diff --git a/test/php/library/Icinga/Chart/GraphChartTest.php b/test/php/library/Icinga/Chart/GraphChartTest.php index 25870791a..6a7f73864 100644 --- a/test/php/library/Icinga/Chart/GraphChartTest.php +++ b/test/php/library/Icinga/Chart/GraphChartTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Chart; -use \DOMXPath; -use \DOMDocument; +use DOMXPath; +use DOMDocument; use Icinga\Chart\GridChart; use Icinga\Test\BaseTestCase; diff --git a/test/php/library/Icinga/Chart/PieChartTest.php b/test/php/library/Icinga/Chart/PieChartTest.php index c09f29e57..756fdf6e6 100644 --- a/test/php/library/Icinga/Chart/PieChartTest.php +++ b/test/php/library/Icinga/Chart/PieChartTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Chart; -use \DOMXPath; -use \DOMDocument; +use DOMXPath; +use DOMDocument; use Icinga\Chart\PieChart; use Icinga\Test\BaseTestCase; diff --git a/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php b/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php index 0ec9a4da6..7d3fd94f6 100644 --- a/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php +++ b/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Protocol\Commandpipe; -use \Zend_Config; +use Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Protocol\Commandpipe\Comment; use Icinga\Protocol\Commandpipe\CommandPipe; diff --git a/test/php/library/Icinga/Protocol/Ldap/QueryTest.php b/test/php/library/Icinga/Protocol/Ldap/QueryTest.php index 0fa155202..b710a0934 100644 --- a/test/php/library/Icinga/Protocol/Ldap/QueryTest.php +++ b/test/php/library/Icinga/Protocol/Ldap/QueryTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Protocol\Ldap; -use \Zend_Config; +use Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Protocol\Ldap\Connection; From e0d7c3855dec7fe92fedb253264299f6ff0be0c1 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 27 Aug 2014 11:13:41 +0200 Subject: [PATCH 05/18] Hook: Add class suffix for base class testing refs #6928 --- library/Icinga/Web/Hook.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/Hook.php b/library/Icinga/Web/Hook.php index 76200493a..b88069da1 100644 --- a/library/Icinga/Web/Hook.php +++ b/library/Icinga/Web/Hook.php @@ -41,6 +41,15 @@ class Hook */ public static $BASE_NS = 'Icinga\\Web\\Hook\\'; + /** + * Append this string to base class + * + * All base classes renamed to *Hook + * + * @var string + */ + public static $classSuffix = 'Hook'; + /** * Reset object state */ @@ -114,7 +123,7 @@ class Hook */ private static function assertValidHook($instance, $name) { - $base_class = self::$BASE_NS . ucfirst($name); + $base_class = self::$BASE_NS . ucfirst($name) . self::$classSuffix; if (!$instance instanceof $base_class) { throw new ProgrammingError( '%s is not an instance of %s', From b7ae66b496e750836cd619b898f5fb72475e7187 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 27 Aug 2014 11:23:03 +0200 Subject: [PATCH 06/18] Hook: Add web hook base class refs #6929 --- library/Icinga/Web/Hook/WebBaseHook.php | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 library/Icinga/Web/Hook/WebBaseHook.php diff --git a/library/Icinga/Web/Hook/WebBaseHook.php b/library/Icinga/Web/Hook/WebBaseHook.php new file mode 100644 index 000000000..a901787bb --- /dev/null +++ b/library/Icinga/Web/Hook/WebBaseHook.php @@ -0,0 +1,51 @@ +view = $view; + } + + /** + * Get the view instance + * + * @return Zend_View + */ + public function getView() + { + if ($this->view === null) { + $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); + if ($viewRenderer->view === null) { + $viewRenderer->initView(); + } + $this->view = $viewRenderer->view; + } + + return $this->view; + } +} \ No newline at end of file From 88698cb05dfdc3f3c8d8d852bbf04e32209d3ffe Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 27 Aug 2014 11:28:31 +0200 Subject: [PATCH 07/18] Hook/TopBar: Rework interface for monitoring top bar refs #6929 --- application/controllers/LayoutController.php | 4 ++-- library/Icinga/Web/Hook/TopBarHook.php | 5 ++--- modules/monitoring/library/Monitoring/Web/Hook/TopBar.php | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/application/controllers/LayoutController.php b/application/controllers/LayoutController.php index 952c4ee61..6c1355fc1 100644 --- a/application/controllers/LayoutController.php +++ b/application/controllers/LayoutController.php @@ -31,11 +31,11 @@ class LayoutController extends ActionController { $topbarHtmlParts = array(); - /** @var Hook\Layout\TopBar $hook */ + /** @var Hook\TopBarHook $hook */ $hook = null; foreach (Hook::all('TopBar') as $hook) { - $topbarHtmlParts[] = $hook->getHtml($this->getRequest(), $this->view); + $topbarHtmlParts[] = $hook->getHtml($this->getRequest()); } $this->view->topbarHtmlParts = $topbarHtmlParts; diff --git a/library/Icinga/Web/Hook/TopBarHook.php b/library/Icinga/Web/Hook/TopBarHook.php index fb637015d..183a0ca07 100644 --- a/library/Icinga/Web/Hook/TopBarHook.php +++ b/library/Icinga/Web/Hook/TopBarHook.php @@ -10,15 +10,14 @@ use Zend_View; /** * Hook to extend topbar items */ -abstract class TopBarHook +abstract class TopBarHook extends WebBaseHook { /** * Function to generate top bar content * * @param Request $request - * @param Zend_View $view * * @return string */ - abstract public function getHtml($request, $view); + abstract public function getHtml($request); } diff --git a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php index 9433bf805..082a03c5b 100644 --- a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php +++ b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php @@ -18,11 +18,10 @@ class TopBar extends TopBarHook * Function to generate top bar content * * @param Request $request - * @param Zend_View $view * * @return string */ - public function getHtml($request, $view) + public function getHtml($request) { $hostSummary = StatusSummaryView::fromRequest( $request, @@ -50,7 +49,7 @@ class TopBar extends TopBarHook ) )->getQuery()->fetchRow(); - return $view->partial( + return $this->getView()->partial( 'layout/topbar.phtml', 'monitoring', array( From 1dea19504f4665975284c298dc221b7c5fcedb96 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 27 Aug 2014 12:24:11 +0200 Subject: [PATCH 08/18] Revert "Remove leading backslashes from the targets of use statements" This reverts commit 87a59675011a4cf284d8e44c4fb66042ad84c39f. At least 'modules/doc/run.php' issues a warning about "The use statement with non-compound name 'Zend_Controller_Router_Route' has no effect" --- .../controllers/DashboardController.php | 2 +- application/controllers/StaticController.php | 2 +- .../Config/Authentication/BaseBackendForm.php | 4 ++-- .../Config/Authentication/DbBackendForm.php | 4 ++-- .../Config/Authentication/LdapBackendForm.php | 4 ++-- .../Config/Authentication/ReorderForm.php | 2 +- application/forms/Config/LoggingForm.php | 2 +- application/forms/Preference/GeneralForm.php | 18 +++++++++--------- application/views/helpers/FormDateTime.php | 2 +- .../views/helpers/FormTriStateCheckbox.php | 2 +- library/Icinga/Application/functions.php | 2 +- library/Icinga/Chart/Primitive/Rect.php | 4 ++-- .../Commandpipe/Transport/Transport.php | 2 +- library/Icinga/Protocol/Ldap/Connection.php | 2 +- .../Statusdat/View/MonitoringObjectList.php | 8 ++++---- .../User/Preferences/PreferencesStore.php | 2 +- .../Web/Form/Decorator/ConditionalHidden.php | 2 +- .../Icinga/Web/Form/Element/DateTimePicker.php | 6 +++--- .../Web/Form/Element/TriStateCheckbox.php | 4 ++-- .../Web/Form/Validator/DateFormatValidator.php | 2 +- .../Web/Form/Validator/DateTimeValidator.php | 6 +++--- .../Web/Form/Validator/TimeFormatValidator.php | 2 +- .../Web/Form/Validator/TriStateValidator.php | 2 +- .../Form/Validator/WritablePathValidator.php | 4 ++-- library/Icinga/Web/Hook/TopBarHook.php | 4 ++-- .../Icinga/Web/Session/SessionNamespace.php | 6 +++--- .../controllers/IcingawebController.php | 2 +- .../controllers/ModuleController.php | 2 +- modules/doc/run.php | 2 +- .../controllers/ConfigController.php | 2 +- .../controllers/MonitoringCommands.php | 2 +- .../controllers/TimelineController.php | 6 +++--- .../forms/Command/AcknowledgeForm.php | 8 ++++---- .../forms/Command/MultiCommandFlagForm.php | 8 ++++---- .../Command/SingleArgumentCommandForm.php | 2 +- .../Command/SubmitPassiveCheckResultForm.php | 2 +- .../forms/Config/Backend/CreateBackendForm.php | 2 +- .../Config/Instance/CreateInstanceForm.php | 4 ++-- .../forms/Config/Instance/EditInstanceForm.php | 4 ++-- .../views/helpers/ResolveMacros.php | 2 +- modules/monitoring/bin/action/list.inc.php | 2 +- .../Backend/Ido/Query/StatusSummaryQuery.php | 2 +- .../Exception/UnsupportedBackendException.php | 2 +- .../library/Monitoring/Timeline/TimeEntry.php | 2 +- .../library/Monitoring/Timeline/TimeLine.php | 8 ++++---- .../views/helpers/MonitoringFlagsTest.php | 2 +- .../views/helpers/MonitoringPropertiesTest.php | 2 +- .../views/helpers/ResolveMacrosTest.php | 4 ++-- .../Translation/Cli/TranslationCommand.php | 2 +- .../Config/Authentication/ReorderFormTest.php | 4 ++-- .../library/Icinga/Application/ConfigTest.php | 2 +- .../library/Icinga/Chart/GraphChartTest.php | 4 ++-- test/php/library/Icinga/Chart/PieChartTest.php | 4 ++-- .../Protocol/Commandpipe/CommandPipeTest.php | 2 +- .../library/Icinga/Protocol/Ldap/QueryTest.php | 2 +- 55 files changed, 96 insertions(+), 96 deletions(-) diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index dc48dd7f3..108117959 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Zend_Config; +use \Zend_Config; use Icinga\Web\Url; use Icinga\Logger\Logger; use Icinga\Config\PreservingIniWriter; diff --git a/application/controllers/StaticController.php b/application/controllers/StaticController.php index 51b5fdb62..3a15b1b1e 100644 --- a/application/controllers/StaticController.php +++ b/application/controllers/StaticController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Zend_Controller_Action_Exception as ActionException; +use \Zend_Controller_Action_Exception as ActionException; use Icinga\Web\Controller\ActionController; use Icinga\Application\Icinga; use Icinga\Logger\Logger; diff --git a/application/forms/Config/Authentication/BaseBackendForm.php b/application/forms/Config/Authentication/BaseBackendForm.php index f670b25c1..7a34f236a 100644 --- a/application/forms/Config/Authentication/BaseBackendForm.php +++ b/application/forms/Config/Authentication/BaseBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use Zend_Config; -use Zend_Form_Element_Checkbox; +use \Zend_Config; +use \Zend_Form_Element_Checkbox; use Icinga\Web\Form; use Icinga\Data\ResourceFactory; use Icinga\Web\Form\Decorator\HelpText; diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 82594280b..2c57b82e2 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use Exception; -use Zend_Config; +use \Exception; +use \Zend_Config; use Icinga\Data\ResourceFactory; use Icinga\Authentication\DbConnection; use Icinga\Authentication\Backend\DbUserBackend; diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 89f446795..ee90fa95c 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use Exception; -use Zend_Config; +use \Exception; +use \Zend_Config; use Icinga\Web\Form; use Icinga\Data\ResourceFactory; use Icinga\Authentication\Backend\LdapUserBackend; diff --git a/application/forms/Config/Authentication/ReorderForm.php b/application/forms/Config/Authentication/ReorderForm.php index b4c3cd9b7..a074febea 100644 --- a/application/forms/Config/Authentication/ReorderForm.php +++ b/application/forms/Config/Authentication/ReorderForm.php @@ -4,7 +4,7 @@ namespace Icinga\Form\Config\Authentication; -use Zend_Config; +use \Zend_Config; use Icinga\Web\Form; /** diff --git a/application/forms/Config/LoggingForm.php b/application/forms/Config/LoggingForm.php index 1fcb30fa5..b3b4089c8 100644 --- a/application/forms/Config/LoggingForm.php +++ b/application/forms/Config/LoggingForm.php @@ -4,7 +4,7 @@ namespace Icinga\Form\Config; -use Zend_Config; +use \Zend_Config; use Icinga\Web\Form; use Icinga\Application\Icinga; use Icinga\Web\Form\Validator\WritablePathValidator; diff --git a/application/forms/Preference/GeneralForm.php b/application/forms/Preference/GeneralForm.php index 5b9a1b95f..204ddc51d 100644 --- a/application/forms/Preference/GeneralForm.php +++ b/application/forms/Preference/GeneralForm.php @@ -4,15 +4,15 @@ namespace Icinga\Form\Preference; -use DateTimeZone; -use Zend_Config; -use Zend_Form_Element_Text; -use Zend_Form_Element_Select; -use Zend_View_Helper_DateFormat; -use Icinga\Web\Form; -use Icinga\Web\Form\Validator\TimeFormatValidator; -use Icinga\Web\Form\Validator\DateFormatValidator; -use Icinga\Util\Translator; +use \DateTimeZone; +use \Zend_Config; +use \Zend_Form_Element_Text; +use \Zend_Form_Element_Select; +use \Zend_View_Helper_DateFormat; +use \Icinga\Web\Form; +use \Icinga\Web\Form\Validator\TimeFormatValidator; +use \Icinga\Web\Form\Validator\DateFormatValidator; +use \Icinga\Util\Translator; /** * General user preferences diff --git a/application/views/helpers/FormDateTime.php b/application/views/helpers/FormDateTime.php index 19a9cc3c5..07d5fb930 100644 --- a/application/views/helpers/FormDateTime.php +++ b/application/views/helpers/FormDateTime.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Zend_View_Helper_FormElement; +use \Zend_View_Helper_FormElement; /** * Helper to generate a "datetime" element diff --git a/application/views/helpers/FormTriStateCheckbox.php b/application/views/helpers/FormTriStateCheckbox.php index b69114a11..695c9af56 100644 --- a/application/views/helpers/FormTriStateCheckbox.php +++ b/application/views/helpers/FormTriStateCheckbox.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Zend_View_Helper_FormElement; +use \Zend_View_Helper_FormElement; /** * Helper to generate a "datetime" element diff --git a/library/Icinga/Application/functions.php b/library/Icinga/Application/functions.php index 422dfeab7..cfa5620ba 100644 --- a/library/Icinga/Application/functions.php +++ b/library/Icinga/Application/functions.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Icinga\Util\Translator; +use \Icinga\Util\Translator; if (extension_loaded('gettext')) { function t($messageId) diff --git a/library/Icinga/Chart/Primitive/Rect.php b/library/Icinga/Chart/Primitive/Rect.php index fc389e204..36b63912f 100644 --- a/library/Icinga/Chart/Primitive/Rect.php +++ b/library/Icinga/Chart/Primitive/Rect.php @@ -4,8 +4,8 @@ namespace Icinga\Chart\Primitive; -use DomElement; -use Icinga\Chart\Render\RenderContext; +use \DomElement; +use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Format; /** diff --git a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php index 59119cf13..c5a5b3883 100644 --- a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php +++ b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php @@ -4,7 +4,7 @@ namespace Icinga\Protocol\Commandpipe\Transport; -use Zend_Config; +use \Zend_Config; /** * Interface for Transport classes handling the concrete access to the command pipe diff --git a/library/Icinga/Protocol/Ldap/Connection.php b/library/Icinga/Protocol/Ldap/Connection.php index 531a399c8..edd99d021 100644 --- a/library/Icinga/Protocol/Ldap/Connection.php +++ b/library/Icinga/Protocol/Ldap/Connection.php @@ -8,7 +8,7 @@ use Icinga\Protocol\Ldap\Exception as LdapException; use Icinga\Application\Platform; use Icinga\Application\Config; use Icinga\Logger\Logger; -use Zend_Config; +use \Zend_Config; /** * Backend class managing all the LDAP stuff for you. diff --git a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php index e9a7e1bc9..8c6fdf0bc 100644 --- a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php +++ b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php @@ -4,10 +4,10 @@ namespace Icinga\Protocol\Statusdat\View; -use Iterator; -use Countable; -use ArrayAccess; -use Exception; +use \Iterator; +use \Countable; +use \ArrayAccess; +use \Exception; /** * Wrapper around an array of monitoring objects that can be enhanced with an optional diff --git a/library/Icinga/User/Preferences/PreferencesStore.php b/library/Icinga/User/Preferences/PreferencesStore.php index b8121eb25..749d054dc 100644 --- a/library/Icinga/User/Preferences/PreferencesStore.php +++ b/library/Icinga/User/Preferences/PreferencesStore.php @@ -4,7 +4,7 @@ namespace Icinga\User\Preferences; -use Zend_Config; +use \Zend_Config; use Icinga\User; use Icinga\User\Preferences; use Icinga\Data\ResourceFactory; diff --git a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php index c24f637ba..5d29caee4 100644 --- a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php +++ b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Decorator; -use Zend_Form_Decorator_Abstract; +use \Zend_Form_Decorator_Abstract; /** * Decorator to hide elements using a >noscript< tag instead of diff --git a/library/Icinga/Web/Form/Element/DateTimePicker.php b/library/Icinga/Web/Form/Element/DateTimePicker.php index dd48bd7f2..911e26322 100644 --- a/library/Icinga/Web/Form/Element/DateTimePicker.php +++ b/library/Icinga/Web/Form/Element/DateTimePicker.php @@ -5,9 +5,9 @@ namespace Icinga\Web\Form\Element; use Icinga\Web\Form\Validator\DateTimeValidator; -use Zend_Form_Element_Text; -use Zend_Form_Element; -use Icinga\Util\DateTimeFactory; +use \Zend_Form_Element_Text; +use \Zend_Form_Element; +use \Icinga\Util\DateTimeFactory; /** * Datetime form element which returns the input as Unix timestamp after the input has been proven valid. Utilizes diff --git a/library/Icinga/Web/Form/Element/TriStateCheckbox.php b/library/Icinga/Web/Form/Element/TriStateCheckbox.php index 45763880d..fb6ffb692 100644 --- a/library/Icinga/Web/Form/Element/TriStateCheckbox.php +++ b/library/Icinga/Web/Form/Element/TriStateCheckbox.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Form\Element; -use Icinga\Web\Form\Validator\TriStateValidator; -use Zend_Form_Element_Xhtml; +use \Icinga\Web\Form\Validator\TriStateValidator; +use \Zend_Form_Element_Xhtml; /** * A checkbox that can display three different states: diff --git a/library/Icinga/Web/Form/Validator/DateFormatValidator.php b/library/Icinga/Web/Form/Validator/DateFormatValidator.php index b11629cbf..2b2a413fd 100644 --- a/library/Icinga/Web/Form/Validator/DateFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/DateFormatValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use Zend_Validate_Abstract; +use \Zend_Validate_Abstract; /** * Validator that checks if a textfield contains a correct date format diff --git a/library/Icinga/Web/Form/Validator/DateTimeValidator.php b/library/Icinga/Web/Form/Validator/DateTimeValidator.php index f1952f7d4..952ac6c86 100644 --- a/library/Icinga/Web/Form/Validator/DateTimeValidator.php +++ b/library/Icinga/Web/Form/Validator/DateTimeValidator.php @@ -4,9 +4,9 @@ namespace Icinga\Web\Form\Validator; -use Icinga\Util\DateTimeFactory; -use Zend_Validate_Abstract; -use Icinga\Exception\ProgrammingError; +use \Icinga\Util\DateTimeFactory; +use \Zend_Validate_Abstract; +use \Icinga\Exception\ProgrammingError; /** * Validator that checks if a textfield contains a correct date format diff --git a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php index a02581cfa..1715f7fdb 100644 --- a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use Zend_Validate_Abstract; +use \Zend_Validate_Abstract; /** * Validator that checks if a textfield contains a correct time format diff --git a/library/Icinga/Web/Form/Validator/TriStateValidator.php b/library/Icinga/Web/Form/Validator/TriStateValidator.php index e51e00e21..f05f35b27 100644 --- a/library/Icinga/Web/Form/Validator/TriStateValidator.php +++ b/library/Icinga/Web/Form/Validator/TriStateValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use Zend_Validate_Abstract; +use \Zend_Validate_Abstract; class TriStateValidator extends Zend_Validate_Abstract { diff --git a/library/Icinga/Web/Form/Validator/WritablePathValidator.php b/library/Icinga/Web/Form/Validator/WritablePathValidator.php index 8387c5cf5..1381da9c7 100644 --- a/library/Icinga/Web/Form/Validator/WritablePathValidator.php +++ b/library/Icinga/Web/Form/Validator/WritablePathValidator.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Form\Validator; -use Zend_Validate_Abstract; -use Icinga\Application\Config as IcingaConfig; +use \Zend_Validate_Abstract; +use \Icinga\Application\Config as IcingaConfig; /** * Validator that interprets the value as a path and checks if it's writable diff --git a/library/Icinga/Web/Hook/TopBarHook.php b/library/Icinga/Web/Hook/TopBarHook.php index 183a0ca07..867b4f721 100644 --- a/library/Icinga/Web/Hook/TopBarHook.php +++ b/library/Icinga/Web/Hook/TopBarHook.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Hook; -use Icinga\Web\Request; -use Zend_View; +use \Icinga\Web\Request; +use \Zend_View; /** * Hook to extend topbar items diff --git a/library/Icinga/Web/Session/SessionNamespace.php b/library/Icinga/Web/Session/SessionNamespace.php index 682991aed..8862d343f 100644 --- a/library/Icinga/Web/Session/SessionNamespace.php +++ b/library/Icinga/Web/Session/SessionNamespace.php @@ -4,9 +4,9 @@ namespace Icinga\Web\Session; -use Exception; -use ArrayIterator; -use IteratorAggregate; +use \Exception; +use \ArrayIterator; +use \IteratorAggregate; /** * Container for session values diff --git a/modules/doc/application/controllers/IcingawebController.php b/modules/doc/application/controllers/IcingawebController.php index ecbe3a6ee..967a2b768 100644 --- a/modules/doc/application/controllers/IcingawebController.php +++ b/modules/doc/application/controllers/IcingawebController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Zend_Controller_Action_Exception; +use \Zend_Controller_Action_Exception; use Icinga\Application\Icinga; use Icinga\Module\Doc\DocController; diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php index fa6c69d19..40913368c 100644 --- a/modules/doc/application/controllers/ModuleController.php +++ b/modules/doc/application/controllers/ModuleController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Zend_Controller_Action_Exception; +use \Zend_Controller_Action_Exception; use Icinga\Application\Icinga; use Icinga\Module\Doc\DocController; use Icinga\Module\Doc\Exception\DocException; diff --git a/modules/doc/run.php b/modules/doc/run.php index 5edb69093..7392e4c22 100644 --- a/modules/doc/run.php +++ b/modules/doc/run.php @@ -1,6 +1,6 @@ isCli()) { diff --git a/modules/monitoring/application/controllers/ConfigController.php b/modules/monitoring/application/controllers/ConfigController.php index f0322dc3f..f0982c29a 100644 --- a/modules/monitoring/application/controllers/ConfigController.php +++ b/modules/monitoring/application/controllers/ConfigController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Exception; +use \Exception; use Icinga\Config\PreservingIniWriter; use Icinga\Web\Controller\ModuleActionController; diff --git a/modules/monitoring/application/controllers/MonitoringCommands.php b/modules/monitoring/application/controllers/MonitoringCommands.php index 16b713d4c..faa04114e 100644 --- a/modules/monitoring/application/controllers/MonitoringCommands.php +++ b/modules/monitoring/application/controllers/MonitoringCommands.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Icinga\Module\Monitoring\Command\Meta; +use \Icinga\Module\Monitoring\Command\Meta; /** * Class MonitoringCommands diff --git a/modules/monitoring/application/controllers/TimelineController.php b/modules/monitoring/application/controllers/TimelineController.php index 2f9b1339d..3fa621f3e 100644 --- a/modules/monitoring/application/controllers/TimelineController.php +++ b/modules/monitoring/application/controllers/TimelineController.php @@ -2,9 +2,9 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use DateTime; -use DateInterval; -use Zend_Config; +use \DateTime; +use \DateInterval; +use \Zend_Config; use Icinga\Web\Url; use Icinga\Util\Format; use Icinga\Application\Config; diff --git a/modules/monitoring/application/forms/Command/AcknowledgeForm.php b/modules/monitoring/application/forms/Command/AcknowledgeForm.php index 4ac4901b0..364c3c20a 100644 --- a/modules/monitoring/application/forms/Command/AcknowledgeForm.php +++ b/modules/monitoring/application/forms/Command/AcknowledgeForm.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Form\Command; -use Icinga\Web\Form\Element\DateTimePicker; -use Icinga\Protocol\Commandpipe\Comment; -use Icinga\Util\DateTimeFactory; -use Icinga\Module\Monitoring\Command\AcknowledgeCommand; +use \Icinga\Web\Form\Element\DateTimePicker; +use \Icinga\Protocol\Commandpipe\Comment; +use \Icinga\Util\DateTimeFactory; +use \Icinga\Module\Monitoring\Command\AcknowledgeCommand; /** * Form for problem acknowledgements diff --git a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php index e413848c8..6d49580a0 100644 --- a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php +++ b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Form\Command; -use Icinga\Web\Form\Element\TriStateCheckbox; -use Icinga\Web\Form; -use Zend_Form_Element_Hidden; -use Zend_Form; +use \Icinga\Web\Form\Element\TriStateCheckbox; +use \Icinga\Web\Form; +use \Zend_Form_Element_Hidden; +use \Zend_Form; /** * A form to edit multiple command flags of multiple commands at once. When some commands have diff --git a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php index d7228ebdf..7333ccdac 100644 --- a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php +++ b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Monitoring\Form\Command; use Zend_Controller_Request_Abstract; -use Zend_Form_Element_Hidden; +use \Zend_Form_Element_Hidden; use Icinga\Module\Monitoring\Command\AcknowledgeCommand; use Icinga\Module\Monitoring\Command\SingleArgumentCommand; diff --git a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php index c2c9151f3..de2965565 100644 --- a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php +++ b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Form\Command; -use Icinga\Exception\ProgrammingError; +use \Icinga\Exception\ProgrammingError; /** * Form for submitting passive check results diff --git a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php index 6acc210ae..513dea238 100644 --- a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php +++ b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Form\Config\Backend; -use Zend_Config; +use \Zend_Config; /** * Extended EditBackendForm for creating new Backends diff --git a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php index 077e02183..705804bb9 100644 --- a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php @@ -4,8 +4,8 @@ namespace Icinga\Module\Monitoring\Form\Config\Instance; -use Icinga\Web\Form; -use Zend_Config; +use \Icinga\Web\Form; +use \Zend_Config; /** * Form for creating new instances diff --git a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php index f74b091df..e2a091c0f 100644 --- a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php @@ -4,8 +4,8 @@ namespace Icinga\Module\Monitoring\Form\Config\Instance; -use Zend_Config; -use Icinga\Web\Form; +use \Zend_Config; +use \Icinga\Web\Form; /** * Form for editing existing instances diff --git a/modules/monitoring/application/views/helpers/ResolveMacros.php b/modules/monitoring/application/views/helpers/ResolveMacros.php index 24471449c..b0f007b19 100644 --- a/modules/monitoring/application/views/helpers/ResolveMacros.php +++ b/modules/monitoring/application/views/helpers/ResolveMacros.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Zend_View_Helper_Abstract; +use \Zend_View_Helper_Abstract; use Icinga\Module\Monitoring\Object\AbstractObject; class Zend_View_Helper_ResolveMacros extends Zend_View_Helper_Abstract diff --git a/modules/monitoring/bin/action/list.inc.php b/modules/monitoring/bin/action/list.inc.php index 01fd35131..65a0ca61d 100644 --- a/modules/monitoring/bin/action/list.inc.php +++ b/modules/monitoring/bin/action/list.inc.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use Icinga\Module\Monitoring\Backend; +use \Icinga\Module\Monitoring\Backend; use Icinga\Util\Format; $backend = Backend::getInstance($params->shift('backend')); diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php index 75db67b55..ce61c8f1b 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query; -use Zend_Db_Select; +use \Zend_Db_Select; class StatusSummaryQuery extends IdoQuery { diff --git a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php index 3e1468e36..b0cd1b445 100644 --- a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php +++ b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Exception; -use Exception; +use \Exception; class UnsupportedBackendException extends Exception { diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php b/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php index bd83a42cd..615999bdb 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Timeline; -use DateTime; +use \DateTime; use Icinga\Web\Url; use Icinga\Exception\ProgrammingError; diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php index 2b0158bf1..fa5af9141 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Timeline; -use DateTime; -use Exception; -use ArrayIterator; -use IteratorAggregate; +use \DateTime; +use \Exception; +use \ArrayIterator; +use \IteratorAggregate; use Icinga\Data\Filter\Filter; use Icinga\Web\Hook; use Icinga\Web\Session; diff --git a/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php b/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php index f50b07893..961aefca5 100644 --- a/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php +++ b/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers; -use Zend_View_Helper_MonitoringFlags; +use \Zend_View_Helper_MonitoringFlags; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringFlags.php'); diff --git a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php index 5a476aaef..aa13df35e 100644 --- a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php +++ b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php @@ -4,7 +4,7 @@ namespace Test\Modules\Monitoring\Application\Views\Helpers; -use Zend_View_Helper_MonitoringProperties; +use \Zend_View_Helper_MonitoringProperties; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringProperties.php'); diff --git a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php index a14f64ae7..374578947 100644 --- a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php +++ b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Modules\Monitoring\Application\Views\Helpers; -use Mockery; -use Zend_View_Helper_ResolveMacros; +use \Mockery; +use \Zend_View_Helper_ResolveMacros; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/ResolveMacros.php'); diff --git a/modules/translation/library/Translation/Cli/TranslationCommand.php b/modules/translation/library/Translation/Cli/TranslationCommand.php index b3cfc6de4..417d9d6ed 100644 --- a/modules/translation/library/Translation/Cli/TranslationCommand.php +++ b/modules/translation/library/Translation/Cli/TranslationCommand.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Translation\Cli; -use Exception; +use \Exception; use Icinga\Cli\Command; /** diff --git a/test/php/application/forms/Config/Authentication/ReorderFormTest.php b/test/php/application/forms/Config/Authentication/ReorderFormTest.php index 808806f1a..a61efc48a 100644 --- a/test/php/application/forms/Config/Authentication/ReorderFormTest.php +++ b/test/php/application/forms/Config/Authentication/ReorderFormTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Form\Config\Authentication; -use Mockery; -use Zend_Config; +use \Mockery; +use \Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Form\Config\Authentication\ReorderForm; diff --git a/test/php/library/Icinga/Application/ConfigTest.php b/test/php/library/Icinga/Application/ConfigTest.php index e99b17b2e..bc39afecd 100644 --- a/test/php/library/Icinga/Application/ConfigTest.php +++ b/test/php/library/Icinga/Application/ConfigTest.php @@ -5,7 +5,7 @@ namespace Tests\Icinga\Application; use Icinga\Test\BaseTestCase; -use Icinga\Application\Config as IcingaConfig; +use \Icinga\Application\Config as IcingaConfig; class ConfigTest extends BaseTestCase { diff --git a/test/php/library/Icinga/Chart/GraphChartTest.php b/test/php/library/Icinga/Chart/GraphChartTest.php index 6a7f73864..25870791a 100644 --- a/test/php/library/Icinga/Chart/GraphChartTest.php +++ b/test/php/library/Icinga/Chart/GraphChartTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Chart; -use DOMXPath; -use DOMDocument; +use \DOMXPath; +use \DOMDocument; use Icinga\Chart\GridChart; use Icinga\Test\BaseTestCase; diff --git a/test/php/library/Icinga/Chart/PieChartTest.php b/test/php/library/Icinga/Chart/PieChartTest.php index 756fdf6e6..c09f29e57 100644 --- a/test/php/library/Icinga/Chart/PieChartTest.php +++ b/test/php/library/Icinga/Chart/PieChartTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Chart; -use DOMXPath; -use DOMDocument; +use \DOMXPath; +use \DOMDocument; use Icinga\Chart\PieChart; use Icinga\Test\BaseTestCase; diff --git a/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php b/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php index 7d3fd94f6..0ec9a4da6 100644 --- a/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php +++ b/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Protocol\Commandpipe; -use Zend_Config; +use \Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Protocol\Commandpipe\Comment; use Icinga\Protocol\Commandpipe\CommandPipe; diff --git a/test/php/library/Icinga/Protocol/Ldap/QueryTest.php b/test/php/library/Icinga/Protocol/Ldap/QueryTest.php index b710a0934..0fa155202 100644 --- a/test/php/library/Icinga/Protocol/Ldap/QueryTest.php +++ b/test/php/library/Icinga/Protocol/Ldap/QueryTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Protocol\Ldap; -use Zend_Config; +use \Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Protocol\Ldap\Connection; From 236d384bab3c1b64f3fd9954487accc33aafe48a Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Wed, 27 Aug 2014 14:54:45 +0200 Subject: [PATCH 09/18] Fixes unaccepted behavior in module configuration fixes #7011 --- library/Icinga/Application/Modules/Module.php | 15 +++-- library/Icinga/Web/Menu.php | 20 ++++--- .../Icinga/Web/Widget/Dashboard/Component.php | 37 ++++++++++-- library/Icinga/Web/Widget/Dashboard/Pane.php | 56 +++++++++--------- modules/doc/configuration.php | 3 +- modules/monitoring/configuration.php | 58 ++++++++++--------- 6 files changed, 115 insertions(+), 74 deletions(-) diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index a325dfef0..ebc939f49 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -176,6 +176,7 @@ class Module /** * Add a pane to dashboard * + * @param $id * @param $name * @return Pane */ @@ -199,19 +200,21 @@ class Module /** * Add a menu Section to the Sidebar menu * - * @param $name + * @param string $id + * @param string $name * @param array $properties * @return mixed */ - protected function menuSection($name, array $properties = array()) + protected function menuSection($id, $name, array $properties = array()) { - if (array_key_exists($name, $this->menuItems)) { - $this->menuItems[$name]->setProperties($properties); + if (array_key_exists($id, $this->menuItems)) { + $this->menuItems[$id]->setProperties($properties); } else { - $this->menuItems[$name] = new Menu($name, new Zend_Config($properties)); + $this->menuItems[$id] = new Menu($id, new Zend_Config($properties)); + $this->menuItems[$id]->setTitle($name); } - return $this->menuItems[$name]; + return $this->menuItems[$id]; } /** diff --git a/library/Icinga/Web/Menu.php b/library/Icinga/Web/Menu.php index 2fa49b99c..c5640ac09 100644 --- a/library/Icinga/Web/Menu.php +++ b/library/Icinga/Web/Menu.php @@ -5,6 +5,7 @@ namespace Icinga\Web; use Icinga\Exception\ConfigurationError; +use Icinga\Logger\Logger; use Zend_Config; use RecursiveIterator; use Icinga\Application\Config; @@ -172,34 +173,34 @@ class Menu implements RecursiveIterator */ protected function addMainMenuItems() { - $this->add(t('Dashboard'), array( + $this->add('dashboard', t('Dashboard'), array( 'url' => 'dashboard', 'icon' => 'img/icons/dashboard.png', 'priority' => 10 )); - $section = $this->add(t('System'), array( + $section = $this->add('system', t('System'), array( 'icon' => 'img/icons/configuration.png', 'priority' => 200 )); - $section->add(t('Preferences'), array( + $section->add('preferences', t('Preferences'), array( 'url' => 'preference', 'priority' => 200 )); - $section->add(t('Configuration'), array( + $section->add('configuration', t('Configuration'), array( 'url' => 'config', 'priority' => 300 )); - $section->add(t('Modules'), array( + $section->add('modules', t('Modules'), array( 'url' => 'config/modules', 'priority' => 400 )); - $section->add(t('ApplicationLog'), array( + $section->add('applicationlog', t('ApplicationLog'), array( 'url' => 'list/applicationlog', 'priority' => 500 )); - $this->add(t('Logout'), array( + $this->add('logout', t('Logout'), array( 'url' => 'authentication/logout', 'icon' => 'img/icons/logout.png', 'priority' => 300 @@ -427,9 +428,10 @@ class Menu implements RecursiveIterator * @param array $config * @return Menu */ - public function add($name, $config = array()) + public function add($id, $name, $config = array()) { - return $this->addSubMenu($name, new Zend_Config($config)); + $config['title'] = $name; + return $this->addSubMenu($id, new Zend_Config($config)); } /** diff --git a/library/Icinga/Web/Widget/Dashboard/Component.php b/library/Icinga/Web/Widget/Dashboard/Component.php index 2d8517526..56f499dc1 100644 --- a/library/Icinga/Web/Widget/Dashboard/Component.php +++ b/library/Icinga/Web/Widget/Dashboard/Component.php @@ -29,6 +29,13 @@ class Component extends AbstractWidget */ private $url; + /** + * The id of this Component + * + * @var string + */ + private $id; + /** * The title being displayed on top of the component * @var @@ -59,12 +66,14 @@ EOD; /** * Create a new component displaying the given url in the provided pane * + * @param string $id The id to use for this component * @param string $title The title to use for this component * @param Url|string $url The url this component uses for displaying information * @param Pane $pane The pane this Component will be added to */ - public function __construct($title, $url, Pane $pane) + public function __construct($id, $title, $url, Pane $pane) { + $this->id = $id; $this->title = $title; $this->pane = $pane; if ($url instanceof Url) { @@ -187,14 +196,14 @@ EOD; /** * Create a @see Component instance from the given Zend config, using the provided title - * + * @param $id The id for this component * @param $title The title for this component * @param Zend_Config $config The configuration defining url, parameters, height, width, etc. * @param Pane $pane The pane this component belongs to * * @return Component A newly created Component for use in the Dashboard */ - public static function fromIni($title, Zend_Config $config, Pane $pane) + public static function fromIni($id, $title, Zend_Config $config, Pane $pane) { $height = null; $width = null; @@ -202,7 +211,27 @@ EOD; $parameters = $config->toArray(); unset($parameters['url']); // otherwise there's an url = parameter in the Url - $cmp = new Component($title, Url::fromPath($url, $parameters), $pane); + $cmp = new Component($id, $title, Url::fromPath($url, $parameters), $pane); return $cmp; } + + /** + * Set the components id + * + * @param $id string + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * Retrieve the components id + * + * @return string + */ + public function getId() + { + return $this->id; + } } diff --git a/library/Icinga/Web/Widget/Dashboard/Pane.php b/library/Icinga/Web/Widget/Dashboard/Pane.php index 39ad1fda3..edb3b6b77 100644 --- a/library/Icinga/Web/Widget/Dashboard/Pane.php +++ b/library/Icinga/Web/Widget/Dashboard/Pane.php @@ -83,44 +83,44 @@ class Pane extends AbstractWidget /** * Return true if a component with the given title exists in this pane * - * @param string $title The title of the component to check for existence + * @param string $id The id of the component to check for existence * * @return bool */ - public function hasComponent($title) + public function hasComponent($id) { - return array_key_exists($title, $this->components); + return array_key_exists($id, $this->components); } /** * Return a component with the given name if existing * - * @param string $title The title of the component to return + * @param string $id The id of the component to return * * @return Component The component with the given title * @throws ProgrammingError If the component doesn't exist */ - public function getComponent($title) + public function getComponent($id) { - if ($this->hasComponent($title)) { - return $this->components[$title]; + if ($this->hasComponent($id)) { + return $this->components[$id]; } throw new ProgrammingError( 'Trying to access invalid component: %s', - $title + $id ); } /** - * Removes the component with the given title if it exists in this pane + * Removes the component with the given id if it exists in this pane * - * @param string $title The pane + * @param string $id The pane * @return Pane $this */ - public function removeComponent($title) + public function removeComponent($id) { - if ($this->hasComponent($title)) { - unset($this->components[$title]); + if ($this->hasComponent($id)) { + unset($this->components[$id]); } return $this; } @@ -146,6 +146,7 @@ class Pane extends AbstractWidget /** * Add a component to this pane, optionally creating it if $component is a string * + * @param string $id An unique Identifier * @param string|Component $component The component object or title * (if a new component will be created) * @param string|null $url An Url to be used when component is a string @@ -153,12 +154,12 @@ class Pane extends AbstractWidget * @return self * @throws \Icinga\Exception\ConfigurationError */ - public function addComponent($component, $url = null) + public function addComponent($id, $component, $url = null) { if ($component instanceof Component) { - $this->components[$component->getTitle()] = $component; - } elseif (is_string($component) && $url !== null) { - $this->components[$component] = new Component($component, $url, $this); + $this->components[$component->getId()] = $component; + } elseif (is_string($id) && is_string($component) && $url !== null) { + $this->components[$id] = new Component($id, $component, $url, $this); } else { throw new ConfigurationError('Invalid component added: %s', $component); } @@ -175,15 +176,15 @@ class Pane extends AbstractWidget { /* @var $component Component */ foreach ($components as $component) { - if (array_key_exists($component->getTitle(), $this->components)) { - if (preg_match('/_(\d+)$/', $component->getTitle(), $m)) { - $name = preg_replace('/_\d+$/', $m[1]++, $component->getTitle()); + if (array_key_exists($component->getId(), $this->components)) { + if (preg_match('/-(\d+)$/', $component->getId(), $m)) { + $name = preg_replace('/-\d+$/', $m[1]++, $component->getId()); } else { - $name = $component->getTitle() . '_2'; + $name = $component->getId() . '-2'; } $this->components[$name] = $component; } else { - $this->components[$component->getTitle()] = $component; + $this->components[$component->getId()] = $component; } } @@ -193,17 +194,18 @@ class Pane extends AbstractWidget /** * Add a component to the current pane * + * @param $id * @param $title - * @param $url - * @return Component + * @param null $url + * @return mixed * * @see addComponent() */ - public function add($title, $url = null) + public function add($id, $title, $url = null) { - $this->addComponent($title, $url); + $this->addComponent($id, $title, $url); - return $this->components[$title]; + return $this->components[$id]; } /** diff --git a/modules/doc/configuration.php b/modules/doc/configuration.php index ce3f99113..06e900300 100644 --- a/modules/doc/configuration.php +++ b/modules/doc/configuration.php @@ -4,8 +4,7 @@ /* @var $this \Icinga\Application\Modules\Module */ -$section = $this->menuSection($this->translate('Documentation'), array( - 'title' => 'Documentation', +$section = $this->menuSection('documentation', $this->translate('Documentation'), array( 'icon' => 'img/icons/comment.png', 'url' => 'doc', 'priority' => 80 diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 412581d24..9b12049e4 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -22,72 +22,73 @@ $this->provideConfigTab('security', array( /* * Problems Section */ -$section = $this->menuSection($this->translate('Problems'), array( +$section = $this->menuSection('problems', $this->translate('Problems'), array( 'icon' => 'img/icons/error.png', 'priority' => 20 )); -$section->add($this->translate('Unhandled Hosts'), array( +$section->add('unhandled hosts', $this->translate('Unhandled Hosts'), array( 'url' => 'monitoring/list/hosts?host_problem=1&host_handled=0', 'priority' => 40 )); -$section->add($this->translate('Unhandled Services'), array( +$section->add('unhandled services', $this->translate('Unhandled Services'), array( 'url' => 'monitoring/list/services?service_problem=1&service_handled=0&sort=service_severity', 'priority' => 40 )); -$section->add($this->translate('Host Problems'), array( +$section->add('host problems', $this->translate('Host Problems'), array( 'url' => 'monitoring/list/hosts?host_problem=1&sort=host_severity', 'priority' => 50 )); -$section->add($this->translate('Service Problems'), array( +$section->add('service prolems', $this->translate('Service Problems'), array( 'url' => 'monitoring/list/services?service_problem=1&sort=service_severity&dir=desc', 'priority' => 50 )); -$section->add($this->translate('Current Downtimes'))->setUrl('monitoring/list/downtimes?downtime_is_in_effect=1'); +$section->add('current downtimes', $this->translate('Current Downtimes')) + ->setUrl('monitoring/list/downtimes?downtime_is_in_effect=1'); /* * Overview Section */ -$section = $this->menuSection($this->translate('Overview'), array( +$section = $this->menuSection('overview', $this->translate('Overview'), array( 'icon' => 'img/icons/hostgroup.png', 'priority' => 30 )); -$section->add($this->translate('Tactical Overview'), array( +$section->add('tactical overview', $this->translate('Tactical Overview'), array( 'url' => 'monitoring/tactical', 'priority' => 40 )); -$section->add($this->translate('Hosts'), array( +$section->add('hosts', $this->translate('Hosts'), array( 'url' => 'monitoring/list/hosts', 'priority' => 50 )); -$section->add($this->translate('Services'), array( +$section->add('services', $this->translate('Services'), array( 'url' => 'monitoring/list/services', 'priority' => 50 )); -$section->add($this->translate('Servicematrix'), array( +$section->add('servicematrix', $this->translate('Servicematrix'), array( 'url' => 'monitoring/list/servicematrix?service_problem=1', 'priority' => 51 )); -$section->add($this->translate('Servicegroups'), array( +$section->add('servicegroups', $this->translate('Servicegroups'), array( 'url' => 'monitoring/list/servicegroups', 'priority' => 60 )); -$section->add($this->translate('Hostgroups'), array( +$section->add('hostgroups', $this->translate('Hostgroups'), array( 'url' => 'monitoring/list/hostgroups', 'priority' => 60 )); -$section->add($this->translate('Contactgroups'), array( +$section->add('contactgroups', $this->translate('Contactgroups'), array( 'url' => 'monitoring/list/contactgroups', 'priority' => 61 )); -$section->add($this->translate('Downtimes'), array( +$section->add('downtimes', $this->translate('Downtimes'), array( 'url' => 'monitoring/list/downtimes', 'priority' => 71 )); -$section->add($this->translate('Comments'), array( +$section->add('comments', $this->translate('Comments'), array( 'url' => 'monitoring/list/comments?comment_type=(comment|ack)', 'priority' => 70 )); -$section->add($this->translate('Contacts'), array( +$section->add('contacts', $this->translate('Contacts'), array( 'url' => 'monitoring/list/contacts', 'priority' => 70 )); @@ -95,31 +96,33 @@ $section->add($this->translate('Contacts'), array( /* * History Section */ -$section = $this->menuSection($this->translate('History'), array( +$section = $this->menuSection('history', $this->translate('History'), array( + 'title' => $this->translate('History'), 'icon' => 'img/icons/history.png' )); -$section->add($this->translate('Critical Events'), array( +$section->add('critical events', $this->translate('Critical Events'), array( + 'title' => $this->translate('Critical Events'), 'url' => 'monitoring/list/statehistorysummary', 'priority' => 50 )); -$section->add($this->translate('Notifications'), array( +$section->add('notifications', $this->translate('Notifications'), array( 'url' => 'monitoring/list/notifications' )); -$section->add($this->translate('Events'), array( +$section->add('events', $this->translate('Events'), array( 'title' => $this->translate('All Events'), 'url' => 'monitoring/list/eventhistory?timestamp>=-7%20days' )); -$section->add($this->translate('Timeline'))->setUrl('monitoring/timeline'); +$section->add('timeline', $this->translate('Timeline'))->setUrl('monitoring/timeline'); /* * System Section */ -$section = $this->menuSection($this->translate('System')); -$section->add($this->translate('Process Info'), array( +$section = $this->menuSection('system', $this->translate('System')); +$section->add('process info', $this->translate('Process Info'), array( 'url' => 'monitoring/process/info', 'priority' => 120 )); -$section->add($this->translate('Performance Info'), array( +$section->add('performance info', $this->translate('Performance Info'), array( 'url' => 'monitoring/process/performance', 'priority' => 130 )); @@ -127,16 +130,19 @@ $section->add($this->translate('Performance Info'), array( /* * Dashboard */ -$dashboard = $this->dashboard($this->translate('Current Incidents')); +$dashboard = $this->dashboard('current-incidents', $this->translate('Current Incidents')); $dashboard->add( + 'service problems', $this->translate('Service Problems'), 'monitoring/list/services?service_problem=1&limit=10&sort=service_severity' ); $dashboard->add( + 'recently recovered services', $this->translate('Recently Recovered Services'), 'monitoring/list/services?service_state=0&limit=10&sort=service_last_state_change&dir=desc' ); $dashboard->add( + 'host problems', $this->translate('Host Problems'), 'monitoring/list/hosts?host_problem=1&sort=host_severity' ); From 66031ed6bf733896c72e070719d4f585dc54988d Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 27 Aug 2014 15:02:46 +0200 Subject: [PATCH 10/18] Use Source instead of Source0 in the spec file refs #6401 --- icingaweb2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icingaweb2.spec b/icingaweb2.spec index 270e18fff..5d5b9ec9c 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -83,7 +83,7 @@ BuildArch: noarch AutoReqProv: Off %endif -Source0: icingaweb2-%{version}.tar.gz +Source: icingaweb2-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root From 968fa36cfd5123137b2d8189b3df723974c6a46d Mon Sep 17 00:00:00 2001 From: Alexander Fuhr Date: Wed, 27 Aug 2014 15:02:23 +0200 Subject: [PATCH 11/18] Fixes dashboard title configuration fixes #7011 --- modules/monitoring/configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/monitoring/configuration.php b/modules/monitoring/configuration.php index 9b12049e4..ed5251ec1 100644 --- a/modules/monitoring/configuration.php +++ b/modules/monitoring/configuration.php @@ -130,7 +130,7 @@ $section->add('performance info', $this->translate('Performance Info'), array( /* * Dashboard */ -$dashboard = $this->dashboard('current-incidents', $this->translate('Current Incidents')); +$dashboard = $this->dashboard('current incidents')->setTitle($this->translate('Current Incidents')); $dashboard->add( 'service problems', $this->translate('Service Problems'), From 7ff51caed0ad1a1db9940605024778c80499e685 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 27 Aug 2014 15:51:49 +0200 Subject: [PATCH 12/18] Remove leading backslashes from the targets of use statements - use \Exception; + use Exception; --- .../controllers/DashboardController.php | 2 +- application/controllers/StaticController.php | 2 +- .../Config/Authentication/BaseBackendForm.php | 4 ++-- .../Config/Authentication/DbBackendForm.php | 4 ++-- .../Config/Authentication/LdapBackendForm.php | 4 ++-- .../Config/Authentication/ReorderForm.php | 2 +- application/forms/Config/LoggingForm.php | 2 +- application/forms/Preference/GeneralForm.php | 18 +++++++++--------- application/views/helpers/FormDateTime.php | 2 +- .../views/helpers/FormTriStateCheckbox.php | 2 +- library/Icinga/Application/functions.php | 2 +- library/Icinga/Chart/Primitive/Rect.php | 4 ++-- .../Commandpipe/Transport/Transport.php | 2 +- library/Icinga/Protocol/Ldap/Connection.php | 2 +- .../Statusdat/View/MonitoringObjectList.php | 8 ++++---- .../User/Preferences/PreferencesStore.php | 2 +- .../Web/Form/Decorator/ConditionalHidden.php | 2 +- .../Icinga/Web/Form/Element/DateTimePicker.php | 6 +++--- .../Web/Form/Element/TriStateCheckbox.php | 4 ++-- .../Web/Form/Validator/DateFormatValidator.php | 2 +- .../Web/Form/Validator/DateTimeValidator.php | 6 +++--- .../Web/Form/Validator/TimeFormatValidator.php | 2 +- .../Web/Form/Validator/TriStateValidator.php | 2 +- .../Form/Validator/WritablePathValidator.php | 4 ++-- library/Icinga/Web/Hook/TopBarHook.php | 4 ++-- .../Icinga/Web/Session/SessionNamespace.php | 6 +++--- .../controllers/IcingawebController.php | 2 +- .../controllers/ModuleController.php | 2 +- .../controllers/ConfigController.php | 2 +- .../controllers/MonitoringCommands.php | 2 +- .../controllers/TimelineController.php | 6 +++--- .../forms/Command/AcknowledgeForm.php | 8 ++++---- .../forms/Command/MultiCommandFlagForm.php | 8 ++++---- .../Command/SingleArgumentCommandForm.php | 2 +- .../Command/SubmitPassiveCheckResultForm.php | 2 +- .../forms/Config/Backend/CreateBackendForm.php | 2 +- .../Config/Instance/CreateInstanceForm.php | 4 ++-- .../forms/Config/Instance/EditInstanceForm.php | 4 ++-- modules/monitoring/bin/action/list.inc.php | 2 +- .../Backend/Ido/Query/StatusSummaryQuery.php | 2 +- .../Exception/UnsupportedBackendException.php | 2 +- .../library/Monitoring/Timeline/TimeEntry.php | 2 +- .../library/Monitoring/Timeline/TimeLine.php | 8 ++++---- .../views/helpers/MonitoringFlagsTest.php | 2 +- .../views/helpers/MonitoringPropertiesTest.php | 2 +- .../views/helpers/ResolveMacrosTest.php | 4 ++-- .../Translation/Cli/TranslationCommand.php | 2 +- .../Config/Authentication/ReorderFormTest.php | 4 ++-- .../library/Icinga/Application/ConfigTest.php | 2 +- .../library/Icinga/Chart/GraphChartTest.php | 4 ++-- test/php/library/Icinga/Chart/PieChartTest.php | 4 ++-- .../Protocol/Commandpipe/CommandPipeTest.php | 2 +- .../library/Icinga/Protocol/Ldap/QueryTest.php | 2 +- 53 files changed, 94 insertions(+), 94 deletions(-) diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index 108117959..dc48dd7f3 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Config; +use Zend_Config; use Icinga\Web\Url; use Icinga\Logger\Logger; use Icinga\Config\PreservingIniWriter; diff --git a/application/controllers/StaticController.php b/application/controllers/StaticController.php index 3a15b1b1e..51b5fdb62 100644 --- a/application/controllers/StaticController.php +++ b/application/controllers/StaticController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Controller_Action_Exception as ActionException; +use Zend_Controller_Action_Exception as ActionException; use Icinga\Web\Controller\ActionController; use Icinga\Application\Icinga; use Icinga\Logger\Logger; diff --git a/application/forms/Config/Authentication/BaseBackendForm.php b/application/forms/Config/Authentication/BaseBackendForm.php index 7a34f236a..f670b25c1 100644 --- a/application/forms/Config/Authentication/BaseBackendForm.php +++ b/application/forms/Config/Authentication/BaseBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use \Zend_Config; -use \Zend_Form_Element_Checkbox; +use Zend_Config; +use Zend_Form_Element_Checkbox; use Icinga\Web\Form; use Icinga\Data\ResourceFactory; use Icinga\Web\Form\Decorator\HelpText; diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 2c57b82e2..82594280b 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use \Exception; -use \Zend_Config; +use Exception; +use Zend_Config; use Icinga\Data\ResourceFactory; use Icinga\Authentication\DbConnection; use Icinga\Authentication\Backend\DbUserBackend; diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index ee90fa95c..89f446795 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -4,8 +4,8 @@ namespace Icinga\Form\Config\Authentication; -use \Exception; -use \Zend_Config; +use Exception; +use Zend_Config; use Icinga\Web\Form; use Icinga\Data\ResourceFactory; use Icinga\Authentication\Backend\LdapUserBackend; diff --git a/application/forms/Config/Authentication/ReorderForm.php b/application/forms/Config/Authentication/ReorderForm.php index a074febea..b4c3cd9b7 100644 --- a/application/forms/Config/Authentication/ReorderForm.php +++ b/application/forms/Config/Authentication/ReorderForm.php @@ -4,7 +4,7 @@ namespace Icinga\Form\Config\Authentication; -use \Zend_Config; +use Zend_Config; use Icinga\Web\Form; /** diff --git a/application/forms/Config/LoggingForm.php b/application/forms/Config/LoggingForm.php index b3b4089c8..1fcb30fa5 100644 --- a/application/forms/Config/LoggingForm.php +++ b/application/forms/Config/LoggingForm.php @@ -4,7 +4,7 @@ namespace Icinga\Form\Config; -use \Zend_Config; +use Zend_Config; use Icinga\Web\Form; use Icinga\Application\Icinga; use Icinga\Web\Form\Validator\WritablePathValidator; diff --git a/application/forms/Preference/GeneralForm.php b/application/forms/Preference/GeneralForm.php index 204ddc51d..5b9a1b95f 100644 --- a/application/forms/Preference/GeneralForm.php +++ b/application/forms/Preference/GeneralForm.php @@ -4,15 +4,15 @@ namespace Icinga\Form\Preference; -use \DateTimeZone; -use \Zend_Config; -use \Zend_Form_Element_Text; -use \Zend_Form_Element_Select; -use \Zend_View_Helper_DateFormat; -use \Icinga\Web\Form; -use \Icinga\Web\Form\Validator\TimeFormatValidator; -use \Icinga\Web\Form\Validator\DateFormatValidator; -use \Icinga\Util\Translator; +use DateTimeZone; +use Zend_Config; +use Zend_Form_Element_Text; +use Zend_Form_Element_Select; +use Zend_View_Helper_DateFormat; +use Icinga\Web\Form; +use Icinga\Web\Form\Validator\TimeFormatValidator; +use Icinga\Web\Form\Validator\DateFormatValidator; +use Icinga\Util\Translator; /** * General user preferences diff --git a/application/views/helpers/FormDateTime.php b/application/views/helpers/FormDateTime.php index 07d5fb930..19a9cc3c5 100644 --- a/application/views/helpers/FormDateTime.php +++ b/application/views/helpers/FormDateTime.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_View_Helper_FormElement; +use Zend_View_Helper_FormElement; /** * Helper to generate a "datetime" element diff --git a/application/views/helpers/FormTriStateCheckbox.php b/application/views/helpers/FormTriStateCheckbox.php index 695c9af56..b69114a11 100644 --- a/application/views/helpers/FormTriStateCheckbox.php +++ b/application/views/helpers/FormTriStateCheckbox.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_View_Helper_FormElement; +use Zend_View_Helper_FormElement; /** * Helper to generate a "datetime" element diff --git a/library/Icinga/Application/functions.php b/library/Icinga/Application/functions.php index cfa5620ba..422dfeab7 100644 --- a/library/Icinga/Application/functions.php +++ b/library/Icinga/Application/functions.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Icinga\Util\Translator; +use Icinga\Util\Translator; if (extension_loaded('gettext')) { function t($messageId) diff --git a/library/Icinga/Chart/Primitive/Rect.php b/library/Icinga/Chart/Primitive/Rect.php index 36b63912f..fc389e204 100644 --- a/library/Icinga/Chart/Primitive/Rect.php +++ b/library/Icinga/Chart/Primitive/Rect.php @@ -4,8 +4,8 @@ namespace Icinga\Chart\Primitive; -use \DomElement; -use \Icinga\Chart\Render\RenderContext; +use DomElement; +use Icinga\Chart\Render\RenderContext; use Icinga\Chart\Format; /** diff --git a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php index c5a5b3883..59119cf13 100644 --- a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php +++ b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php @@ -4,7 +4,7 @@ namespace Icinga\Protocol\Commandpipe\Transport; -use \Zend_Config; +use Zend_Config; /** * Interface for Transport classes handling the concrete access to the command pipe diff --git a/library/Icinga/Protocol/Ldap/Connection.php b/library/Icinga/Protocol/Ldap/Connection.php index edd99d021..531a399c8 100644 --- a/library/Icinga/Protocol/Ldap/Connection.php +++ b/library/Icinga/Protocol/Ldap/Connection.php @@ -8,7 +8,7 @@ use Icinga\Protocol\Ldap\Exception as LdapException; use Icinga\Application\Platform; use Icinga\Application\Config; use Icinga\Logger\Logger; -use \Zend_Config; +use Zend_Config; /** * Backend class managing all the LDAP stuff for you. diff --git a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php index 8c6fdf0bc..e9a7e1bc9 100644 --- a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php +++ b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php @@ -4,10 +4,10 @@ namespace Icinga\Protocol\Statusdat\View; -use \Iterator; -use \Countable; -use \ArrayAccess; -use \Exception; +use Iterator; +use Countable; +use ArrayAccess; +use Exception; /** * Wrapper around an array of monitoring objects that can be enhanced with an optional diff --git a/library/Icinga/User/Preferences/PreferencesStore.php b/library/Icinga/User/Preferences/PreferencesStore.php index 749d054dc..b8121eb25 100644 --- a/library/Icinga/User/Preferences/PreferencesStore.php +++ b/library/Icinga/User/Preferences/PreferencesStore.php @@ -4,7 +4,7 @@ namespace Icinga\User\Preferences; -use \Zend_Config; +use Zend_Config; use Icinga\User; use Icinga\User\Preferences; use Icinga\Data\ResourceFactory; diff --git a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php index 5d29caee4..c24f637ba 100644 --- a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php +++ b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Decorator; -use \Zend_Form_Decorator_Abstract; +use Zend_Form_Decorator_Abstract; /** * Decorator to hide elements using a >noscript< tag instead of diff --git a/library/Icinga/Web/Form/Element/DateTimePicker.php b/library/Icinga/Web/Form/Element/DateTimePicker.php index 911e26322..dd48bd7f2 100644 --- a/library/Icinga/Web/Form/Element/DateTimePicker.php +++ b/library/Icinga/Web/Form/Element/DateTimePicker.php @@ -5,9 +5,9 @@ namespace Icinga\Web\Form\Element; use Icinga\Web\Form\Validator\DateTimeValidator; -use \Zend_Form_Element_Text; -use \Zend_Form_Element; -use \Icinga\Util\DateTimeFactory; +use Zend_Form_Element_Text; +use Zend_Form_Element; +use Icinga\Util\DateTimeFactory; /** * Datetime form element which returns the input as Unix timestamp after the input has been proven valid. Utilizes diff --git a/library/Icinga/Web/Form/Element/TriStateCheckbox.php b/library/Icinga/Web/Form/Element/TriStateCheckbox.php index fb6ffb692..45763880d 100644 --- a/library/Icinga/Web/Form/Element/TriStateCheckbox.php +++ b/library/Icinga/Web/Form/Element/TriStateCheckbox.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Form\Element; -use \Icinga\Web\Form\Validator\TriStateValidator; -use \Zend_Form_Element_Xhtml; +use Icinga\Web\Form\Validator\TriStateValidator; +use Zend_Form_Element_Xhtml; /** * A checkbox that can display three different states: diff --git a/library/Icinga/Web/Form/Validator/DateFormatValidator.php b/library/Icinga/Web/Form/Validator/DateFormatValidator.php index 2b2a413fd..b11629cbf 100644 --- a/library/Icinga/Web/Form/Validator/DateFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/DateFormatValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; +use Zend_Validate_Abstract; /** * Validator that checks if a textfield contains a correct date format diff --git a/library/Icinga/Web/Form/Validator/DateTimeValidator.php b/library/Icinga/Web/Form/Validator/DateTimeValidator.php index 952ac6c86..f1952f7d4 100644 --- a/library/Icinga/Web/Form/Validator/DateTimeValidator.php +++ b/library/Icinga/Web/Form/Validator/DateTimeValidator.php @@ -4,9 +4,9 @@ namespace Icinga\Web\Form\Validator; -use \Icinga\Util\DateTimeFactory; -use \Zend_Validate_Abstract; -use \Icinga\Exception\ProgrammingError; +use Icinga\Util\DateTimeFactory; +use Zend_Validate_Abstract; +use Icinga\Exception\ProgrammingError; /** * Validator that checks if a textfield contains a correct date format diff --git a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php index 1715f7fdb..a02581cfa 100644 --- a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; +use Zend_Validate_Abstract; /** * Validator that checks if a textfield contains a correct time format diff --git a/library/Icinga/Web/Form/Validator/TriStateValidator.php b/library/Icinga/Web/Form/Validator/TriStateValidator.php index f05f35b27..e51e00e21 100644 --- a/library/Icinga/Web/Form/Validator/TriStateValidator.php +++ b/library/Icinga/Web/Form/Validator/TriStateValidator.php @@ -4,7 +4,7 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; +use Zend_Validate_Abstract; class TriStateValidator extends Zend_Validate_Abstract { diff --git a/library/Icinga/Web/Form/Validator/WritablePathValidator.php b/library/Icinga/Web/Form/Validator/WritablePathValidator.php index 1381da9c7..8387c5cf5 100644 --- a/library/Icinga/Web/Form/Validator/WritablePathValidator.php +++ b/library/Icinga/Web/Form/Validator/WritablePathValidator.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Form\Validator; -use \Zend_Validate_Abstract; -use \Icinga\Application\Config as IcingaConfig; +use Zend_Validate_Abstract; +use Icinga\Application\Config as IcingaConfig; /** * Validator that interprets the value as a path and checks if it's writable diff --git a/library/Icinga/Web/Hook/TopBarHook.php b/library/Icinga/Web/Hook/TopBarHook.php index 867b4f721..183a0ca07 100644 --- a/library/Icinga/Web/Hook/TopBarHook.php +++ b/library/Icinga/Web/Hook/TopBarHook.php @@ -4,8 +4,8 @@ namespace Icinga\Web\Hook; -use \Icinga\Web\Request; -use \Zend_View; +use Icinga\Web\Request; +use Zend_View; /** * Hook to extend topbar items diff --git a/library/Icinga/Web/Session/SessionNamespace.php b/library/Icinga/Web/Session/SessionNamespace.php index 8862d343f..682991aed 100644 --- a/library/Icinga/Web/Session/SessionNamespace.php +++ b/library/Icinga/Web/Session/SessionNamespace.php @@ -4,9 +4,9 @@ namespace Icinga\Web\Session; -use \Exception; -use \ArrayIterator; -use \IteratorAggregate; +use Exception; +use ArrayIterator; +use IteratorAggregate; /** * Container for session values diff --git a/modules/doc/application/controllers/IcingawebController.php b/modules/doc/application/controllers/IcingawebController.php index 967a2b768..ecbe3a6ee 100644 --- a/modules/doc/application/controllers/IcingawebController.php +++ b/modules/doc/application/controllers/IcingawebController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Controller_Action_Exception; +use Zend_Controller_Action_Exception; use Icinga\Application\Icinga; use Icinga\Module\Doc\DocController; diff --git a/modules/doc/application/controllers/ModuleController.php b/modules/doc/application/controllers/ModuleController.php index 40913368c..fa6c69d19 100644 --- a/modules/doc/application/controllers/ModuleController.php +++ b/modules/doc/application/controllers/ModuleController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Zend_Controller_Action_Exception; +use Zend_Controller_Action_Exception; use Icinga\Application\Icinga; use Icinga\Module\Doc\DocController; use Icinga\Module\Doc\Exception\DocException; diff --git a/modules/monitoring/application/controllers/ConfigController.php b/modules/monitoring/application/controllers/ConfigController.php index f0982c29a..f0322dc3f 100644 --- a/modules/monitoring/application/controllers/ConfigController.php +++ b/modules/monitoring/application/controllers/ConfigController.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Exception; +use Exception; use Icinga\Config\PreservingIniWriter; use Icinga\Web\Controller\ModuleActionController; diff --git a/modules/monitoring/application/controllers/MonitoringCommands.php b/modules/monitoring/application/controllers/MonitoringCommands.php index faa04114e..16b713d4c 100644 --- a/modules/monitoring/application/controllers/MonitoringCommands.php +++ b/modules/monitoring/application/controllers/MonitoringCommands.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Icinga\Module\Monitoring\Command\Meta; +use Icinga\Module\Monitoring\Command\Meta; /** * Class MonitoringCommands diff --git a/modules/monitoring/application/controllers/TimelineController.php b/modules/monitoring/application/controllers/TimelineController.php index 3fa621f3e..2f9b1339d 100644 --- a/modules/monitoring/application/controllers/TimelineController.php +++ b/modules/monitoring/application/controllers/TimelineController.php @@ -2,9 +2,9 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \DateTime; -use \DateInterval; -use \Zend_Config; +use DateTime; +use DateInterval; +use Zend_Config; use Icinga\Web\Url; use Icinga\Util\Format; use Icinga\Application\Config; diff --git a/modules/monitoring/application/forms/Command/AcknowledgeForm.php b/modules/monitoring/application/forms/Command/AcknowledgeForm.php index 364c3c20a..4ac4901b0 100644 --- a/modules/monitoring/application/forms/Command/AcknowledgeForm.php +++ b/modules/monitoring/application/forms/Command/AcknowledgeForm.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Form\Command; -use \Icinga\Web\Form\Element\DateTimePicker; -use \Icinga\Protocol\Commandpipe\Comment; -use \Icinga\Util\DateTimeFactory; -use \Icinga\Module\Monitoring\Command\AcknowledgeCommand; +use Icinga\Web\Form\Element\DateTimePicker; +use Icinga\Protocol\Commandpipe\Comment; +use Icinga\Util\DateTimeFactory; +use Icinga\Module\Monitoring\Command\AcknowledgeCommand; /** * Form for problem acknowledgements diff --git a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php index 6d49580a0..e413848c8 100644 --- a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php +++ b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Form\Command; -use \Icinga\Web\Form\Element\TriStateCheckbox; -use \Icinga\Web\Form; -use \Zend_Form_Element_Hidden; -use \Zend_Form; +use Icinga\Web\Form\Element\TriStateCheckbox; +use Icinga\Web\Form; +use Zend_Form_Element_Hidden; +use Zend_Form; /** * A form to edit multiple command flags of multiple commands at once. When some commands have diff --git a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php index 7333ccdac..d7228ebdf 100644 --- a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php +++ b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php @@ -5,7 +5,7 @@ namespace Icinga\Module\Monitoring\Form\Command; use Zend_Controller_Request_Abstract; -use \Zend_Form_Element_Hidden; +use Zend_Form_Element_Hidden; use Icinga\Module\Monitoring\Command\AcknowledgeCommand; use Icinga\Module\Monitoring\Command\SingleArgumentCommand; diff --git a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php index de2965565..c2c9151f3 100644 --- a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php +++ b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Form\Command; -use \Icinga\Exception\ProgrammingError; +use Icinga\Exception\ProgrammingError; /** * Form for submitting passive check results diff --git a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php index 513dea238..6acc210ae 100644 --- a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php +++ b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Form\Config\Backend; -use \Zend_Config; +use Zend_Config; /** * Extended EditBackendForm for creating new Backends diff --git a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php index 705804bb9..077e02183 100644 --- a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php @@ -4,8 +4,8 @@ namespace Icinga\Module\Monitoring\Form\Config\Instance; -use \Icinga\Web\Form; -use \Zend_Config; +use Icinga\Web\Form; +use Zend_Config; /** * Form for creating new instances diff --git a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php index e2a091c0f..f74b091df 100644 --- a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php @@ -4,8 +4,8 @@ namespace Icinga\Module\Monitoring\Form\Config\Instance; -use \Zend_Config; -use \Icinga\Web\Form; +use Zend_Config; +use Icinga\Web\Form; /** * Form for editing existing instances diff --git a/modules/monitoring/bin/action/list.inc.php b/modules/monitoring/bin/action/list.inc.php index 65a0ca61d..01fd35131 100644 --- a/modules/monitoring/bin/action/list.inc.php +++ b/modules/monitoring/bin/action/list.inc.php @@ -2,7 +2,7 @@ // {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}} -use \Icinga\Module\Monitoring\Backend; +use Icinga\Module\Monitoring\Backend; use Icinga\Util\Format; $backend = Backend::getInstance($params->shift('backend')); diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php index ce61c8f1b..75db67b55 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query; -use \Zend_Db_Select; +use Zend_Db_Select; class StatusSummaryQuery extends IdoQuery { diff --git a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php index b0cd1b445..3e1468e36 100644 --- a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php +++ b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Exception; -use \Exception; +use Exception; class UnsupportedBackendException extends Exception { diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php b/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php index 615999bdb..bd83a42cd 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeEntry.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Monitoring\Timeline; -use \DateTime; +use DateTime; use Icinga\Web\Url; use Icinga\Exception\ProgrammingError; diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php index fa5af9141..2b0158bf1 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php @@ -4,10 +4,10 @@ namespace Icinga\Module\Monitoring\Timeline; -use \DateTime; -use \Exception; -use \ArrayIterator; -use \IteratorAggregate; +use DateTime; +use Exception; +use ArrayIterator; +use IteratorAggregate; use Icinga\Data\Filter\Filter; use Icinga\Web\Hook; use Icinga\Web\Session; diff --git a/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php b/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php index 961aefca5..f50b07893 100644 --- a/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php +++ b/modules/monitoring/test/php/application/views/helpers/MonitoringFlagsTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Module\Monitoring\Application\Views\Helpers; -use \Zend_View_Helper_MonitoringFlags; +use Zend_View_Helper_MonitoringFlags; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringFlags.php'); diff --git a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php index aa13df35e..5a476aaef 100644 --- a/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php +++ b/modules/monitoring/test/php/application/views/helpers/MonitoringPropertiesTest.php @@ -4,7 +4,7 @@ namespace Test\Modules\Monitoring\Application\Views\Helpers; -use \Zend_View_Helper_MonitoringProperties; +use Zend_View_Helper_MonitoringProperties; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/MonitoringProperties.php'); diff --git a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php index 374578947..a14f64ae7 100644 --- a/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php +++ b/modules/monitoring/test/php/application/views/helpers/ResolveMacrosTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Modules\Monitoring\Application\Views\Helpers; -use \Mockery; -use \Zend_View_Helper_ResolveMacros; +use Mockery; +use Zend_View_Helper_ResolveMacros; use Icinga\Test\BaseTestCase; require_once realpath(BaseTestCase::$moduleDir . '/monitoring/application/views/helpers/ResolveMacros.php'); diff --git a/modules/translation/library/Translation/Cli/TranslationCommand.php b/modules/translation/library/Translation/Cli/TranslationCommand.php index 417d9d6ed..b3cfc6de4 100644 --- a/modules/translation/library/Translation/Cli/TranslationCommand.php +++ b/modules/translation/library/Translation/Cli/TranslationCommand.php @@ -4,7 +4,7 @@ namespace Icinga\Module\Translation\Cli; -use \Exception; +use Exception; use Icinga\Cli\Command; /** diff --git a/test/php/application/forms/Config/Authentication/ReorderFormTest.php b/test/php/application/forms/Config/Authentication/ReorderFormTest.php index a61efc48a..808806f1a 100644 --- a/test/php/application/forms/Config/Authentication/ReorderFormTest.php +++ b/test/php/application/forms/Config/Authentication/ReorderFormTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Form\Config\Authentication; -use \Mockery; -use \Zend_Config; +use Mockery; +use Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Form\Config\Authentication\ReorderForm; diff --git a/test/php/library/Icinga/Application/ConfigTest.php b/test/php/library/Icinga/Application/ConfigTest.php index bc39afecd..e99b17b2e 100644 --- a/test/php/library/Icinga/Application/ConfigTest.php +++ b/test/php/library/Icinga/Application/ConfigTest.php @@ -5,7 +5,7 @@ namespace Tests\Icinga\Application; use Icinga\Test\BaseTestCase; -use \Icinga\Application\Config as IcingaConfig; +use Icinga\Application\Config as IcingaConfig; class ConfigTest extends BaseTestCase { diff --git a/test/php/library/Icinga/Chart/GraphChartTest.php b/test/php/library/Icinga/Chart/GraphChartTest.php index 25870791a..6a7f73864 100644 --- a/test/php/library/Icinga/Chart/GraphChartTest.php +++ b/test/php/library/Icinga/Chart/GraphChartTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Chart; -use \DOMXPath; -use \DOMDocument; +use DOMXPath; +use DOMDocument; use Icinga\Chart\GridChart; use Icinga\Test\BaseTestCase; diff --git a/test/php/library/Icinga/Chart/PieChartTest.php b/test/php/library/Icinga/Chart/PieChartTest.php index c09f29e57..756fdf6e6 100644 --- a/test/php/library/Icinga/Chart/PieChartTest.php +++ b/test/php/library/Icinga/Chart/PieChartTest.php @@ -4,8 +4,8 @@ namespace Tests\Icinga\Chart; -use \DOMXPath; -use \DOMDocument; +use DOMXPath; +use DOMDocument; use Icinga\Chart\PieChart; use Icinga\Test\BaseTestCase; diff --git a/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php b/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php index 0ec9a4da6..7d3fd94f6 100644 --- a/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php +++ b/test/php/library/Icinga/Protocol/Commandpipe/CommandPipeTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Protocol\Commandpipe; -use \Zend_Config; +use Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Protocol\Commandpipe\Comment; use Icinga\Protocol\Commandpipe\CommandPipe; diff --git a/test/php/library/Icinga/Protocol/Ldap/QueryTest.php b/test/php/library/Icinga/Protocol/Ldap/QueryTest.php index 0fa155202..b710a0934 100644 --- a/test/php/library/Icinga/Protocol/Ldap/QueryTest.php +++ b/test/php/library/Icinga/Protocol/Ldap/QueryTest.php @@ -4,7 +4,7 @@ namespace Tests\Icinga\Protocol\Ldap; -use \Zend_Config; +use Zend_Config; use Icinga\Test\BaseTestCase; use Icinga\Protocol\Ldap\Connection; From 45638b218c04a984a2dce9b33a2a519d5492e81c Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 27 Aug 2014 16:03:15 +0200 Subject: [PATCH 13/18] Throw IcingaException rather than Exception fixes #7014 --- application/clicommands/WebCommand.php | 12 +-- .../controllers/DashboardController.php | 3 +- .../Config/Authentication/LdapBackendForm.php | 2 +- .../Application/ApplicationBootstrap.php | 7 +- library/Icinga/Application/Modules/Module.php | 11 ++- .../Authentication/Backend/DbUserBackend.php | 6 +- library/Icinga/Authentication/Manager.php | 13 +++- library/Icinga/Chart/Chart.php | 7 +- library/Icinga/Chart/Inline/PieChart.php | 3 +- library/Icinga/Cli/AnsiScreen.php | 11 ++- library/Icinga/Cli/Command.php | 3 +- library/Icinga/Data/Db/DbQuery.php | 8 +- library/Icinga/Data/SimpleQuery.php | 3 +- library/Icinga/Logger/Writer/FileWriter.php | 8 +- library/Icinga/Logger/Writer/SyslogWriter.php | 6 +- library/Icinga/Protocol/Ldap/Query.php | 14 ++-- library/Icinga/Protocol/Ldap/Root.php | 34 ++++---- .../Icinga/Protocol/Livestatus/Connection.php | 77 ++++++++----------- library/Icinga/Protocol/Livestatus/Query.php | 21 +++-- library/Icinga/Protocol/Nrpe/Connection.php | 14 ++-- library/Icinga/Protocol/Statusdat/Query.php | 17 ++-- .../Protocol/Statusdat/Query/Expression.php | 10 ++- .../Icinga/Protocol/Statusdat/Query/Group.php | 11 ++- .../Statusdat/View/MonitoringObjectList.php | 3 +- library/Icinga/Util/Translator.php | 16 +++- .../Web/Controller/ActionController.php | 8 +- .../Icinga/Web/Session/SessionNamespace.php | 8 +- .../Icinga/Web/Widget/Dashboard/Component.php | 9 +-- .../controllers/CommandController.php | 8 +- .../Monitoring/Backend/Ido/Query/IdoQuery.php | 6 +- .../library/Monitoring/Timeline/TimeLine.php | 16 +++- .../Translation/Cli/TranslationCommand.php | 11 ++- .../Util/GettextTranslationHelper.php | 11 ++- 33 files changed, 240 insertions(+), 157 deletions(-) diff --git a/application/clicommands/WebCommand.php b/application/clicommands/WebCommand.php index 4124cd731..11e7f002a 100644 --- a/application/clicommands/WebCommand.php +++ b/application/clicommands/WebCommand.php @@ -5,7 +5,7 @@ namespace Icinga\Clicommands; use Icinga\Cli\Command; -use Exception; +use Icinga\Exception\IcingaException; class WebCommand extends Command { @@ -13,11 +13,11 @@ class WebCommand extends Command { $minVersion = '5.4.0'; if (version_compare(PHP_VERSION, $minVersion) < 0) { - throw new Exception(sprintf( + throw new IcingaException( 'You are running PHP %s, internal webserver requires %s.', PHP_VERSION, $minVersion - )); + ); } $fork = $this->params->get('daemonize'); @@ -27,12 +27,12 @@ class WebCommand extends Command // TODO: Sanity check!! if ($socket === null) { $socket = '0.0.0.0:80'; - // throw new Exception('Socket is required'); + // throw new IcingaException('Socket is required'); } if ($basedir === null) { $basedir = dirname(ICINGAWEB_APPDIR) . '/public'; if (! file_exists($basedir) || ! is_dir($basedir)) { - throw new Exception('Basedir is required'); + throw new IcingaException('Basedir is required'); } } $basedir = realpath($basedir); @@ -68,7 +68,7 @@ class WebCommand extends Command { $pid = pcntl_fork(); if ($pid == -1) { - throw new Exception('Could not fork'); + throw new IcingaException('Could not fork'); } else if ($pid) { echo $this->screen->colorize('[OK]') . " Icinga Web server forked successfully\n"; diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index dc48dd7f3..72824178d 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -12,6 +12,7 @@ use Icinga\Form\Dashboard\AddUrlForm; use Icinga\Exception\NotReadableError; use Icinga\Exception\ConfigurationError; use Icinga\Web\Controller\ActionController; +use Icinga\Exception\IcingaException; /** * Handle creation, removal and displaying of dashboards, panes and components @@ -42,7 +43,7 @@ class DashboardController extends ActionController } $dashboard->readConfig($dashboardConfig); } catch (NotReadableError $e) { - Logger::error(new Exception('Cannot load dashboard configuration. An exception was thrown:', 0, $e)); + Logger::error(new IcingaException('Cannot load dashboard configuration. An exception was thrown:', $e)); return null; } return $dashboard; diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 89f446795..6dd0d9bd3 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -157,7 +157,7 @@ class LdapBackendForm extends BaseBackendForm $testConn->assertAuthenticationPossible(); /* if ($testConn->count() === 0) { - throw new Exception('No Users Found On Directory Server'); + throw new IcingaException('No Users Found On Directory Server'); } */ } catch (Exception $exc) { diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index 19fb48b58..3f68ce43b 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -14,6 +14,7 @@ use Icinga\Exception\NotReadableError; use Icinga\Logger\Logger; use Icinga\Util\DateTimeFactory; use Icinga\Util\Translator; +use Icinga\Exception\IcingaException; /** * This class bootstraps a thin Icinga application layer @@ -332,7 +333,7 @@ abstract class ApplicationBootstrap try { $this->moduleManager->loadEnabledModules(); } catch (NotReadableError $e) { - Logger::error(new Exception('Cannot load enabled modules. An exception was thrown:', 0, $e)); + Logger::error(new IcingaException('Cannot load enabled modules. An exception was thrown:', $e)); } return $this; } @@ -369,7 +370,7 @@ abstract class ApplicationBootstrap try { $this->config = Config::app(); } catch (NotReadableError $e) { - Logger::error(new Exception('Cannot load application configuration. An exception was thrown:', 0, $e)); + Logger::error(new IcingaException('Cannot load application configuration. An exception was thrown:', $e)); $this->config = new Zend_Config(array()); } return $this; @@ -417,7 +418,7 @@ abstract class ApplicationBootstrap ResourceFactory::setConfig($config); } catch (NotReadableError $e) { Logger::error( - new Exception('Cannot load resource configuration. An exception was thrown:', 0, $e) + new IcingaException('Cannot load resource configuration. An exception was thrown:', $e) ); } diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index ebc939f49..fc7c25b17 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -19,6 +19,7 @@ use Icinga\Web\Widget; use Icinga\Web\Widget\Dashboard\Pane; use Icinga\Util\File; use Icinga\Exception\ProgrammingError; +use Icinga\Exception\IcingaException; /** * Module handling @@ -630,8 +631,9 @@ class Module protected function providePermission($name, $description) { if ($this->providesPermission($name)) { - throw new Exception( - sprintf('Cannot provide permission "%s" twice', $name) + throw new IcingaException( + 'Cannot provide permission "%s" twice', + $name ); } $this->permissionList[$name] = (object) array( @@ -651,8 +653,9 @@ class Module protected function provideRestriction($name, $description) { if ($this->providesRestriction($name)) { - throw new Exception( - sprintf('Cannot provide restriction "%s" twice', $name) + throw new IcingaException( + 'Cannot provide restriction "%s" twice', + $name ); } $this->restrictionList[$name] = (object) array( diff --git a/library/Icinga/Authentication/Backend/DbUserBackend.php b/library/Icinga/Authentication/Backend/DbUserBackend.php index 95c99c346..a89a07c81 100644 --- a/library/Icinga/Authentication/Backend/DbUserBackend.php +++ b/library/Icinga/Authentication/Backend/DbUserBackend.php @@ -11,6 +11,7 @@ use Icinga\Exception\AuthenticationException; use Exception; use Zend_Db_Expr; use Zend_Db_Select; +use Icinga\Exception\IcingaException; class DbUserBackend extends UserBackend { @@ -60,7 +61,10 @@ class DbUserBackend extends UserBackend return false; } if ($salt === '') { - throw new Exception('Cannot find salt for user ' . $user->getUsername()); + throw new IcingaException( + 'Cannot find salt for user %s', + $user->getUsername() + ); } $select = new Zend_Db_Select($this->conn->getConnection()); diff --git a/library/Icinga/Authentication/Manager.php b/library/Icinga/Authentication/Manager.php index ec49aa416..75cf81481 100644 --- a/library/Icinga/Authentication/Manager.php +++ b/library/Icinga/Authentication/Manager.php @@ -13,6 +13,7 @@ use Icinga\Exception\NotReadableError; use Icinga\Application\Config as IcingaConfig; use Icinga\User\Preferences; use Icinga\User\Preferences\PreferencesStore; +use Icinga\Exception\IcingaException; class Manager { @@ -55,7 +56,11 @@ class Manager $config = IcingaConfig::app(); } catch (NotReadableError $e) { Logger::error( - new Exception('Cannot load preferences for user "' . $username . '". An exception was thrown', 0, $e) + new IcingaException( + 'Cannot load preferences for user "%s". An exception was thrown', + $username, + $e + ) ); $config = new Zend_Config(array()); } @@ -68,8 +73,10 @@ class Manager $preferences = new Preferences($preferencesStore->load()); } catch (NotReadableError $e) { Logger::error( - new Exception( - 'Cannot load preferences for user "' . $username . '". An exception was thrown', 0, $e + new IcingaException( + 'Cannot load preferences for user "%s". An exception was thrown', + $username, + $e ) ); $preferences = new Preferences(); diff --git a/library/Icinga/Chart/Chart.php b/library/Icinga/Chart/Chart.php index be436df2a..0974850ed 100644 --- a/library/Icinga/Chart/Chart.php +++ b/library/Icinga/Chart/Chart.php @@ -9,6 +9,7 @@ use Icinga\Chart\Legend; use Icinga\Chart\Palette; use Icinga\Chart\Primitive\Drawable; use Icinga\Chart\SVGRenderer; +use Icinga\Exception\IcingaException; /** * Base class for charts, extended by all other Chart classes. @@ -87,15 +88,15 @@ abstract class Chart implements Drawable * * Render this graph and return the created SVG * - * @return string The SVG created by the SvgRenderer + * @return string The SVG created by the SvgRenderer * - * @throws Exception Thrown wen the dataset is not valid for this graph + * @throws IcingaException Thrown wen the dataset is not valid for this graph * @see SVGRenderer::render */ public function render() { if (!$this->isValidDataFormat()) { - throw new Exception('Dataset for graph doesn\'t have the proper structure'); + throw new IcingaException('Dataset for graph doesn\'t have the proper structure'); } $this->build(); diff --git a/library/Icinga/Chart/Inline/PieChart.php b/library/Icinga/Chart/Inline/PieChart.php index 573c5e05d..7b2108720 100644 --- a/library/Icinga/Chart/Inline/PieChart.php +++ b/library/Icinga/Chart/Inline/PieChart.php @@ -7,6 +7,7 @@ namespace Icinga\Chart\Inline; use Icinga\Chart\PieChart as PieChartRenderer; use Imagick; use Exception; +use Icinga\Exception\IcingaException; /** * Draw an inline pie-chart directly from the available request parameters. @@ -33,7 +34,7 @@ class PieChart extends Inline { if (! class_exists('Imagick')) { // TODO: This is quick & dirty. 404? - throw new Exception('Cannot render PNGs without Imagick'); + throw new IcingaException('Cannot render PNGs without Imagick'); } $image = new Imagick(); $image->readImageBlob($this->render(false)); diff --git a/library/Icinga/Cli/AnsiScreen.php b/library/Icinga/Cli/AnsiScreen.php index d3eeed44e..f3b2b6654 100644 --- a/library/Icinga/Cli/AnsiScreen.php +++ b/library/Icinga/Cli/AnsiScreen.php @@ -5,6 +5,7 @@ namespace Icinga\Cli; use Icinga\Cli\Screen; +use Icinga\Exception\IcingaException; // @see http://en.wikipedia.org/wiki/ANSI_escape_code @@ -74,7 +75,10 @@ class AnsiScreen extends Screen protected function fgColor($color) { if (! array_key_exists($color, $this->fgColors)) { - throw new \Exception(sprintf('There is no such foreground color: %s', $color)); + throw new IcingaException( + 'There is no such foreground color: %s', + $color + ); } return $this->fgColors[$color]; } @@ -82,7 +86,10 @@ class AnsiScreen extends Screen protected function bgColor($color) { if (! array_key_exists($color, $this->bgColors)) { - throw new \Exception(sprintf('There is no such background color: %s', $color)); + throw new IcingaException( + 'There is no such background color: %s', + $color + ); } return $this->bgColors[$color]; } diff --git a/library/Icinga/Cli/Command.php b/library/Icinga/Cli/Command.php index acb2462e4..7546f871f 100644 --- a/library/Icinga/Cli/Command.php +++ b/library/Icinga/Cli/Command.php @@ -10,6 +10,7 @@ use Icinga\Cli\Params; use Icinga\Application\Config; use Icinga\Application\ApplicationBootstrap as App; use Exception; +use Icinga\Exception\IcingaException; abstract class Command { @@ -123,7 +124,7 @@ abstract class Command public function fail($msg) { - throw new Exception($msg); + throw new IcingaException('%s', $msg); } public function getDefaultActionName() diff --git a/library/Icinga/Data/Db/DbQuery.php b/library/Icinga/Data/Db/DbQuery.php index 3fb74a656..605e36af9 100644 --- a/library/Icinga/Data/Db/DbQuery.php +++ b/library/Icinga/Data/Db/DbQuery.php @@ -11,6 +11,7 @@ use Icinga\Data\Filter\FilterExpression; use Icinga\Data\Filter\FilterOr; use Icinga\Data\Filter\FilterAnd; use Icinga\Data\Filter\FilterNot; +use Icinga\Exception\IcingaException; use Zend_Db_Select; /** @@ -124,7 +125,10 @@ class DbQuery extends SimpleQuery $op = ' AND '; $str .= ' NOT '; } else { - throw new \Exception('Cannot render filter: ' . $filter); + throw new IcingaException( + 'Cannot render filter: %s', + $filter + ); } $parts = array(); if (! $filter->isEmpty()) { @@ -177,7 +181,7 @@ class DbQuery extends SimpleQuery if (! $value) { /* NOTE: It's too late to throw exceptions, we might finish in __toString - throw new \Exception(sprintf( + throw new IcingaException(sprintf( '"%s" is not a valid time expression', $value )); diff --git a/library/Icinga/Data/SimpleQuery.php b/library/Icinga/Data/SimpleQuery.php index b70bc0e5d..6a0b71c35 100644 --- a/library/Icinga/Data/SimpleQuery.php +++ b/library/Icinga/Data/SimpleQuery.php @@ -9,6 +9,7 @@ use Icinga\Data\Filter\Filter; use Icinga\Web\Paginator\Adapter\QueryAdapter; use Zend_Paginator; use Exception; +use Icinga\Exception\IcingaException; class SimpleQuery implements QueryInterface, Queryable { @@ -158,7 +159,7 @@ class SimpleQuery implements QueryInterface, Queryable public function setOrderColumns(array $orderColumns) { - throw new Exception('This function does nothing and will be removed'); + throw new IcingaException('This function does nothing and will be removed'); } /** diff --git a/library/Icinga/Logger/Writer/FileWriter.php b/library/Icinga/Logger/Writer/FileWriter.php index 2795b3541..2a50ca36b 100644 --- a/library/Icinga/Logger/Writer/FileWriter.php +++ b/library/Icinga/Logger/Writer/FileWriter.php @@ -5,6 +5,7 @@ namespace Icinga\Logger\Writer; use Exception; +use Icinga\Exception\IcingaException; use Zend_Config; use Icinga\Util\File; use Icinga\Logger\Logger; @@ -68,7 +69,7 @@ class FileWriter extends LogWriter * * @return string The string representation of the severity * - * @throws Exception In case the given severity is unknown + * @throws IcingaException In case the given severity is unknown */ protected function getSeverityString($severity) { @@ -82,7 +83,10 @@ class FileWriter extends LogWriter case Logger::$DEBUG: return '- DEBUG -'; default: - throw new Exception('Unknown severity "' . $severity . '"'); + throw new IcingaException( + 'Unknown severity "%s"', + $severity + ); } } diff --git a/library/Icinga/Logger/Writer/SyslogWriter.php b/library/Icinga/Logger/Writer/SyslogWriter.php index 8f7711a8a..d176e1cbb 100644 --- a/library/Icinga/Logger/Writer/SyslogWriter.php +++ b/library/Icinga/Logger/Writer/SyslogWriter.php @@ -9,6 +9,7 @@ use Zend_Config; use Icinga\Logger\Logger; use Icinga\Logger\LogWriter; use Icinga\Exception\ConfigurationError; +use Icinga\Exception\IcingaException; /** * Class to write messages to syslog @@ -72,7 +73,10 @@ class SyslogWriter extends LogWriter ); if (!array_key_exists($severity, $priorities)) { - throw new Exception('Severity "' . $severity . '" cannot be mapped to a valid syslog priority'); + throw new IcingaException( + 'Severity "%s" cannot be mapped to a valid syslog priority', + $severity + ); } $this->open(); diff --git a/library/Icinga/Protocol/Ldap/Query.php b/library/Icinga/Protocol/Ldap/Query.php index 3d380f9c7..ca8f5519f 100644 --- a/library/Icinga/Protocol/Ldap/Query.php +++ b/library/Icinga/Protocol/Ldap/Query.php @@ -4,6 +4,8 @@ namespace Icinga\Protocol\Ldap; +use Icinga\Exception\IcingaException; + /** * Search class * @@ -82,12 +84,10 @@ class Query public function limit($count = null, $offset = null) { if (! preg_match('~^\d+~', $count . $offset)) { - throw new Exception( - sprintf( - 'Got invalid limit: %s, %s', - $count, - $offset - ) + throw new IcingaException( + 'Got invalid limit: %s, %s', + $count, + $offset ); } $this->limit_count = (int) $count; @@ -316,7 +316,7 @@ class Query { $parts = array(); if (! isset($this->filters['objectClass']) || $this->filters['objectClass'] === null) { - // throw new Exception('Object class is mandatory'); + // throw new IcingaException('Object class is mandatory'); } foreach ($this->filters as $key => $value) { $parts[] = sprintf( diff --git a/library/Icinga/Protocol/Ldap/Root.php b/library/Icinga/Protocol/Ldap/Root.php index 46062c9d6..56abb4175 100644 --- a/library/Icinga/Protocol/Ldap/Root.php +++ b/library/Icinga/Protocol/Ldap/Root.php @@ -4,6 +4,8 @@ namespace Icinga\Protocol\Ldap; +use Icinga\Exception\IcingaException; + /** * This class is a special node object, representing your connections root node * @@ -95,16 +97,14 @@ class Root /** * @param $rdn * @return mixed - * @throws Exception + * @throws IcingaException */ public function getChildByRDN($rdn) { if (!$this->hasChildRDN($rdn)) { - throw new Exception( - sprintf( - 'The child RDN "%s" is not available', - $rdn - ) + throw new IcingaException( + 'The child RDN "%s" is not available', + $rdn ); } return $this->children[strtolower($rdn)]; @@ -154,28 +154,24 @@ class Root /** * @param $dn * @return $this - * @throws Exception + * @throws IcingaException */ protected function assertSubDN($dn) { $mydn = $this->getDN(); $end = substr($dn, -1 * strlen($mydn)); if (strtolower($end) !== strtolower($mydn)) { - throw new Exception( - sprintf( - '"%s" is not a child of "%s"', - $dn, - $mydn - ) + throw new IcingaException( + '"%s" is not a child of "%s"', + $dn, + $mydn ); } if (strlen($dn) === strlen($mydn)) { - throw new Exception( - sprintf( - '"%s" is not a child of "%s", they are equal', - $dn, - $mydn - ) + throw new IcingaException( + '"%s" is not a child of "%s", they are equal', + $dn, + $mydn ); } return $this; diff --git a/library/Icinga/Protocol/Livestatus/Connection.php b/library/Icinga/Protocol/Livestatus/Connection.php index 0b37f3fcf..c014ba70f 100644 --- a/library/Icinga/Protocol/Livestatus/Connection.php +++ b/library/Icinga/Protocol/Livestatus/Connection.php @@ -6,6 +6,7 @@ namespace Icinga\Protocol\Livestatus; use Icinga\Application\Benchmark; use Exception; +use Icinga\Exception\IcingaException; /** * Backend class managing handling MKI Livestatus connections @@ -73,22 +74,18 @@ class Connection $this->assertPhpExtensionLoaded('sockets'); if ($socket[0] === '/') { if (! is_writable($socket)) { - throw new \Exception( - sprintf( - 'Cannot write to livestatus socket "%s"', - $socket - ) + throw new IcingaException( + 'Cannot write to livestatus socket "%s"', + $socket ); } $this->socket_type = self::TYPE_UNIX; $this->socket_path = $socket; } else { if (! preg_match('~^tcp://([^:]+):(\d+)~', $socket, $m)) { - throw new \Exception( - sprintf( - 'Invalid TCP socket syntax: "%s"', - $socket - ) + throw new IcingaException( + 'Invalid TCP socket syntax: "%s"', + $socket ); } // TODO: Better syntax checks @@ -156,17 +153,15 @@ class Connection $length = (int) trim(substr($header, 4)); $body = $this->readFromSocket($length); if ($status !== 200) { - throw new Exception( - sprintf( - 'Problem while reading %d bytes from livestatus: %s', - $length, - $body - ) + throw new IcingaException( + 'Problem while reading %d bytes from livestatus: %s', + $length, + $body ); } $result = json_decode($body); if ($result === null) { - throw new Exception('Got invalid response body from livestatus'); + throw new IcingaException('Got invalid response body from livestatus'); } return $result; @@ -180,11 +175,9 @@ class Connection while ($offset < $length) { $data = socket_read($this->connection, $length - $offset); if ($data === false) { - throw new Exception( - sprintf( - 'Failed to read from livestatus socket: %s', - socket_strerror(socket_last_error($this->connection)) - ) + throw new IcingaException( + 'Failed to read from livestatus socket: %s', + socket_strerror(socket_last_error($this->connection)) ); } $size = strlen($data); @@ -196,12 +189,10 @@ class Connection } } if ($offset !== $length) { - throw new \Exception( - sprintf( - 'Got only %d instead of %d bytes from livestatus socket', - $offset, - $length - ) + throw new IcingaException( + 'Got only %d instead of %d bytes from livestatus socket', + $offset, + $length ); } @@ -212,7 +203,7 @@ class Connection { $res = socket_write($this->connection, $data); if ($res === false) { - throw new \Exception('Writing to livestatus socket failed'); + throw new IcingaException('Writing to livestatus socket failed'); } return true; } @@ -220,11 +211,9 @@ class Connection protected function assertPhpExtensionLoaded($name) { if (! extension_loaded($name)) { - throw new \Exception( - sprintf( - 'The extension "%s" is not loaded', - $name - ) + throw new IcingaException( + 'The extension "%s" is not loaded', + $name ); } } @@ -250,13 +239,11 @@ class Connection $this->connection = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if (! @socket_connect($this->connection, $this->socket_host, $this->socket_port)) { - throw new \Exception( - sprintf( - 'Cannot connect to livestatus TCP socket "%s:%d": %s', - $this->socket_host, - $this->socket_port, - socket_strerror(socket_last_error($this->connection)) - ) + throw new IcingaException( + 'Cannot connect to livestatus TCP socket "%s:%d": %s', + $this->socket_host, + $this->socket_port, + socket_strerror(socket_last_error($this->connection)) ); } socket_set_option($this->connection, SOL_TCP, TCP_NODELAY, 1); @@ -266,11 +253,9 @@ class Connection { $this->connection = socket_create(AF_UNIX, SOCK_STREAM, 0); if (! socket_connect($this->connection, $this->socket_path)) { - throw new \Exception( - sprintf( - 'Cannot connect to livestatus local socket "%s"', - $this->socket_path - ) + throw new IcingaException( + 'Cannot connect to livestatus local socket "%s"', + $this->socket_path ); } } diff --git a/library/Icinga/Protocol/Livestatus/Query.php b/library/Icinga/Protocol/Livestatus/Query.php index 73e287bd6..7c1e73c8a 100644 --- a/library/Icinga/Protocol/Livestatus/Query.php +++ b/library/Icinga/Protocol/Livestatus/Query.php @@ -5,6 +5,7 @@ namespace Icinga\Protocol\Livestatus; use Icinga\Protocol\AbstractQuery; +use Icinga\Exception\IcingaException; class Query extends AbstractQuery { @@ -86,12 +87,10 @@ class Query extends AbstractQuery public function limit($count = null, $offset = null) { if (! preg_match('~^\d+~', $count . $offset)) { - throw new Exception( - sprintf( - 'Got invalid limit: %s, %s', - $count, - $offset - ) + throw new IcingaException( + 'Got invalid limit: %s, %s', + $count, + $offset ); } $this->limit_count = (int) $count; @@ -122,11 +121,9 @@ class Query extends AbstractQuery public function from($table, $columns = null) { if (! $this->connection->hasTable($table)) { - throw new Exception( - sprintf( - 'This livestatus connection does not provide "%s"', - $table - ) + throw new IcingaException( + 'This livestatus connection does not provide "%s"', + $table ); } $this->table = $table; @@ -169,7 +166,7 @@ class Query extends AbstractQuery public function __toString() { if ($this->table === null) { - throw new Exception('Table is required'); + throw new IcingaException('Table is required'); } $default_headers = array( 'OutputFormat: json', diff --git a/library/Icinga/Protocol/Nrpe/Connection.php b/library/Icinga/Protocol/Nrpe/Connection.php index 3c06e259b..84a754e91 100644 --- a/library/Icinga/Protocol/Nrpe/Connection.php +++ b/library/Icinga/Protocol/Nrpe/Connection.php @@ -4,6 +4,8 @@ namespace Icinga\Protocol\Nrpe; +use Icinga\Exception\IcingaException; + class Connection { protected $host; @@ -47,11 +49,10 @@ class Connection // TODO: Check result checksum! $result = fread($conn, 8192); if ($result === false) { - throw new \Exception('CHECK_NRPE: Error receiving data from daemon.'); + throw new IcingaException('CHECK_NRPE: Error receiving data from daemon.'); } elseif (strlen($result) === 0) { - throw new \Exception( - 'CHECK_NRPE: Received 0 bytes from daemon.' - . ' Check the remote server logs for error messages' + throw new IcingaException( + 'CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages' ); } // TODO: CHECK_NRPE: Receive underflow - only %d bytes received (%d expected) @@ -80,7 +81,10 @@ class Connection $ctx ); if (! $this->connection) { - throw new \Exception(sprintf('NRPE Connection failed: ' . $errstr)); + throw new IcingaException( + 'NRPE Connection failed: %s', + $errstr + ); } } diff --git a/library/Icinga/Protocol/Statusdat/Query.php b/library/Icinga/Protocol/Statusdat/Query.php index ed8928b6f..f3b5ea85e 100644 --- a/library/Icinga/Protocol/Statusdat/Query.php +++ b/library/Icinga/Protocol/Statusdat/Query.php @@ -9,6 +9,7 @@ use Icinga\Exception\ProgrammingError; use Icinga\Data\SimpleQuery; use Icinga\Protocol\Statusdat\View\MonitoringObjectList; use Icinga\Protocol\Statusdat\Query\IQueryPart; +use Icinga\Exception\IcingaException; /** * Base implementation for Statusdat queries. @@ -163,7 +164,7 @@ class Query extends SimpleQuery * @param array $columns An array of attributes to use (required for fetchPairs()) * * @return $this Fluent interface - * @throws \Exception If the target is unknonw + * @throws IcingaException If the target is unknonw */ public function from($table, array $attributes = null) { @@ -173,7 +174,10 @@ class Query extends SimpleQuery if (isset(self::$VALID_TARGETS[$table])) { $this->source = $table; } else { - throw new \Exception('Unknown from target for status.dat :' . $table); + throw new IcingaException( + 'Unknown from target for status.dat :%s', + $table + ); } return $this; } @@ -397,16 +401,15 @@ class Query extends SimpleQuery /** * Fetch the result as an associative array using the first column as the key and the second as the value * - * @return array An associative array with the result - * @throws \Exception If no attributes are defined + * @return array An associative array with the result + * @throws IcingaException If no attributes are defined */ public function fetchPairs() { $result = array(); if (count($this->getColumns()) < 2) { - throw new Exception( - 'Status.dat "fetchPairs()" query expects at least' . - ' columns to be set in the query expression' + throw new IcingaException( + 'Status.dat "fetchPairs()" query expects at least columns to be set in the query expression' ); } $attributes = $this->getColumns(); diff --git a/library/Icinga/Protocol/Statusdat/Query/Expression.php b/library/Icinga/Protocol/Statusdat/Query/Expression.php index 1a04f07ff..1db48df33 100644 --- a/library/Icinga/Protocol/Statusdat/Query/Expression.php +++ b/library/Icinga/Protocol/Statusdat/Query/Expression.php @@ -4,6 +4,8 @@ namespace Icinga\Protocol\Statusdat\Query; +use Icinga\Exception\IcingaException; + class Expression implements IQueryPart { /** @@ -70,7 +72,7 @@ class Expression implements IQueryPart /** * @param $token - * @throws \Exception + * @throws IcingaException */ private function getOperatorType($token) { @@ -106,7 +108,11 @@ class Expression implements IQueryPart $this->CB = "isNotIn"; break; default: - throw new \Exception("Unknown operator $token in expression $this->expression !"); + throw new IcingaException( + 'Unknown operator %s in expression %s !', + $token, + $this->expression + ); } } diff --git a/library/Icinga/Protocol/Statusdat/Query/Group.php b/library/Icinga/Protocol/Statusdat/Query/Group.php index 51f4c2cf8..2e110843f 100644 --- a/library/Icinga/Protocol/Statusdat/Query/Group.php +++ b/library/Icinga/Protocol/Statusdat/Query/Group.php @@ -4,6 +4,8 @@ namespace Icinga\Protocol\Statusdat\Query; +use Icinga\Exception\IcingaException; + /** * Class Group * @package Icinga\Protocol\Statusdat\Query @@ -130,7 +132,7 @@ class Group implements IQueryPart } /** - * @throws \Exception + * @throws IcingaException */ private function tokenize() { @@ -154,7 +156,10 @@ class Group implements IQueryPart } if ($token === self::GROUP_END) { if ($subgroupCount < 1) { - throw new \Exception("Invalid Query: unexpected ')' at pos " . $this->parsePos); + throw new IcingaException( + 'Invalid Query: unexpected \')\' at pos %s', + $this->parsePos + ); } $subgroupCount--; /* @@ -192,7 +197,7 @@ class Group implements IQueryPart $this->subExpressionLength = $this->parsePos - $this->subExpressionStart; } if ($subgroupCount > 0) { - throw new \Exception("Unexpected end of query, are you missing a parenthesis?"); + throw new IcingaException('Unexpected end of query, are you missing a parenthesis?'); } $this->startNewSubExpression(); diff --git a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php index e9a7e1bc9..bde4ded04 100644 --- a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php +++ b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php @@ -8,6 +8,7 @@ use Iterator; use Countable; use ArrayAccess; use Exception; +use Icinga\Exception\IcingaException; /** * Wrapper around an array of monitoring objects that can be enhanced with an optional @@ -115,7 +116,7 @@ class MonitoringObjectList implements Iterator, Countable, ArrayAccess public function __set($name, $value) { - throw new Exception("Setting is currently not available for objects"); + throw new IcingaException('Setting is currently not available for objects'); } public function offsetExists($offset) diff --git a/library/Icinga/Util/Translator.php b/library/Icinga/Util/Translator.php index fd01812b3..b6cf533d9 100644 --- a/library/Icinga/Util/Translator.php +++ b/library/Icinga/Util/Translator.php @@ -5,6 +5,7 @@ namespace Icinga\Util; use Exception; +use Icinga\Exception\IcingaException; /** * Helper class to ease internationalization when using gettext @@ -53,12 +54,16 @@ class Translator * @param string $name The name of the domain to register * @param string $directory The directory where message catalogs can be found * - * @throws Exception In case the domain was not successfully registered + * @throws IcingaException In case the domain was not successfully registered */ public static function registerDomain($name, $directory) { if (bindtextdomain($name, $directory) === false) { - throw new Exception("Cannot register domain '$name' with path '$directory'"); + throw new IcingaException( + 'Cannot register domain \'%s\' with path \'%s\'', + $name, + $directory + ); } bind_textdomain_codeset($name, 'UTF-8'); self::$knownDomains[$name] = $directory; @@ -69,14 +74,17 @@ class Translator * * @param string $localeName The name of the locale to use * - * @throws Exception In case the locale's name is invalid + * @throws IcingaException In case the locale's name is invalid */ public static function setupLocale($localeName) { if (setlocale(LC_ALL, $localeName . '.UTF-8') === false && setlocale(LC_ALL, $localeName) === false) { setlocale(LC_ALL, 'C'); // C == "use whatever is hardcoded" if ($localeName !== self::DEFAULT_LOCALE) { - throw new Exception("Cannot set locale '$localeName' for category 'LC_ALL'"); + throw new IcingaException( + 'Cannot set locale \'%s\' for category \'LC_ALL\'', + $localeName + ); } } else { $locale = setlocale(LC_ALL, 0); diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 13809e83d..bfbb35b77 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -8,6 +8,7 @@ use Exception; use Icinga\Authentication\Manager as AuthManager; use Icinga\Application\Benchmark; use Icinga\Application\Config; +use Icinga\Exception\IcingaException; use Icinga\Util\Translator; use Icinga\Web\Widget\Tabs; use Icinga\Web\Window; @@ -177,7 +178,10 @@ class ActionController extends Zend_Controller_Action { if (! $this->Auth()->hasPermission($name)) { // TODO: Shall this be an Auth Exception? Or a 404? - throw new Exception(sprintf('Auth error, no permission for "%s"', $name)); + throw new IcingaException( + 'Auth error, no permission for "%s"', + $name + ); } } @@ -381,7 +385,7 @@ class ActionController extends Zend_Controller_Action if ($this->view->title) { if (preg_match('~[\r\n]~', $this->view->title)) { // TODO: Innocent exception and error log for hack attempts - throw new Exception('No way, guy'); + throw new IcingaException('No way, guy'); } $resp->setHeader( 'X-Icinga-Title', diff --git a/library/Icinga/Web/Session/SessionNamespace.php b/library/Icinga/Web/Session/SessionNamespace.php index 682991aed..b7495683b 100644 --- a/library/Icinga/Web/Session/SessionNamespace.php +++ b/library/Icinga/Web/Session/SessionNamespace.php @@ -6,6 +6,7 @@ namespace Icinga\Web\Session; use Exception; use ArrayIterator; +use Icinga\Exception\IcingaException; use IteratorAggregate; /** @@ -76,7 +77,10 @@ class SessionNamespace implements IteratorAggregate public function __get($key) { if (!array_key_exists($key, $this->values)) { - throw new Exception('Cannot access non-existent session value "' . $key . '"'); + throw new IcingaException( + 'Cannot access non-existent session value "%s"', + $key + ); } return $this->get($key); @@ -178,7 +182,7 @@ class SessionNamespace implements IteratorAggregate public function write() { if (!$this->session) { - throw new Exception('Cannot save, session not set'); + throw new IcingaException('Cannot save, session not set'); } $this->session->write(); diff --git a/library/Icinga/Web/Widget/Dashboard/Component.php b/library/Icinga/Web/Widget/Dashboard/Component.php index 56f499dc1..71615c572 100644 --- a/library/Icinga/Web/Widget/Dashboard/Component.php +++ b/library/Icinga/Web/Widget/Dashboard/Component.php @@ -4,6 +4,7 @@ namespace Icinga\Web\Widget\Dashboard; +use Icinga\Exception\IcingaException; use Icinga\Util\Dimension; use Icinga\Web\Form; use Icinga\Web\Url; @@ -81,11 +82,9 @@ EOD; } elseif ($url) { $this->url = Url::fromPath($url); } else { - throw new Exception( - sprintf( - 'Cannot create dashboard component "%s" without valid URL', - $title - ) + throw new IcingaException( + 'Cannot create dashboard component "%s" without valid URL', + $title ); } } diff --git a/modules/monitoring/application/controllers/CommandController.php b/modules/monitoring/application/controllers/CommandController.php index f3055371a..36d3d62ca 100644 --- a/modules/monitoring/application/controllers/CommandController.php +++ b/modules/monitoring/application/controllers/CommandController.php @@ -25,6 +25,7 @@ use Icinga\Module\Monitoring\Form\Command\DelayNotificationForm; use Icinga\Module\Monitoring\Form\Command\RescheduleNextCheckForm; use Icinga\Module\Monitoring\Form\Command\ScheduleDowntimeForm; use Icinga\Module\Monitoring\Form\Command\SubmitPassiveCheckResultForm; +use Icinga\Exception\IcingaException; /** * Class Monitoring_CommandController @@ -238,13 +239,16 @@ class Monitoring_CommandController extends Controller $given = array_intersect_key($supported, $this->getRequest()->getParams()); if (empty($given)) { - throw new \Exception('Missing parameter, supported: '.implode(', ', array_flip($supported))); + throw new IcingaException( + 'Missing parameter, supported: %s', + implode(', ', array_flip($supported)) + ); } if (isset($given['host'])) { $objects = $this->selectCommandTargets(!in_array("service", $supported)); if (empty($objects)) { - throw new \Exception("No objects found for your command"); + throw new IcingaException('No objects found for your command'); } } diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index df7118fe0..06472b44d 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Monitoring\Backend\Ido\Query; +use Icinga\Exception\IcingaException; use Icinga\Logger\Logger; use Icinga\Data\Db\DbQuery; use Icinga\Exception\ProgrammingError; @@ -272,7 +273,10 @@ abstract class IdoQuery extends DbQuery $this->requireColumn($condition); $col = $this->getMappedField($condition); if ($col === null) { - throw new \Exception("No such field: $condition"); + throw new IcingaException( + 'No such field: %s', + $condition + ); } return parent::where($col, $value); } diff --git a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php index 2b0158bf1..be3820e19 100644 --- a/modules/monitoring/library/Monitoring/Timeline/TimeLine.php +++ b/modules/monitoring/library/Monitoring/Timeline/TimeLine.php @@ -7,6 +7,7 @@ namespace Icinga\Module\Monitoring\Timeline; use DateTime; use Exception; use ArrayIterator; +use Icinga\Exception\IcingaException; use IteratorAggregate; use Icinga\Data\Filter\Filter; use Icinga\Web\Hook; @@ -166,7 +167,10 @@ class TimeLine implements IteratorAggregate $this->circleDiameter = floatval($matches[1]); $this->diameterUnit = $matches[2]; } else { - throw new Exception('Width "' . $width . '" is not a valid width'); + throw new IcingaException( + 'Width "%s" is not a valid width', + $width + ); } } @@ -184,10 +188,16 @@ class TimeLine implements IteratorAggregate if ($matches[2] === $this->diameterUnit) { $this->minCircleDiameter = floatval($matches[1]); } else { - throw new Exception('Unit needs to be in "' . $this->diameterUnit . '"'); + throw new IcingaException( + 'Unit needs to be in "%s"', + $this->diameterUnit + ); } } else { - throw new Exception('Width "' . $width . '" is not a valid width'); + throw new IcingaException( + 'Width "%s" is not a valid width', + $width + ); } } diff --git a/modules/translation/library/Translation/Cli/TranslationCommand.php b/modules/translation/library/Translation/Cli/TranslationCommand.php index b3cfc6de4..bae20cc5e 100644 --- a/modules/translation/library/Translation/Cli/TranslationCommand.php +++ b/modules/translation/library/Translation/Cli/TranslationCommand.php @@ -6,6 +6,7 @@ namespace Icinga\Module\Translation\Cli; use Exception; use Icinga\Cli\Command; +use Icinga\Exception\IcingaException; /** * Base class for translation commands @@ -24,7 +25,10 @@ class TranslationCommand extends Command public function validateLocaleCode($code) { if (! preg_match('@[a-z]{2}_[A-Z]{2}@', $code)) { - throw new Exception("Locale code '$code' is not valid. Expected format is: ll_CC"); + throw new IcingaException( + 'Locale code \'%s\' is not valid. Expected format is: ll_CC', + $code + ); } return $code; @@ -44,7 +48,10 @@ class TranslationCommand extends Command $enabledModules = $this->app->getModuleManager()->listEnabledModules(); if (!in_array($name, $enabledModules)) { - throw new Exception("Module with name '$name' not found or is not enabled"); + throw new IcingaException( + 'Module with name \'%s\' not found or is not enabled', + $name + ); } return $name; diff --git a/modules/translation/library/Translation/Util/GettextTranslationHelper.php b/modules/translation/library/Translation/Util/GettextTranslationHelper.php index a19353f33..68e07fbcd 100644 --- a/modules/translation/library/Translation/Util/GettextTranslationHelper.php +++ b/modules/translation/library/Translation/Util/GettextTranslationHelper.php @@ -5,6 +5,7 @@ namespace Icinga\Module\Translation\Util; use Exception; +use Icinga\Exception\IcingaException; use Icinga\Util\File; use Icinga\Application\Modules\Manager; use Icinga\Application\ApplicationBootstrap; @@ -215,7 +216,10 @@ class GettextTranslationHelper } else { if ((!is_dir(dirname($this->tablePath)) && !@mkdir(dirname($this->tablePath), 0755, true)) || !rename($this->templatePath, $this->tablePath)) { - throw new Exception('Unable to create ' . $this->tablePath); + throw new IcingaException( + 'Unable to create %s', + $this->tablePath + ); } } $this->updateHeader($this->tablePath); @@ -364,7 +368,10 @@ class GettextTranslationHelper { $directoryHandle = opendir($directory); if (!$directoryHandle) { - throw new Exception('Unable to read files from ' . $directory); + throw new IcingaException( + 'Unable to read files from %s', + $directory + ); } $subdirs = array(); From afd0c20c42b1eef2b8adcd1ed2697ca2cf6cec2e Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 27 Aug 2014 16:23:44 +0200 Subject: [PATCH 14/18] FilterException: extend IcingaException refs #6931 --- library/Icinga/Data/Filter/FilterException.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Data/Filter/FilterException.php b/library/Icinga/Data/Filter/FilterException.php index e70ee6b77..8f770810f 100644 --- a/library/Icinga/Data/Filter/FilterException.php +++ b/library/Icinga/Data/Filter/FilterException.php @@ -4,11 +4,11 @@ namespace Icinga\Data\Filter; -use Exception; +use Icinga\Exception\IcingaException; /** * Filter Exception Class * * Filter Exceptions should be thrown on filter parse errors or similar */ -class FilterException extends Exception {} +class FilterException extends IcingaException {} From e6612fefe7d97c0cccdaaf195c4f387b052ad333 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 27 Aug 2014 16:26:43 +0200 Subject: [PATCH 15/18] FilterParseException: extend IcingaException refs #6931 --- library/Icinga/Data/Filter/FilterParseException.php | 4 ++-- library/Icinga/Data/Filter/FilterQueryString.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Data/Filter/FilterParseException.php b/library/Icinga/Data/Filter/FilterParseException.php index bb90067b8..5633b5adf 100644 --- a/library/Icinga/Data/Filter/FilterParseException.php +++ b/library/Icinga/Data/Filter/FilterParseException.php @@ -4,8 +4,8 @@ namespace Icinga\Data\Filter; -use Exception; +use Icinga\Exception\IcingaException; -class FilterParseException extends Exception +class FilterParseException extends IcingaException { } diff --git a/library/Icinga/Data/Filter/FilterQueryString.php b/library/Icinga/Data/Filter/FilterQueryString.php index 88d3f0a37..3dbcce473 100644 --- a/library/Icinga/Data/Filter/FilterQueryString.php +++ b/library/Icinga/Data/Filter/FilterQueryString.php @@ -15,7 +15,7 @@ class FilterQueryString protected $reportDebug = false; protected $length; - + protected function __construct() { } @@ -111,13 +111,13 @@ class FilterQueryString $extra .= "\n" . implode("\n", $this->debug); } - throw new FilterParseException(sprintf( + throw new FilterParseException( 'Invalid filter "%s", unexpected %s at pos %d%s', $this->string, $char, $this->pos, $extra - )); + ); } protected function readFilters($nestingLevel = 0, $op = null) From 8b0df6c9f782f42e09c74e0ef1c7af59e754b2a1 Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Wed, 27 Aug 2014 16:29:56 +0200 Subject: [PATCH 16/18] UnsupportedBackendException: extend IcingaException refs #6931 --- .../Monitoring/Exception/UnsupportedBackendException.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php index 3e1468e36..169fa2cfd 100644 --- a/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php +++ b/modules/monitoring/library/Monitoring/Exception/UnsupportedBackendException.php @@ -4,8 +4,9 @@ namespace Icinga\Module\Monitoring\Exception; -use Exception; -class UnsupportedBackendException extends Exception +use Icinga\Exception\IcingaException; + +class UnsupportedBackendException extends IcingaException { -} \ No newline at end of file +} From 9465c3ffb6064b12fc32fab466ba4baf4d5a5600 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 27 Aug 2014 16:13:25 +0200 Subject: [PATCH 17/18] Show/Contact: Add commands to view Create a new command query and join contact information into. refs #4804 --- .../controllers/ShowController.php | 25 ++++++-- .../views/scripts/show/contact.phtml | 21 ++++--- .../Backend/Ido/Query/CommandQuery.php | 60 +++++++++++++++++++ .../library/Monitoring/DataView/Command.php | 28 +++++++++ 4 files changed, 120 insertions(+), 14 deletions(-) create mode 100644 modules/monitoring/library/Monitoring/Backend/Ido/Query/CommandQuery.php create mode 100644 modules/monitoring/library/Monitoring/DataView/Command.php diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 55b57cd52..19c1b7bef 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -108,13 +108,15 @@ class Monitoring_ShowController extends Controller public function contactAction() { - $contact = $this->getParam('contact'); - if (! $contact) { + $contactName = $this->getParam('contact'); + + if (! $contactName) { throw new Zend_Controller_Action_Exception( $this->translate('The parameter `contact\' is required'), 404 ); } + $query = $this->backend->select()->from('contact', array( 'contact_name', 'contact_id', @@ -135,9 +137,22 @@ class Monitoring_ShowController extends Controller 'contact_notify_host_flapping', 'contact_notify_host_downtime', )); - $query->where('contact_name', $contact); - $this->view->contacts = $query->paginate(); - $this->view->contact_name = $contact; + + $query->where('contact_name', $contactName); + + $contact = $query->getQuery()->fetchRow(); + + if ($contact) { + $commands = $this->backend->select()->from('command', array( + 'command_line', + 'command_name' + ))->where('contact_id', $contact->contact_id); + + $this->view->commands = $commands->paginate(); + } + + $this->view->contact = $contact; + $this->view->contactName = $contactName; } /** diff --git a/modules/monitoring/application/views/scripts/show/contact.phtml b/modules/monitoring/application/views/scripts/show/contact.phtml index a7b691eb4..fff03a106 100644 --- a/modules/monitoring/application/views/scripts/show/contact.phtml +++ b/modules/monitoring/application/views/scripts/show/contact.phtml @@ -2,7 +2,7 @@ $contactHelper = $this->getHelper('ContactFlags'); ?>
- + @@ -45,12 +45,15 @@ $contactHelper = $this->getHelper('ContactFlags');
- + +

translate('Commands'); ?>:

+
    + +
  • command_name; ?>
  • + +
+ + + translate('No such contact'); ?>: +
diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommandQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommandQuery.php new file mode 100644 index 000000000..664cb3576 --- /dev/null +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommandQuery.php @@ -0,0 +1,60 @@ + array( + 'command_id' => 'c.command_id', + 'command_instance_id' => 'c.instance_id', + 'command_config_type' => 'c.config_type', + 'command_line' => 'c.command_line', + 'command_name' => 'co.name1' + ), + + 'contacts' => array( + 'contact_id' => 'con.contact_id', + 'contact_alias' => 'con.contact_alias' + ) + ); + + /** + * Fetch basic information about commands + */ + protected function joinBaseTables() + { + $this->select->from( + array('c' => $this->prefix . 'commands'), + array() + )->join( + array('co' => $this->prefix . 'objects'), + 'co.object_id = c.object_id', + array() + ); + + $this->joinedVirtualTables = array('commands' => true); + } + + /** + * Join contacts + */ + protected function joinContacts() + { + $this->select->join( + array('cnc' => $this->prefix . 'contact_notificationcommands'), + 'cnc.command_object_id = co.object_id' + )->join( + array('con' => $this->prefix . 'contacts'), + 'con.contact_id = cnc.contact_id' + ); + } +} \ No newline at end of file diff --git a/modules/monitoring/library/Monitoring/DataView/Command.php b/modules/monitoring/library/Monitoring/DataView/Command.php new file mode 100644 index 000000000..a21c48ee0 --- /dev/null +++ b/modules/monitoring/library/Monitoring/DataView/Command.php @@ -0,0 +1,28 @@ + Date: Wed, 27 Aug 2014 16:36:52 +0200 Subject: [PATCH 18/18] Show/Contact: Add notification history to view refs #4804 --- .../application/controllers/ShowController.php | 15 +++++++++++++++ .../application/views/scripts/show/contact.phtml | 3 +++ .../Monitoring/Backend/Ido/Query/ContactQuery.php | 1 + .../Backend/Ido/Query/NotificationQuery.php | 3 ++- .../library/Monitoring/DataView/Contact.php | 1 + 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 19c1b7bef..1ad0f29dd 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -123,6 +123,7 @@ class Monitoring_ShowController extends Controller 'contact_alias', 'contact_email', 'contact_pager', + 'contact_object_id', 'contact_notify_service_timeperiod', 'contact_notify_service_recovery', 'contact_notify_service_warning', @@ -149,6 +150,20 @@ class Monitoring_ShowController extends Controller ))->where('contact_id', $contact->contact_id); $this->view->commands = $commands->paginate(); + + $notifications = $this->backend->select()->from('notification', array( + 'host', + 'service', + 'notification_output', + 'notification_contact', + 'notification_start_time', + 'notification_state' + )); + + $notifications->where('contact_object_id', $contact->contact_object_id); + + $this->view->compact = true; + $this->view->notifications = $notifications->paginate(); } $this->view->contact = $contact; diff --git a/modules/monitoring/application/views/scripts/show/contact.phtml b/modules/monitoring/application/views/scripts/show/contact.phtml index fff03a106..45d751fd5 100644 --- a/modules/monitoring/application/views/scripts/show/contact.phtml +++ b/modules/monitoring/application/views/scripts/show/contact.phtml @@ -53,6 +53,9 @@ $contactHelper = $this->getHelper('ContactFlags'); +

translate('Notifications'); ?>:

+ render('list/notifications.phtml') ?> + translate('No such contact'); ?>: diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php index a868d5479..89fa37fcd 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ContactQuery.php @@ -13,6 +13,7 @@ class ContactQuery extends IdoQuery 'contact_alias' => 'c.alias COLLATE latin1_general_ci', 'contact_email' => 'c.email_address COLLATE latin1_general_ci', 'contact_pager' => 'c.pager_address', + 'contact_object_id' => 'c.contact_object_id', 'contact_has_host_notfications' => 'c.host_notifications_enabled', 'contact_has_service_notfications' => 'c.service_notifications_enabled', 'contact_can_submit_commands' => 'c.can_submit_commands', diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php index 68a37d83c..882600240 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationQuery.php @@ -25,7 +25,8 @@ class NotificationQuery extends IdoQuery 'service' => 'o.name2' ), 'contact' => array( - 'notification_contact' => 'c_o.name1' + 'notification_contact' => 'c_o.name1', + 'contact_object_id' => 'c_o.object_id' ), 'command' => array( 'notification_command' => 'cmd_o.name1' diff --git a/modules/monitoring/library/Monitoring/DataView/Contact.php b/modules/monitoring/library/Monitoring/DataView/Contact.php index 7d24d1255..9f78a3b6a 100644 --- a/modules/monitoring/library/Monitoring/DataView/Contact.php +++ b/modules/monitoring/library/Monitoring/DataView/Contact.php @@ -38,6 +38,7 @@ class Contact extends DataView 'contact_notify_host_unreachable', 'contact_notify_host_flapping', 'contact_notify_host_downtime', + 'contact_object_id', 'host_object_id', 'host_name', 'service_object_id',