summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md5
-rw-r--r--README.md8
-rw-r--r--application/clicommands/MigrateCommand.php9
-rw-r--r--application/controllers/MigrateController.php10
-rw-r--r--application/forms/Command/CommandForm.php40
-rw-r--r--application/forms/Command/Instance/ToggleInstanceFeaturesForm.php3
-rw-r--r--application/forms/Command/Object/AcknowledgeProblemForm.php10
-rw-r--r--application/forms/Command/Object/AddCommentForm.php10
-rw-r--r--application/forms/Command/Object/CheckNowForm.php27
-rw-r--r--application/forms/Command/Object/DeleteCommentForm.php17
-rw-r--r--application/forms/Command/Object/DeleteDowntimeForm.php21
-rw-r--r--application/forms/Command/Object/ProcessCheckResultForm.php17
-rw-r--r--application/forms/Command/Object/RemoveAcknowledgementForm.php10
-rw-r--r--application/forms/Command/Object/ScheduleCheckForm.php27
-rw-r--r--application/forms/Command/Object/ScheduleHostDowntimeForm.php10
-rw-r--r--application/forms/Command/Object/ScheduleServiceDowntimeForm.php10
-rw-r--r--application/forms/Command/Object/SendCustomNotificationForm.php10
-rw-r--r--application/forms/Command/Object/ToggleObjectFeaturesForm.php9
-rw-r--r--configuration.php41
-rw-r--r--doc/01-About.md7
-rw-r--r--doc/02-Installation.md.d/From-Source.md2
-rw-r--r--doc/03-Configuration.md47
-rw-r--r--doc/10-Migration.md13
-rw-r--r--doc/TRADEMARKS.md13
-rw-r--r--doc/res/icingadb-architecture.pngbin563761 -> 454289 bytes
-rw-r--r--doc/res/icingadb-web.pngbin532529 -> 424776 bytes
-rw-r--r--library/Icingadb/Command/Object/ObjectsCommand.php13
-rw-r--r--library/Icingadb/Command/Transport/CommandTransport.php4
-rw-r--r--library/Icingadb/Common/CommandActions.php21
-rw-r--r--library/Icingadb/Common/Macros.php13
-rw-r--r--library/Icingadb/Compat/CompatObject.php15
-rw-r--r--library/Icingadb/Compat/UrlMigrator.php13
-rw-r--r--library/Icingadb/Data/CsvResultSet.php79
-rw-r--r--library/Icingadb/Data/CsvResultSetUtils.php106
-rw-r--r--library/Icingadb/Data/JsonResultSet.php74
-rw-r--r--library/Icingadb/Data/JsonResultSetUtils.php132
-rw-r--r--library/Icingadb/Data/VolatileCsvResults.php15
-rw-r--r--library/Icingadb/Data/VolatileJsonResults.php15
-rw-r--r--library/Icingadb/Model/AcknowledgementHistory.php16
-rw-r--r--library/Icingadb/Model/ActionUrl.php5
-rw-r--r--library/Icingadb/Model/Behavior/FlattenedObjectVars.php29
-rw-r--r--library/Icingadb/Model/Checkcommand.php11
-rw-r--r--library/Icingadb/Model/CheckcommandArgument.php17
-rw-r--r--library/Icingadb/Model/CheckcommandCustomvar.php6
-rw-r--r--library/Icingadb/Model/CheckcommandEnvvar.php8
-rw-r--r--library/Icingadb/Model/Comment.php19
-rw-r--r--library/Icingadb/Model/CommentHistory.php18
-rw-r--r--library/Icingadb/Model/Customvar.php7
-rw-r--r--library/Icingadb/Model/CustomvarFlat.php25
-rw-r--r--library/Icingadb/Model/Downtime.php27
-rw-r--r--library/Icingadb/Model/DowntimeHistory.php25
-rw-r--r--library/Icingadb/Model/Endpoint.php9
-rw-r--r--library/Icingadb/Model/Environment.php4
-rw-r--r--library/Icingadb/Model/Eventcommand.php11
-rw-r--r--library/Icingadb/Model/EventcommandArgument.php17
-rw-r--r--library/Icingadb/Model/EventcommandCustomvar.php6
-rw-r--r--library/Icingadb/Model/EventcommandEnvvar.php8
-rw-r--r--library/Icingadb/Model/FlappingHistory.php14
-rw-r--r--library/Icingadb/Model/History.php16
-rw-r--r--library/Icingadb/Model/Host.php40
-rw-r--r--library/Icingadb/Model/HostCustomvar.php6
-rw-r--r--library/Icingadb/Model/Hostgroup.php10
-rw-r--r--library/Icingadb/Model/HostgroupCustomvar.php6
-rw-r--r--library/Icingadb/Model/HostgroupMember.php6
-rw-r--r--library/Icingadb/Model/Hostgroupsummary.php29
-rw-r--r--library/Icingadb/Model/HoststateSummary.php14
-rw-r--r--library/Icingadb/Model/IconImage.php5
-rw-r--r--library/Icingadb/Model/Instance.php16
-rw-r--r--library/Icingadb/Model/NotesUrl.php5
-rw-r--r--library/Icingadb/Model/Notification.php18
-rw-r--r--library/Icingadb/Model/NotificationCustomvar.php6
-rw-r--r--library/Icingadb/Model/NotificationHistory.php16
-rw-r--r--library/Icingadb/Model/NotificationUser.php6
-rw-r--r--library/Icingadb/Model/NotificationUsergroup.php6
-rw-r--r--library/Icingadb/Model/Notificationcommand.php11
-rw-r--r--library/Icingadb/Model/NotificationcommandArgument.php17
-rw-r--r--library/Icingadb/Model/NotificationcommandCustomvar.php6
-rw-r--r--library/Icingadb/Model/NotificationcommandEnvvar.php8
-rw-r--r--library/Icingadb/Model/Service.php38
-rw-r--r--library/Icingadb/Model/ServiceCustomvar.php6
-rw-r--r--library/Icingadb/Model/ServiceState.php5
-rw-r--r--library/Icingadb/Model/Servicegroup.php10
-rw-r--r--library/Icingadb/Model/ServicegroupCustomvar.php6
-rw-r--r--library/Icingadb/Model/ServicegroupMember.php6
-rw-r--r--library/Icingadb/Model/ServicegroupSummary.php23
-rw-r--r--library/Icingadb/Model/ServicestateSummary.php18
-rw-r--r--library/Icingadb/Model/State.php7
-rw-r--r--library/Icingadb/Model/StateHistory.php20
-rw-r--r--library/Icingadb/Model/Timeperiod.php11
-rw-r--r--library/Icingadb/Model/TimeperiodCustomvar.php6
-rw-r--r--library/Icingadb/Model/TimeperiodOverrideExclude.php6
-rw-r--r--library/Icingadb/Model/TimeperiodOverrideInclude.php6
-rw-r--r--library/Icingadb/Model/TimeperiodRange.php7
-rw-r--r--library/Icingadb/Model/User.php16
-rw-r--r--library/Icingadb/Model/UserCustomvar.php6
-rw-r--r--library/Icingadb/Model/Usergroup.php10
-rw-r--r--library/Icingadb/Model/UsergroupCustomvar.php6
-rw-r--r--library/Icingadb/Model/UsergroupMember.php6
-rw-r--r--library/Icingadb/Model/Zone.php11
-rw-r--r--library/Icingadb/ProvidedHook/ApplicationState.php4
-rw-r--r--library/Icingadb/ProvidedHook/RedisHealth.php10
-rw-r--r--library/Icingadb/Setup/RedisPage.php4
-rw-r--r--library/Icingadb/Setup/RedisStep.php4
-rw-r--r--library/Icingadb/Util/PluginOutput.php21
-rw-r--r--library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php8
-rw-r--r--library/Icingadb/Web/Controller.php21
-rw-r--r--library/Icingadb/Web/Navigation/Action.php2
-rw-r--r--library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php4
-rw-r--r--library/Icingadb/Widget/Detail/DowntimeCard.php2
-rw-r--r--library/Icingadb/Widget/Detail/EventDetail.php8
-rw-r--r--library/Icingadb/Widget/Detail/MultiselectQuickActions.php1
-rw-r--r--library/Icingadb/Widget/Detail/ObjectDetail.php5
-rw-r--r--library/Icingadb/Widget/HostSummaryDonut.php2
-rw-r--r--library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php6
-rw-r--r--library/Icingadb/Widget/ItemList/HostDetailHeader.php4
-rw-r--r--library/Icingadb/Widget/ItemList/ServiceDetailHeader.php4
-rw-r--r--library/Icingadb/Widget/ItemList/StateList.php2
-rw-r--r--library/Icingadb/Widget/ItemList/StateListItem.php2
-rw-r--r--library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/HostgroupTableRow.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/StateRowItem.php2
-rw-r--r--library/Icingadb/Widget/ServiceSummaryDonut.php2
-rw-r--r--module.info4
-rw-r--r--phpstan-baseline-7x.neon116
-rw-r--r--phpstan-baseline-8x.neon111
-rw-r--r--phpstan-baseline-by-php-version.php12
-rw-r--r--phpstan-baseline-standard.neon (renamed from phpstan-baseline.neon)731
-rw-r--r--phpstan.neon8
-rw-r--r--public/js/action-list.js1
-rw-r--r--test/php/Lib/StrikingCommandTransport.php28
-rw-r--r--test/php/library/Icingadb/Command/Transport/CommandTransportTest.php48
-rw-r--r--test/php/library/Icingadb/Model/Behavior/FlattenedObjectVarsTest.php161
134 files changed, 1958 insertions, 1031 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ee118f..86887b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@
Please make sure to always read our [Upgrading](https://icinga.com/docs/icinga-db-web/latest/doc/05-Upgrading/)
documentation before switching to a new version.
+## 1.1.2 (2024-04-11)
+
+Included changes can be found on the milestone: https://github.com/Icinga/icingadb-web/milestone/6?closed=1
+And a detailed description about the most important ones on our blog: https://icinga.com/blog/2024/04/11/releasing-icinga-db-1-2-0-and-icinga-db-web-1-1-2
+
## 1.1.1 (2023-11-15)
Included changes can be found on the milestone: https://github.com/Icinga/icingadb-web/milestone/5?closed=1
diff --git a/README.md b/README.md
index 2915cc9..19bc02f 100644
--- a/README.md
+++ b/README.md
@@ -7,13 +7,13 @@
Icinga DB is a set of components for publishing, synchronizing and
visualizing monitoring data in the Icinga ecosystem, consisting of:
-* Icinga DB Web which connects to both a Redis server and a database to view and work with
+* Icinga DB Web which connects to both a Redis®[\*](doc/TRADEMARKS.md#redis) server and a database to view and work with
most up-to-date monitoring data
* Icinga 2 with its [Icinga DB feature](https://icinga.com/docs/icinga-2/latest/doc/14-features/#icinga-db) enabled,
- responsible for publishing the data to the Redis server, i.e. configuration and its runtime updates, check results, state changes,
- downtimes, acknowledgements, notifications, and other events such as flapping
+ responsible for publishing the data to the Redis® server, i.e. configuration and its runtime updates, check results,
+ state changes, downtimes, acknowledgements, notifications, and other events such as flapping
* And the [Icinga DB daemon](https://icinga.com/docs/icinga-db),
- which synchronizes the data between the Redis server and the database
+ which synchronizes the data between the Redis® server and the database
![Icinga DB Architecture](doc/res/icingadb-architecture.png)
diff --git a/application/clicommands/MigrateCommand.php b/application/clicommands/MigrateCommand.php
index 6d034ee..17892bb 100644
--- a/application/clicommands/MigrateCommand.php
+++ b/application/clicommands/MigrateCommand.php
@@ -496,9 +496,8 @@ class MigrateCommand extends Command
);
$changed = false;
- /** @var ConfigObject $dashboardConfig */
+ /** @var ConfigObject<string> $dashboardConfig */
foreach ($dashboardsConfig->getConfigObject() as $name => $dashboardConfig) {
- /** @var ?string $dashboardUrlString */
$dashboardUrlString = $dashboardConfig->get('url');
if ($dashboardUrlString !== null) {
$dashBoardUrl = Url::fromPath($dashboardUrlString, [], new Request());
@@ -595,9 +594,8 @@ class MigrateCommand extends Command
private function transformNavigationItems(Config $config, string $owner, int &$rc): bool
{
$updated = false;
- /** @var ConfigObject $newConfigObject */
+ /** @var ConfigObject<string> $newConfigObject */
foreach ($config->getConfigObject() as $section => $newConfigObject) {
- /** @var string $configOwner */
$configOwner = $newConfigObject->get('owner') ?? '';
if ($configOwner && $configOwner !== $owner) {
continue;
@@ -686,9 +684,8 @@ class MigrateCommand extends Command
$newConfig = $config->getConfigFile() === $path ? $config : $this->readFromIni($path, $rc);
$updated = false;
- /** @var ConfigObject $configObject */
+ /** @var ConfigObject<string> $configObject */
foreach ($config->getConfigObject() as $configObject) {
- /** @var string $configOwner */
$configOwner = $configObject->get('owner') ?? '';
if ($configOwner && $configOwner !== $owner) {
continue;
diff --git a/application/controllers/MigrateController.php b/application/controllers/MigrateController.php
index 811b5d0..c14eef7 100644
--- a/application/controllers/MigrateController.php
+++ b/application/controllers/MigrateController.php
@@ -90,8 +90,16 @@ class MigrateController extends Controller
$params = $url->onlyWith(['sort', 'limit', 'view', 'columns', 'page'])->getParams();
$filter = $url->without(['sort', 'limit', 'view', 'columns', 'page'])->getParams();
$filter = QueryString::parse((string) $filter);
+ $nonStrictOriginalFilter = QueryString::render($filter);
$filter = UrlMigrator::transformLegacyWildcardFilter($filter);
- $result[] = rawurldecode($url->setParams($params)->setFilter($filter)->getAbsoluteUrl());
+ $nonStrictUpdatedFilter = QueryString::render($filter);
+ if ($nonStrictUpdatedFilter !== $nonStrictOriginalFilter) {
+ // The original filter might be formatted loosely, so if we render it again,
+ // it might look different although nothing changed
+ $result[] = rawurldecode($url->setParams($params)->setFilter($filter)->getAbsoluteUrl());
+ } else {
+ $result[] = $urlString;
+ }
}
$response = $this->getResponse()->json();
diff --git a/application/forms/Command/CommandForm.php b/application/forms/Command/CommandForm.php
index a535c6d..49a0565 100644
--- a/application/forms/Command/CommandForm.php
+++ b/application/forms/Command/CommandForm.php
@@ -5,8 +5,8 @@
namespace Icinga\Module\Icingadb\Forms\Command;
use ArrayIterator;
+use Countable;
use Exception;
-use Generator;
use Icinga\Application\Logger;
use Icinga\Module\Icingadb\Command\IcingaCommand;
use Icinga\Module\Icingadb\Command\Transport\CommandTransport;
@@ -16,6 +16,8 @@ use Icinga\Web\Session;
use ipl\Html\Form;
use ipl\Orm\Model;
use ipl\Web\Common\CsrfCounterMeasure;
+use Iterator;
+use IteratorIterator;
use Traversable;
abstract class CommandForm extends Form
@@ -25,7 +27,7 @@ abstract class CommandForm extends Form
protected $defaultAttributes = ['class' => 'icinga-form icinga-controls'];
- /** @var mixed */
+ /** @var (Traversable<Model>&Countable)|array<Model> */
protected $objects;
/** @var bool */
@@ -43,7 +45,7 @@ abstract class CommandForm extends Form
/**
* Set the objects to issue the command for
*
- * @param mixed $objects A traversable that is also countable
+ * @param (Traversable<Model>&Countable)|array<Model> $objects A traversable that is also countable
*
* @return $this
*/
@@ -57,7 +59,7 @@ abstract class CommandForm extends Form
/**
* Get the objects to issue the command for
*
- * @return mixed
+ * @return (Traversable<Model>&Countable)|array<Model>
*/
public function getObjects()
{
@@ -105,11 +107,11 @@ abstract class CommandForm extends Form
/**
* Get the commands to issue for the given objects
*
- * @param Traversable<Model> $objects
+ * @param Iterator<Model> $objects
*
* @return Traversable<IcingaCommand>
*/
- abstract protected function getCommands(Traversable $objects): Traversable;
+ abstract protected function getCommands(Iterator $objects): Traversable;
protected function assemble()
{
@@ -123,10 +125,15 @@ abstract class CommandForm extends Form
protected function onSuccess()
{
- $errors = [];
$objects = $this->getObjects();
+ if (is_array($objects)) {
+ $objects = new ArrayIterator($objects);
+ } else {
+ $objects = new IteratorIterator($objects);
+ }
- foreach ($this->getCommands(is_array($objects) ? new ArrayIterator($objects) : $objects) as $command) {
+ $errors = [];
+ foreach ($this->getCommands($objects) as $command) {
try {
$this->sendCommand($command);
} catch (Exception $e) {
@@ -159,21 +166,4 @@ abstract class CommandForm extends Form
{
(new CommandTransport())->send($command);
}
-
- /**
- * Yield the $objects the currently logged in user has the permission $permission for
- *
- * @param string $permission
- * @param Traversable $objects
- *
- * @return Generator
- */
- protected function filterGrantedOn(string $permission, Traversable $objects): Generator
- {
- foreach ($objects as $object) {
- if ($this->isGrantedOn($permission, $object)) {
- yield $object;
- }
- }
- }
}
diff --git a/application/forms/Command/Instance/ToggleInstanceFeaturesForm.php b/application/forms/Command/Instance/ToggleInstanceFeaturesForm.php
index cf14db8..86c0bd1 100644
--- a/application/forms/Command/Instance/ToggleInstanceFeaturesForm.php
+++ b/application/forms/Command/Instance/ToggleInstanceFeaturesForm.php
@@ -8,6 +8,7 @@ use Icinga\Module\Icingadb\Command\Instance\ToggleInstanceFeatureCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Web\Notification;
use ipl\Web\FormDecorator\IcingaFormDecorator;
+use Iterator;
use Traversable;
class ToggleInstanceFeaturesForm extends CommandForm
@@ -133,7 +134,7 @@ class ToggleInstanceFeaturesForm extends CommandForm
{
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
foreach ($this->features as $feature => $spec) {
$featureState = $this->getElement($feature)->isChecked();
diff --git a/application/forms/Command/Object/AcknowledgeProblemForm.php b/application/forms/Command/Object/AcknowledgeProblemForm.php
index 81b93e2..f5e7923 100644
--- a/application/forms/Command/Object/AcknowledgeProblemForm.php
+++ b/application/forms/Command/Object/AcknowledgeProblemForm.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
use Icinga\Application\Config;
@@ -14,9 +15,11 @@ use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
+use ipl\Orm\Model;
use ipl\Validator\CallbackValidator;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
use function ipl\Stdlib\iterable_value_first;
@@ -186,10 +189,13 @@ class AcknowledgeProblemForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/acknowledge-problem', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/acknowledge-problem', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new AcknowledgeProblemCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/AddCommentForm.php b/application/forms/Command/Object/AddCommentForm.php
index 9cd0754..e991e84 100644
--- a/application/forms/Command/Object/AddCommentForm.php
+++ b/application/forms/Command/Object/AddCommentForm.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
use Icinga\Application\Config;
@@ -14,9 +15,11 @@ use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
+use ipl\Orm\Model;
use ipl\Validator\CallbackValidator;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
use function ipl\Stdlib\iterable_value_first;
@@ -141,10 +144,13 @@ class AddCommentForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/comment/add', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/comment/add', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new AddCommentCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/CheckNowForm.php b/application/forms/Command/Object/CheckNowForm.php
index b7a506c..eb1e03b 100644
--- a/application/forms/Command/Object/CheckNowForm.php
+++ b/application/forms/Command/Object/CheckNowForm.php
@@ -4,11 +4,13 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
-use Generator;
+use CallbackFilterIterator;
use Icinga\Module\Icingadb\Command\Object\ScheduleCheckCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Web\Notification;
+use ipl\Orm\Model;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
class CheckNowForm extends CommandForm
@@ -44,22 +46,17 @@ class CheckNowForm extends CommandForm
);
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = (function () use ($objects): Generator {
- foreach ($objects as $object) {
- if (
- $this->isGrantedOn('icingadb/command/schedule-check', $object)
- || (
- $object->active_checks_enabled
- && $this->isGrantedOn('icingadb/command/schedule-check/active-only', $object)
- )
- ) {
- yield $object;
- }
- }
- })();
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/schedule-check', $object)
+ || (
+ $object->active_checks_enabled
+ && $this->isGrantedOn('icingadb/command/schedule-check/active-only', $object)
+ );
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new ScheduleCheckCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/DeleteCommentForm.php b/application/forms/Command/Object/DeleteCommentForm.php
index 25275ba..a35fc2e 100644
--- a/application/forms/Command/Object/DeleteCommentForm.php
+++ b/application/forms/Command/Object/DeleteCommentForm.php
@@ -4,12 +4,14 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
-use Generator;
+use CallbackFilterIterator;
use Icinga\Module\Icingadb\Command\Object\DeleteCommentCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Web\Notification;
+use ipl\Orm\Model;
use ipl\Web\Common\RedirectOption;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
class DeleteCommentForm extends CommandForm
@@ -54,16 +56,13 @@ class DeleteCommentForm extends CommandForm
);
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = (function () use ($objects): Generator {
- foreach ($objects as $object) {
- if ($this->isGrantedOn('icingadb/command/comment/delete', $object->{$object->object_type})) {
- yield $object;
- }
- }
- })();
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/comment/delete', $object->{$object->object_type});
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new DeleteCommentCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/DeleteDowntimeForm.php b/application/forms/Command/Object/DeleteDowntimeForm.php
index 5f695b9..b13bcc5 100644
--- a/application/forms/Command/Object/DeleteDowntimeForm.php
+++ b/application/forms/Command/Object/DeleteDowntimeForm.php
@@ -4,12 +4,14 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
-use Generator;
+use CallbackFilterIterator;
use Icinga\Module\Icingadb\Command\Object\DeleteDowntimeCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Web\Notification;
+use ipl\Orm\Model;
use ipl\Web\Common\RedirectOption;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
class DeleteDowntimeForm extends CommandForm
@@ -66,19 +68,14 @@ class DeleteDowntimeForm extends CommandForm
);
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = (function () use ($objects): Generator {
- foreach ($objects as $object) {
- if (
- $this->isGrantedOn('icingadb/command/downtime/delete', $object->{$object->object_type})
- && $object->scheduled_by === null
- ) {
- yield $object;
- }
- }
- })();
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $object->scheduled_by === null
+ && $this->isGrantedOn('icingadb/command/downtime/delete', $object->{$object->object_type});
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new DeleteDowntimeCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/ProcessCheckResultForm.php b/application/forms/Command/Object/ProcessCheckResultForm.php
index 5764bf8..7c612bf 100644
--- a/application/forms/Command/Object/ProcessCheckResultForm.php
+++ b/application/forms/Command/Object/ProcessCheckResultForm.php
@@ -4,7 +4,7 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
-use Generator;
+use CallbackFilterIterator;
use Icinga\Module\Icingadb\Command\Object\ProcessCheckResultCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Module\Icingadb\Model\Host;
@@ -15,6 +15,7 @@ use ipl\Html\Text;
use ipl\Orm\Model;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
use function ipl\Stdlib\iterable_value_first;
@@ -133,16 +134,14 @@ class ProcessCheckResultForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = (function () use ($objects): Generator {
- foreach ($this->filterGrantedOn('icingadb/command/process-check-result', $objects) as $object) {
- if ($object->passive_checks_enabled) {
- yield $object;
- }
- }
- })();
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $object->passive_checks_enabled
+ && $this->isGrantedOn('icingadb/command/process-check-result', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new ProcessCheckResultCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/RemoveAcknowledgementForm.php b/application/forms/Command/Object/RemoveAcknowledgementForm.php
index 8697985..d81fe7f 100644
--- a/application/forms/Command/Object/RemoveAcknowledgementForm.php
+++ b/application/forms/Command/Object/RemoveAcknowledgementForm.php
@@ -4,11 +4,14 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use Icinga\Module\Icingadb\Command\Object\RemoveAcknowledgementCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Web\Notification;
+use ipl\Orm\Model;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
use function ipl\Stdlib\iterable_value_first;
@@ -62,10 +65,13 @@ class RemoveAcknowledgementForm extends CommandForm
);
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/remove-acknowledgement', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/remove-acknowledgement', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new RemoveAcknowledgementCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/ScheduleCheckForm.php b/application/forms/Command/Object/ScheduleCheckForm.php
index 9b32ea1..bdeba53 100644
--- a/application/forms/Command/Object/ScheduleCheckForm.php
+++ b/application/forms/Command/Object/ScheduleCheckForm.php
@@ -4,9 +4,9 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
-use Generator;
use Icinga\Module\Icingadb\Command\Object\ScheduleCheckCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Module\Icingadb\Model\Host;
@@ -14,8 +14,10 @@ use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
+use ipl\Orm\Model;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
use function ipl\Stdlib\iterable_value_first;
@@ -109,22 +111,17 @@ class ScheduleCheckForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = (function () use ($objects): Generator {
- foreach ($objects as $object) {
- if (
- $this->isGrantedOn('icingadb/command/schedule-check', $object)
- || (
- $object->active_checks_enabled
- && $this->isGrantedOn('icingadb/command/schedule-check/active-only', $object)
- )
- ) {
- yield $object;
- }
- }
- })();
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/schedule-check', $object)
+ || (
+ $object->active_checks_enabled
+ && $this->isGrantedOn('icingadb/command/schedule-check/active-only', $object)
+ );
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new ScheduleCheckCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/ScheduleHostDowntimeForm.php b/application/forms/Command/Object/ScheduleHostDowntimeForm.php
index bc21114..a09b00d 100644
--- a/application/forms/Command/Object/ScheduleHostDowntimeForm.php
+++ b/application/forms/Command/Object/ScheduleHostDowntimeForm.php
@@ -4,13 +4,16 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
use Icinga\Application\Config;
use Icinga\Module\Icingadb\Command\Object\PropagateHostDowntimeCommand;
use Icinga\Module\Icingadb\Command\Object\ScheduleHostDowntimeCommand;
use Icinga\Web\Notification;
+use ipl\Orm\Model;
use ipl\Web\FormDecorator\IcingaFormDecorator;
+use Iterator;
use Traversable;
class ScheduleHostDowntimeForm extends ScheduleServiceDowntimeForm
@@ -87,10 +90,13 @@ class ScheduleHostDowntimeForm extends ScheduleServiceDowntimeForm
$decorator->decorate($this->getElement('child_options'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/downtime/schedule', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/downtime/schedule', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
if (($childOptions = (int) $this->getValue('child_options'))) {
$command = new PropagateHostDowntimeCommand();
diff --git a/application/forms/Command/Object/ScheduleServiceDowntimeForm.php b/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
index 184a4e8..b237408 100644
--- a/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
+++ b/application/forms/Command/Object/ScheduleServiceDowntimeForm.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use DateInterval;
use DateTime;
use Icinga\Application\Config;
@@ -13,9 +14,11 @@ use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
+use ipl\Orm\Model;
use ipl\Validator\CallbackValidator;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
class ScheduleServiceDowntimeForm extends CommandForm
@@ -242,10 +245,13 @@ class ScheduleServiceDowntimeForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/downtime/schedule', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/downtime/schedule', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new ScheduleServiceDowntimeCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/SendCustomNotificationForm.php b/application/forms/Command/Object/SendCustomNotificationForm.php
index dfb1e96..4b0539e 100644
--- a/application/forms/Command/Object/SendCustomNotificationForm.php
+++ b/application/forms/Command/Object/SendCustomNotificationForm.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use Icinga\Application\Config;
use Icinga\Module\Icingadb\Command\Object\SendCustomNotificationCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
@@ -12,8 +13,10 @@ use Icinga\Web\Notification;
use ipl\Html\Attributes;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
+use ipl\Orm\Model;
use ipl\Web\FormDecorator\IcingaFormDecorator;
use ipl\Web\Widget\Icon;
+use Iterator;
use Traversable;
use function ipl\Stdlib\iterable_value_first;
@@ -108,10 +111,13 @@ class SendCustomNotificationForm extends CommandForm
(new IcingaFormDecorator())->decorate($this->getElement('btn_submit'));
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
- $granted = $this->filterGrantedOn('icingadb/command/send-custom-notification', $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object): bool {
+ return $this->isGrantedOn('icingadb/command/send-custom-notification', $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new SendCustomNotificationCommand();
$command->setObjects($granted);
diff --git a/application/forms/Command/Object/ToggleObjectFeaturesForm.php b/application/forms/Command/Object/ToggleObjectFeaturesForm.php
index 50767da..63530f6 100644
--- a/application/forms/Command/Object/ToggleObjectFeaturesForm.php
+++ b/application/forms/Command/Object/ToggleObjectFeaturesForm.php
@@ -4,12 +4,14 @@
namespace Icinga\Module\Icingadb\Forms\Command\Object;
+use CallbackFilterIterator;
use Icinga\Module\Icingadb\Command\Object\ToggleObjectFeatureCommand;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Web\Notification;
use ipl\Html\FormElement\CheckboxElement;
use ipl\Orm\Model;
use ipl\Web\FormDecorator\IcingaFormDecorator;
+use Iterator;
use Traversable;
class ToggleObjectFeaturesForm extends CommandForm
@@ -156,7 +158,7 @@ class ToggleObjectFeaturesForm extends CommandForm
{
}
- protected function getCommands(Traversable $objects): Traversable
+ protected function getCommands(Iterator $objects): Traversable
{
foreach ($this->features as $feature => $spec) {
if ($this->getElement($feature) instanceof CheckboxElement) {
@@ -169,8 +171,11 @@ class ToggleObjectFeaturesForm extends CommandForm
continue;
}
- $granted = $this->filterGrantedOn($spec['permission'], $objects);
+ $granted = new CallbackFilterIterator($objects, function (Model $object) use ($spec): bool {
+ return $this->isGrantedOn($spec['permission'], $object);
+ });
+ $granted->rewind(); // Forwards the pointer to the first element
if ($granted->valid()) {
$command = new ToggleObjectFeatureCommand();
$command->setObjects($granted);
diff --git a/configuration.php b/configuration.php
index d00737c..16a25f4 100644
--- a/configuration.php
+++ b/configuration.php
@@ -136,6 +136,14 @@ namespace Icinga\Module\Icingadb {
);
if (! $this::exists('monitoring') || ($authenticated && ! $auth->getUser()->can('module/monitoring'))) {
+ $routeDenylist = [];
+ if ($authenticated && ! $auth->getUser()->isUnrestricted()) {
+ // The empty array is for PHP pre 7.4, older versions require at least a single param for array_merge
+ $routeDenylist = array_flip(array_merge([], ...array_map(function ($restriction) {
+ return StringHelper::trimSplit($restriction);
+ }, $auth->getRestrictions('icingadb/denylist/routes'))));
+ }
+
/*
* Available navigation items
*/
@@ -165,16 +173,22 @@ namespace Icinga\Module\Icingadb {
'icingadb/services?sort=service.state.severity&limit=10',
97
);
- $this->provideSearchUrl(
- $this->translate('Hostgroups'),
- 'icingadb/hostgroups?limit=10',
- 96
- );
- $this->provideSearchUrl(
- $this->translate('Servicegroups'),
- 'icingadb/servicegroups?limit=10',
- 95
- );
+
+ if (! array_key_exists('hostgroups', $routeDenylist)) {
+ $this->provideSearchUrl(
+ $this->translate('Hostgroups'),
+ 'icingadb/hostgroups?limit=10',
+ 96
+ );
+ }
+
+ if (! array_key_exists('servicegroups', $routeDenylist)) {
+ $this->provideSearchUrl(
+ $this->translate('Servicegroups'),
+ 'icingadb/servicegroups?limit=10',
+ 95
+ );
+ }
/**
* Current Incidents
@@ -340,13 +354,6 @@ namespace Icinga\Module\Icingadb {
'url' => 'icingadb/services',
'icon' => 'cog'
]);
- $routeDenylist = [];
- if ($authenticated && ! $auth->getUser()->isUnrestricted()) {
- // The empty array is for PHP pre 7.4, older versions require at least a single param for array_merge
- $routeDenylist = array_flip(array_merge([], ...array_map(function ($restriction) {
- return StringHelper::trimSplit($restriction);
- }, $auth->getRestrictions('icingadb/denylist/routes'))));
- }
if (! array_key_exists('hostgroups', $routeDenylist)) {
$overviewSection->add(N_('Host Groups'), [
diff --git a/doc/01-About.md b/doc/01-About.md
index a13333e..9197da3 100644
--- a/doc/01-About.md
+++ b/doc/01-About.md
@@ -3,12 +3,13 @@
Icinga DB is a set of components for publishing, synchronizing and
visualizing monitoring data in the Icinga ecosystem, consisting of:
-* Icinga DB Web which connects to both a Redis server and a database to view and work with monitoring data
+* Icinga DB Web which connects to both a Redis®[\*](TRADEMARKS.md#redis) server and
+ a database to view and work with monitoring data
* Icinga 2 with its [Icinga DB feature](https://icinga.com/docs/icinga-2/latest/14-features/#icinga-db) enabled,
responsible for publishing monitoring configuration, check results,
- states changes and history items to the Redis server
+ states changes and history items to the Redis® server
* And the [Icinga DB daemon](https://icinga.com/docs/icinga-db/latest/01-About/),
- which synchronizes monitoring data between the Redis server and the database
+ which synchronizes monitoring data between the Redis® server and the database
![Icinga DB Architecture](res/icingadb-architecture.png)
diff --git a/doc/02-Installation.md.d/From-Source.md b/doc/02-Installation.md.d/From-Source.md
index b430d16..f6e4c12 100644
--- a/doc/02-Installation.md.d/From-Source.md
+++ b/doc/02-Installation.md.d/From-Source.md
@@ -11,7 +11,7 @@ Make sure you use `icingadb` as the module name. The following requirements must
* The following PHP modules must be installed: `cURL`, `dom`, `json`, `libxml`
* [Icinga DB](https://github.com/Icinga/icingadb)
* [Icinga Web 2](https://github.com/Icinga/icingaweb2) (≥2.9)
-* [Icinga PHP Library (ipl)](https://github.com/Icinga/icinga-php-library) (≥0.13)
+* [Icinga PHP Library (ipl)](https://github.com/Icinga/icinga-php-library) (≥0.13.2)
* [Icinga PHP Thirdparty](https://github.com/Icinga/icinga-php-thirdparty) (≥0.12)
<!-- {% include "02-Installation.md" %} -->
diff --git a/doc/03-Configuration.md b/doc/03-Configuration.md
index ce24277..c79ce66 100644
--- a/doc/03-Configuration.md
+++ b/doc/03-Configuration.md
@@ -15,17 +15,17 @@ Connection configuration for the database to which Icinga DB synchronizes monito
2. Configure the resource you just created as the database connection for the Icinga DB Web module using the
`Configuration → Modules → icingadb → Database` menu.
-## Redis Configuration
+## Redis® Configuration
-Connection configuration for the Redis server where Icinga 2 writes check results.
+Connection configuration for the Redis® server where Icinga 2 writes check results.
This data is used to display the latest state information in Icinga DB Web.
-1. Configure the connection to the Redis server through the `Configuration → Modules → icingadb → Redis` menu.
+1. Configure the connection to the Redis® server through the `Configuration → Modules → icingadb → Redis` menu.
!!! info
If you are running a high-availability Icinga 2 setup,
- also configure the secondary master's Redis connection details.
+ also configure the secondary master's Redis® connection details.
Icinga DB Web then uses this connection if the primary one is not available.
## Command Transport Configuration
@@ -61,6 +61,45 @@ For this you need an `ApiUser` object with at least the following permissions on
also configure the secondary master's API command transport.
Icinga DB Web then uses this transport if the primary one is not available.
+## General Configuration
+
+You can adjust some default values of options users have while interacting with particular dialogs in the UI. (e.g. While acknowledging a problem)
+These options can not be adjusted in the UI directly, but have to be set in the
+configuration file `/etc/icingaweb2/modules/icingadb/config.ini`.
+
+### Available Settings and defaults
+
+Option | Description | Default
+----------------------------------|-----------------------------------|------------
+acknowledge_expire | Sets "Use Expire Time" in Acknowledgement dialog. | **0 (false)**
+acknowledge_expire_time | Sets the value for "Expire Time" in Acknowledgement dialog, its calculated as now + this setting. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **1 hour (PT1H)**.
+acknowledge_notify | Sets "Send Notification" in Acknowledgement dialog. | **1 (true)**
+acknowledge_persistent | Sets "Persistent Comment" in Acknowledgement dialog. | **0 (false)**
+acknowledge_sticky | Sets "Sticky Acknowledgement" in Acknowledgement dialog. | **0 (false)**
+comment_expire | Sets "Use Expire Time" in Comment dialog. | **0 (false)**
+hostdowntime_comment_text | Sets default text for "Comment" in Host Downtime dialog | ""
+servicedowntime_comment_text | Sets default text for "Comment" in Service Downtime dialog. | ""
+comment_expire_time | Sets default value for "Expire Time" in Comment dialog, its calculated as now + this setting. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **1 hour (PT1H)**
+custom_notification_forced | Sets "Forced" in Custom Notification dialog. | **0 (false)**
+hostdowntime_all_services | Sets "All Services" in Schedule Host Downtime dialog. | **0 (false)**
+hostdowntime_end_fixed | Sets default value for "End Time" in Schedule Host Downtime dialog for **Fixed** downtime, its calculated as now + this setting. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **1 hour (PT1H)**.
+hostdowntime_end_flexible | Sets default value for "End Time" in Schedule Host Downtime dialog for **Flexible** downtime, its calculated as now + this setting. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **2 hours (PT2H)**.
+hostdowntime_flexible_duration | Sets default value for "Flexible Duration" in Schedule Host Downtime dialog for **Flexible** downtime. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **2 hour (PT2H)**.
+servicedowntime_end_fixed | Sets default value for "End Time" in Schedule Service Downtime dialog for **Fixed** downtime, its calculated as now + this setting. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **1 hour (PT1H)**.
+servicedowntime_end_flexible | Set default value for "End Time" in Schedule Service Downtime dialog for **Flexible** downtime, its calculated as now + this setting. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **1 hour (PT1H)**.
+servicedowntime_flexible_duration | Set default value for "Flexible Duration" in Schedule Service Downtime dialog for **Flexible** downtime. Format is a [PHP Dateinterval](http://www.php.net/manual/en/dateinterval.construct.php). | **2 hour (PT2H)**.
+
+
+### Example
+
+Setting acknowledgements with 2 hours expire time by default.
+
+```
+[settings]
+acknowledge_expire = 1
+acknowledge_expire_time = PT2H
+```
+
## Security
To grant users permissions to run commands and restrict them to specific views,
diff --git a/doc/10-Migration.md b/doc/10-Migration.md
index a8ed80f..43fa1db 100644
--- a/doc/10-Migration.md
+++ b/doc/10-Migration.md
@@ -8,6 +8,18 @@ If that is the case, this chapter has you covered.
## Configuration
+### General configuration via config.ini
+
+Icinga DB Web still uses the same configuration format as the monitoring module. This means that the file
+`/etc/icingaweb2/modules/monitoring/config.ini` can simply be copied over to
+`/etc/icingaweb2/modules/icingadb/config.ini`:
+
+```
+cp /etc/icingaweb2/modules/monitoring/config.ini /etc/icingaweb2/modules/icingadb/config.ini
+```
+
+The behaviour of those options remains the same.
+
### Command Transports
Icinga DB Web still uses the same configuration format for command transports. This means that the file
@@ -158,3 +170,4 @@ general access to the monitoring module, this is not automatically migrated. You
It gives you the chance to review the performed changes, before letting them loose on your users. Please also
take in mind, that Icinga DB Web handles permissions and restrictions differently. Our blog provides details
on that: https://icinga.com/blog/2021/04/07/web-access-control-redefined/#icingadb-permission-linkage
+
diff --git a/doc/TRADEMARKS.md b/doc/TRADEMARKS.md
new file mode 100644
index 0000000..952751d
--- /dev/null
+++ b/doc/TRADEMARKS.md
@@ -0,0 +1,13 @@
+# Third-party Trademarks
+
+All trademarks, logos, and brand names are the property of their respective owners.
+Any mention of company, product, or service names in our documentations, product descriptions,
+or websites is solely for identification purposes. The use of these names, trademarks,
+and brands does not imply endorsement. This document acknowledges trademarks of companies and products,
+which are the property of their respective owners, whether registered or unregistered.
+
+## Redis®
+
+Redis is a registered trademark of Redis Ltd. Any rights therein are reserved to Redis Ltd.
+Any use by Icinga GmbH is for referential purposes only and does not indicate any sponsorship,
+endorsement or affiliation between Redis and Icinga GmbH.
diff --git a/doc/res/icingadb-architecture.png b/doc/res/icingadb-architecture.png
index 3d55ff7..c4af6eb 100644
--- a/doc/res/icingadb-architecture.png
+++ b/doc/res/icingadb-architecture.png
Binary files differ
diff --git a/doc/res/icingadb-web.png b/doc/res/icingadb-web.png
index 05a3e31..2d98334 100644
--- a/doc/res/icingadb-web.png
+++ b/doc/res/icingadb-web.png
Binary files differ
diff --git a/library/Icingadb/Command/Object/ObjectsCommand.php b/library/Icingadb/Command/Object/ObjectsCommand.php
index 3de6c83..f1a50d7 100644
--- a/library/Icingadb/Command/Object/ObjectsCommand.php
+++ b/library/Icingadb/Command/Object/ObjectsCommand.php
@@ -5,8 +5,11 @@
namespace Icinga\Module\Icingadb\Command\Object;
use ArrayIterator;
+use Generator;
use Icinga\Module\Icingadb\Command\IcingaCommand;
+use InvalidArgumentException;
use ipl\Orm\Model;
+use LogicException;
use Traversable;
/**
@@ -24,12 +27,18 @@ abstract class ObjectsCommand extends IcingaCommand
/**
* Set the involved objects
*
- * @param Traversable<Model> $objects
+ * @param Traversable<Model> $objects Except generators
*
* @return $this
+ *
+ * @throws InvalidArgumentException If a generator is passed
*/
public function setObjects(Traversable $objects): self
{
+ if ($objects instanceof Generator) {
+ throw new InvalidArgumentException('Generators are not supported');
+ }
+
$this->objects = $objects;
return $this;
@@ -57,7 +66,7 @@ abstract class ObjectsCommand extends IcingaCommand
public function getObjects(): Traversable
{
if ($this->objects === null) {
- throw new \LogicException(
+ throw new LogicException(
'You are accessing an unset property. Please make sure to set it beforehand.'
);
}
diff --git a/library/Icingadb/Command/Transport/CommandTransport.php b/library/Icingadb/Command/Transport/CommandTransport.php
index ea125bc..952cb14 100644
--- a/library/Icingadb/Command/Transport/CommandTransport.php
+++ b/library/Icingadb/Command/Transport/CommandTransport.php
@@ -50,7 +50,7 @@ class CommandTransport implements CommandTransportInterface
/**
* Create a transport from config
*
- * @param ConfigObject $config
+ * @param ConfigObject<string> $config
*
* @return ApiCommandTransport
*
@@ -59,7 +59,7 @@ class CommandTransport implements CommandTransportInterface
public static function createTransport(ConfigObject $config): ApiCommandTransport
{
$config = clone $config;
- switch (strtolower($config->transport)) {
+ switch (strtolower($config->transport ?? '')) {
case ApiCommandTransport::TRANSPORT:
$transport = new ApiCommandTransport();
break;
diff --git a/library/Icingadb/Common/CommandActions.php b/library/Icingadb/Common/CommandActions.php
index 2cd13fe..af7d194 100644
--- a/library/Icingadb/Common/CommandActions.php
+++ b/library/Icingadb/Common/CommandActions.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Common;
+use Icinga\Exception\Http\HttpNotFoundException;
use Icinga\Module\Icingadb\Forms\Command\CommandForm;
use Icinga\Module\Icingadb\Forms\Command\Object\AcknowledgeProblemForm;
use Icinga\Module\Icingadb\Forms\Command\Object\AddCommentForm;
@@ -26,7 +27,7 @@ use ipl\Web\Url;
*/
trait CommandActions
{
- /** @var Query $commandTargets */
+ /** @var null|Query|array<Model> $commandTargets */
protected $commandTargets;
/** @var Model $commandTargetModel */
@@ -51,14 +52,14 @@ trait CommandActions
/**
* Fetch command targets
*
- * @return Query|Model[]
+ * @return Query|array<Model>
*/
abstract protected function fetchCommandTargets();
/**
* Get command targets
*
- * @return Query|Model[]
+ * @return Query|array<Model>
*/
protected function getCommandTargets()
{
@@ -73,14 +74,19 @@ trait CommandActions
* Get the model of the command targets
*
* @return Model
+ * @throws HttpNotFoundException If no command targets were found
*/
protected function getCommandTargetModel(): Model
{
if (! isset($this->commandTargetModel)) {
$commandTargets = $this->getCommandTargets();
- if (is_array($commandTargets) && !empty($commandTargets)) {
+ if (empty($commandTargets) || count($commandTargets) === 0) {
+ throw new HttpNotFoundException('No command targets found');
+ }
+
+ if (is_array($commandTargets)) {
$this->commandTargetModel = $commandTargets[0];
- } else {
+ } elseif ($commandTargets->count() > 0) {
$this->commandTargetModel = $commandTargets->getModel();
}
}
@@ -139,7 +145,8 @@ trait CommandActions
protected function handleCommandForm($form)
{
$isXhr = $this->getRequest()->isXmlHttpRequest();
- if ($isXhr && $this->getRequest()->isApiRequest()) {
+ $isApi = $this->getRequest()->isApiRequest();
+ if ($isXhr && $isApi) {
// Prevents the framework already, this is just a fail-safe
$this->httpBadRequest('Responding with JSON during a Web request is not supported');
}
@@ -151,7 +158,7 @@ trait CommandActions
$form->setObjects($this->getCommandTargets());
- if ($isXhr) {
+ if (! $isApi || $isXhr) {
$this->handleWebRequest($form);
} else {
$this->handleApiRequest($form);
diff --git a/library/Icingadb/Common/Macros.php b/library/Icingadb/Common/Macros.php
index 4842c27..c7f0e15 100644
--- a/library/Icingadb/Common/Macros.php
+++ b/library/Icingadb/Common/Macros.php
@@ -8,7 +8,7 @@ use Icinga\Application\Logger;
use Icinga\Module\Icingadb\Compat\CompatHost;
use Icinga\Module\Icingadb\Compat\CompatService;
use Icinga\Module\Icingadb\Model\Host;
-use ipl\Orm\Model;
+use Icinga\Module\Icingadb\Model\Service;
use ipl\Orm\Query;
use ipl\Orm\ResultSet;
@@ -20,7 +20,7 @@ trait Macros
* Get the given string with macros being resolved
*
* @param string $input The string in which to look for macros
- * @param Model|CompatService|CompatHost $object The host or service used to resolve the macros
+ * @param Host|Service|CompatService|CompatHost $object The host or service used to resolve the macros
*
* @return string
*/
@@ -42,7 +42,7 @@ trait Macros
* Resolve a macro based on the given object
*
* @param string $macro The macro to resolve
- * @param Model|CompatService|CompatHost $object The host or service used to resolve the macros
+ * @param Host|Service|CompatService|CompatHost $object The host or service used to resolve the macros
*
* @return string
*/
@@ -102,8 +102,13 @@ trait Macros
$value = $object->$macro;
}
} catch (\Exception $e) {
+ $objectName = $object->name;
+ if ($objectType === 'service' && isset($object->host)) {
+ $objectName = $object->host->name . '!' . $objectName;
+ }
+
$value = null;
- Logger::debug('Unable to resolve macro "%s". An error occurred: %s', $macro, $e);
+ Logger::debug('Unable to resolve macro "%s" on object "%s". An error occured: %s', $macro, $objectName, $e);
}
if ($value instanceof Query || $value instanceof ResultSet || is_array($value)) {
diff --git a/library/Icingadb/Compat/CompatObject.php b/library/Icingadb/Compat/CompatObject.php
index 6a30751..1d9657d 100644
--- a/library/Icingadb/Compat/CompatObject.php
+++ b/library/Icingadb/Compat/CompatObject.php
@@ -361,13 +361,14 @@ trait CompatObject
*/
private function getBoolType($value)
{
- switch ($value) {
- case false:
- return 0;
- case true:
- return 1;
- case 'sticky':
- return 2;
+ if ($value === 'sticky') {
+ return 2;
}
+
+ if (is_string($value)) {
+ return null;
+ }
+
+ return (int) $value;
}
}
diff --git a/library/Icingadb/Compat/UrlMigrator.php b/library/Icingadb/Compat/UrlMigrator.php
index 47780be..f6a4a4a 100644
--- a/library/Icingadb/Compat/UrlMigrator.php
+++ b/library/Icingadb/Compat/UrlMigrator.php
@@ -234,9 +234,14 @@ class UrlMigrator
case $exprRule === self::LOWER_EXPR:
$filter->setValue(strtolower($filter->getValue()));
break;
- case is_array($exprRule) && isset($exprRule[$filter->getValue()]):
- $filter->setValue($exprRule[$filter->getValue()]);
- break;
+ case is_array($exprRule):
+ if (isset($exprRule[$filter->getValue()])) {
+ $filter->setValue($exprRule[$filter->getValue()]);
+
+ break;
+ }
+
+ return false;
default:
$filter->setValue($exprRule);
}
@@ -290,6 +295,8 @@ class UrlMigrator
},
'dir' => self::DROP,
'limit' => self::USE_EXPR,
+ 'addFilter' => self::DROP,
+ 'modifyFilter' => self::DROP,
'showCompact' => self::USE_EXPR,
'showFullscreen' => self::USE_EXPR,
'view' => function ($value) {
diff --git a/library/Icingadb/Data/CsvResultSet.php b/library/Icingadb/Data/CsvResultSet.php
index 746a7e4..d65364e 100644
--- a/library/Icingadb/Data/CsvResultSet.php
+++ b/library/Icingadb/Data/CsvResultSet.php
@@ -4,82 +4,9 @@
namespace Icinga\Module\Icingadb\Data;
-use DateTime;
-use DateTimeZone;
-use Icinga\Module\Icingadb\Redis\VolatileStateResults;
-use ipl\Orm\Model;
-use ipl\Orm\Query;
+use ipl\Orm\ResultSet;
-class CsvResultSet extends VolatileStateResults
+class CsvResultSet extends ResultSet
{
- protected $isCacheDisabled = true;
-
- /**
- * @return array<string, ?string>
- */
- public function current(): array
- {
- return $this->extractKeysAndValues(parent::current());
- }
-
- protected function formatValue(string $key, $value): ?string
- {
- if (
- $value
- && (
- $key === 'id'
- || substr($key, -3) === '_id'
- || substr($key, -3) === '.id'
- || substr($key, -9) === '_checksum'
- || substr($key, -4) === '_bin'
- )
- ) {
- $value = bin2hex($value);
- }
-
- if (is_bool($value)) {
- return $value ? 'true' : 'false';
- } elseif (is_string($value)) {
- return '"' . str_replace('"', '""', $value) . '"';
- } elseif (is_array($value)) {
- return '"' . implode(',', $value) . '"';
- } elseif ($value instanceof DateTime) {
- return $value->setTimezone(new DateTimeZone('UTC'))
- ->format('Y-m-d\TH:i:s.vP');
- } else {
- return $value;
- }
- }
-
- protected function extractKeysAndValues(Model $model, string $path = ''): array
- {
- $keysAndValues = [];
- foreach ($model as $key => $value) {
- $keyPath = ($path ? $path . '.' : '') . $key;
- if ($value instanceof Model) {
- $keysAndValues += $this->extractKeysAndValues($value, $keyPath);
- } else {
- $keysAndValues[$keyPath] = $this->formatValue($key, $value);
- }
- }
-
- return $keysAndValues;
- }
-
- public static function stream(Query $query): void
- {
- $query->setResultSetClass(__CLASS__);
-
- foreach ($query as $i => $keysAndValues) {
- if ($i === 0) {
- echo implode(',', array_keys($keysAndValues));
- }
-
- echo "\r\n";
-
- echo implode(',', array_values($keysAndValues));
- }
-
- exit;
- }
+ use CsvResultSetUtils;
}
diff --git a/library/Icingadb/Data/CsvResultSetUtils.php b/library/Icingadb/Data/CsvResultSetUtils.php
new file mode 100644
index 0000000..61995d3
--- /dev/null
+++ b/library/Icingadb/Data/CsvResultSetUtils.php
@@ -0,0 +1,106 @@
+<?php
+
+/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */
+
+namespace Icinga\Module\Icingadb\Data;
+
+use DateTime;
+use DateTimeZone;
+use Icinga\Module\Icingadb\Model\Host;
+use Icinga\Module\Icingadb\Model\Service;
+use ipl\Orm\Model;
+use ipl\Orm\Query;
+
+trait CsvResultSetUtils
+{
+ /**
+ * @return array<string, ?string>
+ */
+ public function current(): array
+ {
+ return $this->extractKeysAndValues(parent::current());
+ }
+
+ protected function formatValue(string $key, $value): ?string
+ {
+ if (
+ $value
+ && (
+ $key === 'id'
+ || substr($key, -3) === '_id'
+ || substr($key, -3) === '.id'
+ || substr($key, -9) === '_checksum'
+ || substr($key, -4) === '_bin'
+ )
+ ) {
+ $value = bin2hex($value);
+ }
+
+ if (is_bool($value)) {
+ return $value ? 'true' : 'false';
+ } elseif (is_string($value)) {
+ return '"' . str_replace('"', '""', $value) . '"';
+ } elseif (is_array($value)) {
+ return '"' . implode(',', $value) . '"';
+ } elseif ($value instanceof DateTime) {
+ return $value->setTimezone(new DateTimeZone('UTC'))
+ ->format('Y-m-d\TH:i:s.vP');
+ } else {
+ return $value;
+ }
+ }
+
+ protected function extractKeysAndValues(Model $model, string $path = ''): array
+ {
+ $keysAndValues = [];
+ foreach ($model as $key => $value) {
+ $keyPath = ($path ? $path . '.' : '') . $key;
+ if ($value instanceof Model) {
+ $keysAndValues += $this->extractKeysAndValues($value, $keyPath);
+ } else {
+ $keysAndValues[$keyPath] = $this->formatValue($key, $value);
+ }
+ }
+
+ return $keysAndValues;
+ }
+
+ public static function stream(Query $query): void
+ {
+ if ($query->getModel() instanceof Host || $query->getModel() instanceof Service) {
+ $query->setResultSetClass(VolatileCsvResults::class);
+ } else {
+ $query->setResultSetClass(__CLASS__);
+ }
+
+ if ($query->hasLimit()) {
+ // Custom limits should still apply
+ $query->peekAhead(false);
+ $offset = $query->getOffset();
+ } else {
+ $query->limit(1000);
+ $query->peekAhead();
+ $offset = 0;
+ }
+
+ do {
+ $query->offset($offset);
+ $result = $query->execute()->disableCache();
+ foreach ($result as $i => $keysAndValues) {
+ if ($i === 0) {
+ echo implode(',', array_keys($keysAndValues));
+ }
+
+ echo "\r\n";
+
+ echo implode(',', array_values($keysAndValues));
+
+ JsonResultSet::giveMeMoreTime();
+ }
+
+ $offset += 1000;
+ } while ($result->hasMore());
+
+ exit;
+ }
+}
diff --git a/library/Icingadb/Data/JsonResultSet.php b/library/Icingadb/Data/JsonResultSet.php
index 73cd9ef..715437a 100644
--- a/library/Icingadb/Data/JsonResultSet.php
+++ b/library/Icingadb/Data/JsonResultSet.php
@@ -4,77 +4,9 @@
namespace Icinga\Module\Icingadb\Data;
-use DateTime;
-use DateTimeZone;
-use Icinga\Module\Icingadb\Redis\VolatileStateResults;
-use Icinga\Util\Json;
-use ipl\Orm\Model;
-use ipl\Orm\Query;
+use ipl\Orm\ResultSet;
-class JsonResultSet extends VolatileStateResults
+class JsonResultSet extends ResultSet
{
- protected $isCacheDisabled = true;
-
- /**
- * @return array<string, ?string>
- */
- public function current(): array
- {
- return $this->createObject(parent::current());
- }
-
- protected function formatValue(string $key, $value): ?string
- {
- if (
- $value
- && (
- $key === 'id'
- || substr($key, -3) === '_id'
- || substr($key, -3) === '.id'
- || substr($key, -9) === '_checksum'
- || substr($key, -4) === '_bin'
- )
- ) {
- $value = bin2hex($value);
- }
-
- if ($value instanceof DateTime) {
- return $value->setTimezone(new DateTimeZone('UTC'))
- ->format('Y-m-d\TH:i:s.vP');
- }
-
- return $value;
- }
-
- protected function createObject(Model $model): array
- {
- $keysAndValues = [];
- foreach ($model as $key => $value) {
- if ($value instanceof Model) {
- $keysAndValues[$key] = $this->createObject($value);
- } else {
- $keysAndValues[$key] = $this->formatValue($key, $value);
- }
- }
-
- return $keysAndValues;
- }
-
- public static function stream(Query $query): void
- {
- $query->setResultSetClass(__CLASS__);
-
- echo '[';
- foreach ($query as $i => $object) {
- if ($i > 0) {
- echo ",\n";
- }
-
- echo Json::sanitize($object);
- }
-
- echo ']';
-
- exit;
- }
+ use JsonResultSetUtils;
}
diff --git a/library/Icingadb/Data/JsonResultSetUtils.php b/library/Icingadb/Data/JsonResultSetUtils.php
new file mode 100644
index 0000000..422a5b2
--- /dev/null
+++ b/library/Icingadb/Data/JsonResultSetUtils.php
@@ -0,0 +1,132 @@
+<?php
+
+/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */
+
+namespace Icinga\Module\Icingadb\Data;
+
+use DateTime;
+use DateTimeZone;
+use Icinga\Module\Icingadb\Model\Host;
+use Icinga\Module\Icingadb\Model\Service;
+use Icinga\Util\Json;
+use ipl\Orm\Model;
+use ipl\Orm\Query;
+
+trait JsonResultSetUtils
+{
+ /**
+ * @return array<string, ?string>
+ */
+ public function current(): array
+ {
+ return $this->createObject(parent::current());
+ }
+
+ protected function formatValue(string $key, $value)
+ {
+ if (
+ $value
+ && (
+ $key === 'id'
+ || substr($key, -3) === '_id'
+ || substr($key, -3) === '.id'
+ || substr($key, -9) === '_checksum'
+ || substr($key, -4) === '_bin'
+ )
+ ) {
+ $value = bin2hex($value);
+ }
+
+ if ($value instanceof DateTime) {
+ return $value->setTimezone(new DateTimeZone('UTC'))
+ ->format('Y-m-d\TH:i:s.vP');
+ }
+
+ return $value;
+ }
+
+ protected function createObject(Model $model): array
+ {
+ $keysAndValues = [];
+ foreach ($model as $key => $value) {
+ if ($value instanceof Model) {
+ $keysAndValues[$key] = $this->createObject($value);
+ } else {
+ $keysAndValues[$key] = $this->formatValue($key, $value);
+ }
+ }
+
+ return $keysAndValues;
+ }
+
+ public static function stream(Query $query): void
+ {
+ if ($query->getModel() instanceof Host || $query->getModel() instanceof Service) {
+ $query->setResultSetClass(VolatileJsonResults::class);
+ } else {
+ $query->setResultSetClass(__CLASS__);
+ }
+
+ if ($query->hasLimit()) {
+ // Custom limits should still apply
+ $query->peekAhead(false);
+ $offset = $query->getOffset();
+ } else {
+ $query->limit(1000);
+ $query->peekAhead();
+ $offset = 0;
+ }
+
+ echo '[';
+
+ do {
+ $query->offset($offset);
+ $result = $query->execute()->disableCache();
+ foreach ($result as $i => $object) {
+ if ($i > 0 || $offset !== 0) {
+ echo ",\n";
+ }
+
+ echo Json::sanitize($object);
+
+ self::giveMeMoreTime();
+ }
+
+ $offset += 1000;
+ } while ($result->hasMore());
+
+ echo ']';
+
+ exit;
+ }
+
+ /**
+ * Grant the caller more time to work with
+ *
+ * This resets the execution time before it runs out. The advantage of this, compared with no execution time
+ * limit at all, is that only the caller can bypass the limit. Any other (faulty) code will still be stopped.
+ *
+ * @internal Don't use outside of {@see JsonResultSet::stream()} or {@see CsvResultSet::stream()}
+ *
+ * @return void
+ */
+ public static function giveMeMoreTime()
+ {
+ $spent = getrusage();
+ if ($spent !== false) {
+ $maxExecutionTime = ini_get('max_execution_time');
+ if (! $maxExecutionTime || ! is_numeric($maxExecutionTime)) {
+ $maxExecutionTime = 30;
+ } else {
+ $maxExecutionTime = (int) $maxExecutionTime;
+ }
+
+ if ($maxExecutionTime > 0) {
+ $timeRemaining = $maxExecutionTime - $spent['ru_utime.tv_sec'] % $maxExecutionTime;
+ if ($timeRemaining <= 5) {
+ set_time_limit($maxExecutionTime);
+ }
+ }
+ }
+ }
+}
diff --git a/library/Icingadb/Data/VolatileCsvResults.php b/library/Icingadb/Data/VolatileCsvResults.php
new file mode 100644
index 0000000..7d9f8ab
--- /dev/null
+++ b/library/Icingadb/Data/VolatileCsvResults.php
@@ -0,0 +1,15 @@
+<?php
+
+/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */
+
+namespace Icinga\Module\Icingadb\Data;
+
+use Icinga\Module\Icingadb\Redis\VolatileStateResults;
+
+/**
+ * @internal This class is supposed to be used by {@see CsvResultSet::stream()} only.
+ */
+final class VolatileCsvResults extends VolatileStateResults
+{
+ use CsvResultSetUtils;
+}
diff --git a/library/Icingadb/Data/VolatileJsonResults.php b/library/Icingadb/Data/VolatileJsonResults.php
new file mode 100644
index 0000000..034fb0e
--- /dev/null
+++ b/library/Icingadb/Data/VolatileJsonResults.php
@@ -0,0 +1,15 @@
+<?php
+
+/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */
+
+namespace Icinga\Module\Icingadb\Data;
+
+use Icinga\Module\Icingadb\Redis\VolatileStateResults;
+
+/**
+ * @internal This class is supposed to be used by {@see JsonResultSet::stream()} only.
+ */
+final class VolatileJsonResults extends VolatileStateResults
+{
+ use JsonResultSetUtils;
+}
diff --git a/library/Icingadb/Model/AcknowledgementHistory.php b/library/Icingadb/Model/AcknowledgementHistory.php
index 549d2ff..edbcc83 100644
--- a/library/Icingadb/Model/AcknowledgementHistory.php
+++ b/library/Icingadb/Model/AcknowledgementHistory.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -16,6 +17,21 @@ use ipl\Orm\Relations;
*
* Please note that using this model will fetch history entries for decommissioned services. To avoid this, the query
* needs a `acknowledgement_history.service_id IS NULL OR acknowledgement_history_service.id IS NOT NULL` where.
+ *
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property DateTime $set_time
+ * @property ?DateTime $clear_time
+ * @property ?string $author
+ * @property ?string $cleared_by
+ * @property ?string $comment
+ * @property ?DateTime $expire_time
+ * @property ?bool $is_sticky
+ * @property ?bool $is_persistent
*/
class AcknowledgementHistory extends Model
{
diff --git a/library/Icingadb/Model/ActionUrl.php b/library/Icingadb/Model/ActionUrl.php
index e0b092e..928ce35 100644
--- a/library/Icingadb/Model/ActionUrl.php
+++ b/library/Icingadb/Model/ActionUrl.php
@@ -10,6 +10,11 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string[] $action_url
+ * @property string $environment_id
+ */
class ActionUrl extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Behavior/FlattenedObjectVars.php b/library/Icingadb/Model/Behavior/FlattenedObjectVars.php
index b1c308a..8b110e0 100644
--- a/library/Icingadb/Model/Behavior/FlattenedObjectVars.php
+++ b/library/Icingadb/Model/Behavior/FlattenedObjectVars.php
@@ -32,11 +32,30 @@ class FlattenedObjectVars implements RewriteColumnBehavior, QueryAwareBehavior
$column = $condition->metaData()->get('columnName');
if ($column !== null) {
$relation = substr($relation, 0, -5) . 'customvar_flat.';
- $nameFilter = Filter::like($relation . 'flatname', $column);
- $class = get_class($condition);
- $valueFilter = new $class($relation . 'flatvalue', $condition->getValue());
-
- return Filter::all($nameFilter, $valueFilter);
+ $condition->metaData()
+ ->set('requiresTransformation', true)
+ ->set('columnPath', $relation . $column)
+ ->set('relationPath', substr($relation, 0, -1));
+
+ // The ORM's FilterProcessor only optimizes filter conditions that are in the same level (chain).
+ // Previously, this behavior transformed a single condition to an ALL chain and hence the semantics
+ // of the level changed, since the FilterProcessor interpreted the conditions separately from there on.
+ // To not change the semantics of the condition it is required to delay the transformation of the condition
+ // until the subquery is created. Though, since this is about custom variables, and such can contain dots,
+ // the FilterProcessor then continues traversing the parts of the column's path, which then would include
+ // the dot-separated parts of the custom variable name. To prevent this, we have to signal that what we
+ // return a replacement here, that should be used as-is and not processed further.
+ $condition->metaData()->set('forceResolved', true);
+
+ // But to make it even worse: If we do that, (not transforming the condition) the FilterProcessor sees
+ // multiple conditions as targeting different columns, as it doesn't know that the *columns* are in fact
+ // custom variables. It then attempts to combine the conditions with an AND, which is not possible, since
+ // they refer to the same columns (flatname and flatvalue) after being transformed. So we have to make
+ // the condition refer to a different column, which is totally irrelevant, but since it's always the same
+ // column, the FilterProcessor won't attempt to combine the conditions. The literal icing on the cake.
+ $condition->setColumn('always_the_same_but_totally_irrelevant');
+
+ return $condition;
}
}
diff --git a/library/Icingadb/Model/Checkcommand.php b/library/Icingadb/Model/Checkcommand.php
index 400a24b..7f55c0d 100644
--- a/library/Icingadb/Model/Checkcommand.php
+++ b/library/Icingadb/Model/Checkcommand.php
@@ -10,6 +10,17 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property ?string $zone_id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $command
+ * @property int $timeout
+ */
class Checkcommand extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/CheckcommandArgument.php b/library/Icingadb/Model/CheckcommandArgument.php
index 3fb4ad5..155f6da 100644
--- a/library/Icingadb/Model/CheckcommandArgument.php
+++ b/library/Icingadb/Model/CheckcommandArgument.php
@@ -9,6 +9,22 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $checkcommand_id
+ * @property string $argument_key
+ * @property string $environment_id
+ * @property string $properties_checksum
+ * @property ?string $argument_value
+ * @property ?int $argument_order
+ * @property ?string $description
+ * @property ?string $argument_key_override
+ * @property string $repeat_key
+ * @property string $required
+ * @property ?string $set_if
+ * @property ?string $separator
+ * @property string $skip_key
+ */
class CheckcommandArgument extends Model
{
public function getTableName()
@@ -35,6 +51,7 @@ class CheckcommandArgument extends Model
'repeat_key',
'required',
'set_if',
+ 'separator',
'skip_key'
];
}
diff --git a/library/Icingadb/Model/CheckcommandCustomvar.php b/library/Icingadb/Model/CheckcommandCustomvar.php
index 0a834b5..5382689 100644
--- a/library/Icingadb/Model/CheckcommandCustomvar.php
+++ b/library/Icingadb/Model/CheckcommandCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $checkcommand_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class CheckcommandCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/CheckcommandEnvvar.php b/library/Icingadb/Model/CheckcommandEnvvar.php
index 517a45f..05cdeed 100644
--- a/library/Icingadb/Model/CheckcommandEnvvar.php
+++ b/library/Icingadb/Model/CheckcommandEnvvar.php
@@ -9,6 +9,14 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $checkcommand_id
+ * @property string $envvar_key
+ * @property string $environment_id
+ * @property string $properties_checksum
+ * @property string $envvar_value
+ */
class CheckcommandEnvvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Comment.php b/library/Icingadb/Model/Comment.php
index bcdd5e0..bdfcaf0 100644
--- a/library/Icingadb/Model/Comment.php
+++ b/library/Icingadb/Model/Comment.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
use ipl\Orm\Behavior\Binary;
@@ -12,6 +13,24 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $author
+ * @property string $text
+ * @property string $entry_type
+ * @property DateTime $entry_time
+ * @property bool $is_persistent
+ * @property bool $is_sticky
+ * @property ?DateTime $expire_time
+ * @property ?string $zone_id
+ */
class Comment extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/CommentHistory.php b/library/Icingadb/Model/CommentHistory.php
index 5f03e68..1cb02e3 100644
--- a/library/Icingadb/Model/CommentHistory.php
+++ b/library/Icingadb/Model/CommentHistory.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -16,6 +17,23 @@ use ipl\Orm\Relations;
*
* Please note that using this model will fetch history entries for decommissioned services. To avoid this,
* the query needs a `comment_history.service_id IS NULL OR comment_history_service.id IS NOT NULL` where.
+ *
+ * @property string $comment_id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property DateTime $entry_time
+ * @property string $author
+ * @property ?string $removed_by
+ * @property string $comment
+ * @property string $entry_type
+ * @property bool $is_persistent
+ * @property bool $is_sticky
+ * @property ?DateTime $expire_time
+ * @property ?DateTime $remove_time
+ * @property bool $has_been_removed
*/
class CommentHistory extends Model
{
diff --git a/library/Icingadb/Model/Customvar.php b/library/Icingadb/Model/Customvar.php
index e043229..70fb709 100644
--- a/library/Icingadb/Model/Customvar.php
+++ b/library/Icingadb/Model/Customvar.php
@@ -9,6 +9,13 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $name
+ * @property string $value
+ */
class Customvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/CustomvarFlat.php b/library/Icingadb/Model/CustomvarFlat.php
index 99d8aca..e7a0459 100644
--- a/library/Icingadb/Model/CustomvarFlat.php
+++ b/library/Icingadb/Model/CustomvarFlat.php
@@ -6,11 +6,22 @@ namespace Icinga\Module\Icingadb\Model;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behaviors;
+use ipl\Orm\Contract\RewriteFilterBehavior;
use ipl\Orm\Model;
use ipl\Orm\Query;
use ipl\Orm\Relations;
+use ipl\Stdlib\Filter;
+use ipl\Stdlib\Filter\Condition;
use Traversable;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $customvar_id
+ * @property string $flatname_checksum
+ * @property string $flatname
+ * @property ?string $flatvalue
+ */
class CustomvarFlat extends Model
{
public function getTableName()
@@ -42,6 +53,20 @@ class CustomvarFlat extends Model
'customvar_id',
'flatname_checksum'
]));
+ $behaviors->add(new class implements RewriteFilterBehavior {
+ public function rewriteCondition(Condition $condition, $relation = null)
+ {
+ if ($condition->metaData()->has('requiresTransformation')) {
+ /** @var string $columnName */
+ $columnName = $condition->metaData()->get('columnName');
+ $nameFilter = Filter::like($relation . 'flatname', $columnName);
+ $class = get_class($condition);
+ $valueFilter = new $class($relation . 'flatvalue', $condition->getValue());
+
+ return Filter::all($nameFilter, $valueFilter);
+ }
+ }
+ });
}
public function createRelations(Relations $relations)
diff --git a/library/Icingadb/Model/Downtime.php b/library/Icingadb/Model/Downtime.php
index 7f600e9..b2ba617 100644
--- a/library/Icingadb/Model/Downtime.php
+++ b/library/Icingadb/Model/Downtime.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
use ipl\Orm\Behavior\Binary;
@@ -12,6 +13,32 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $triggered_by_id
+ * @property ?string $parent_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $author
+ * @property string $comment
+ * @property DateTime $entry_time
+ * @property DateTime $scheduled_start_time
+ * @property DateTime $scheduled_end_time
+ * @property int $scheduled_duration
+ * @property bool $is_flexible
+ * @property int $flexible_duration
+ * @property bool $is_in_effect
+ * @property ?DateTime $start_time
+ * @property ?DateTime $end_time
+ * @property int $duration
+ * @property ?string $scheduled_by
+ * @property ?string $zone_id
+ */
class Downtime extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/DowntimeHistory.php b/library/Icingadb/Model/DowntimeHistory.php
index 7ba992f..b69a097 100644
--- a/library/Icingadb/Model/DowntimeHistory.php
+++ b/library/Icingadb/Model/DowntimeHistory.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -16,6 +17,29 @@ use ipl\Orm\Relations;
*
* Please note that using this model will fetch history entries for decommissioned services. To avoid this,
* the query needs a `downtime_history.service_id IS NULL OR downtime_history_service.id IS NOT NULL` where.
+ *
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property ?string $triggered_by_id
+ * @property ?string $parent_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property DateTime $entry_time
+ * @property string $author
+ * @property ?string $cancelled_by
+ * @property string $comment
+ * @property bool $is_flexible
+ * @property int $flexible_duration
+ * @property DateTime $scheduled_start_time
+ * @property DateTime $scheduled_end_time
+ * @property DateTime $start_time
+ * @property DateTime $end_time
+ * @property ?string $scheduled_by
+ * @property bool $has_been_cancelled
+ * @property DateTime $trigger_time
+ * @property ?DateTime $cancel_time
*/
class DowntimeHistory extends Model
{
@@ -49,6 +73,7 @@ class DowntimeHistory extends Model
'scheduled_end_time',
'start_time',
'end_time',
+ 'scheduled_by',
'has_been_cancelled',
'trigger_time',
'cancel_time'
diff --git a/library/Icingadb/Model/Endpoint.php b/library/Icingadb/Model/Endpoint.php
index 257001b..f8a9b8c 100644
--- a/library/Icingadb/Model/Endpoint.php
+++ b/library/Icingadb/Model/Endpoint.php
@@ -9,6 +9,15 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $zone_id
+ */
class Endpoint extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Environment.php b/library/Icingadb/Model/Environment.php
index 919ca1c..cd82082 100644
--- a/library/Icingadb/Model/Environment.php
+++ b/library/Icingadb/Model/Environment.php
@@ -9,6 +9,10 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $name
+ */
class Environment extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Eventcommand.php b/library/Icingadb/Model/Eventcommand.php
index ad18e22..68c1c06 100644
--- a/library/Icingadb/Model/Eventcommand.php
+++ b/library/Icingadb/Model/Eventcommand.php
@@ -10,6 +10,17 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property ?string $zone_id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $command
+ * @property int $timeout
+ */
class Eventcommand extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/EventcommandArgument.php b/library/Icingadb/Model/EventcommandArgument.php
index 485e5d3..1f60ac2 100644
--- a/library/Icingadb/Model/EventcommandArgument.php
+++ b/library/Icingadb/Model/EventcommandArgument.php
@@ -9,6 +9,22 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $eventcommand_id
+ * @property string $argument_key
+ * @property string $environment_id
+ * @property string $properties_checksum
+ * @property ?string $argument_value
+ * @property ?int $argument_order
+ * @property ?string $description
+ * @property ?string $argument_key_override
+ * @property string $repeat_key
+ * @property string $required
+ * @property ?string $set_if
+ * @property ?string $separator
+ * @property string $skip_key
+ */
class EventcommandArgument extends Model
{
public function getTableName()
@@ -35,6 +51,7 @@ class EventcommandArgument extends Model
'repeat_key',
'required',
'set_if',
+ 'separator',
'skip_key'
];
}
diff --git a/library/Icingadb/Model/EventcommandCustomvar.php b/library/Icingadb/Model/EventcommandCustomvar.php
index 3d1fa48..0da010b 100644
--- a/library/Icingadb/Model/EventcommandCustomvar.php
+++ b/library/Icingadb/Model/EventcommandCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $eventcommand_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class EventcommandCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/EventcommandEnvvar.php b/library/Icingadb/Model/EventcommandEnvvar.php
index 3883bef..2eb8acf 100644
--- a/library/Icingadb/Model/EventcommandEnvvar.php
+++ b/library/Icingadb/Model/EventcommandEnvvar.php
@@ -9,6 +9,14 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $eventcommand_id
+ * @property string $envvar_key
+ * @property string $environment_id
+ * @property string $properties_checksum
+ * @property string $envvar_value
+ */
class EventcommandEnvvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/FlappingHistory.php b/library/Icingadb/Model/FlappingHistory.php
index 69711eb..e060ca6 100644
--- a/library/Icingadb/Model/FlappingHistory.php
+++ b/library/Icingadb/Model/FlappingHistory.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
use ipl\Orm\Behaviors;
@@ -15,6 +16,19 @@ use ipl\Orm\Relations;
*
* Please note that using this model will fetch history entries for decommissioned services. To avoid this,
* the query needs a `flapping_history.service_id IS NULL OR flapping_history_service.id IS NOT NULL` where.
+ *
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property DateTime $start_time
+ * @property ?DateTime $end_time
+ * @property ?float $percent_state_change_start
+ * @property ?float $percent_state_change_end
+ * @property float $flapping_threshold_low
+ * @property float $flapping_threshold_high
*/
class FlappingHistory extends Model
{
diff --git a/library/Icingadb/Model/History.php b/library/Icingadb/Model/History.php
index a34b3bd..3643a22 100644
--- a/library/Icingadb/Model/History.php
+++ b/library/Icingadb/Model/History.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -16,6 +17,21 @@ use ipl\Orm\Relations;
*
* Please note that using this model will fetch history entries for decommissioned services. To avoid
* this, the query needs a `history.service_id IS NULL OR history_service.id IS NOT NULL` where.
+ *
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property ?string $comment_history_id
+ * @property ?string $downtime_history_id
+ * @property ?string $flapping_history_id
+ * @property ?string $notification_history_id
+ * @property ?string $acknowledgement_history_id
+ * @property ?string $state_history_id
+ * @property string $event_type
+ * @property DateTime $event_time
*/
class History extends Model
{
diff --git a/library/Icingadb/Model/Host.php b/library/Icingadb/Model/Host.php
index e1296c8..c697983 100644
--- a/library/Icingadb/Model/Host.php
+++ b/library/Icingadb/Model/Host.php
@@ -16,6 +16,46 @@ use ipl\Orm\ResultSet;
/**
* Host model.
+ *
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $display_name
+ * @property string $address
+ * @property string $address6
+ * @property ?string $address_bin
+ * @property ?string $address6_bin
+ * @property string $checkcommand_name
+ * @property string $checkcommand_id
+ * @property int $max_check_attempts
+ * @property string $check_timeperiod_name
+ * @property ?string $check_timeperiod_id
+ * @property ?int $check_timeout
+ * @property int $check_interval
+ * @property int $check_retry_interval
+ * @property bool $active_checks_enabled
+ * @property bool $passive_checks_enabled
+ * @property bool $event_handler_enabled
+ * @property bool $notifications_enabled
+ * @property bool $flapping_enabled
+ * @property float $flapping_threshold_low
+ * @property float $flapping_threshold_high
+ * @property bool $perfdata_enabled
+ * @property string $eventcommand_name
+ * @property ?string $eventcommand_id
+ * @property bool $is_volatile
+ * @property ?string $action_url_id
+ * @property ?string $notes_url_id
+ * @property string $notes
+ * @property ?string $icon_image_id
+ * @property string $icon_image_alt
+ * @property string $zone_name
+ * @property ?string $zone_id
+ * @property string $command_endpoint_name
+ * @property ?string $command_endpoint_id
*/
class Host extends Model
{
diff --git a/library/Icingadb/Model/HostCustomvar.php b/library/Icingadb/Model/HostCustomvar.php
index 9f7df26..bda786b 100644
--- a/library/Icingadb/Model/HostCustomvar.php
+++ b/library/Icingadb/Model/HostCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $host_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class HostCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Hostgroup.php b/library/Icingadb/Model/Hostgroup.php
index 97930fa..1ff6f0f 100644
--- a/library/Icingadb/Model/Hostgroup.php
+++ b/library/Icingadb/Model/Hostgroup.php
@@ -10,6 +10,16 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $display_name
+ * @property ?string $zone_id
+ */
class Hostgroup extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/HostgroupCustomvar.php b/library/Icingadb/Model/HostgroupCustomvar.php
index 41272d1..d3dd09b 100644
--- a/library/Icingadb/Model/HostgroupCustomvar.php
+++ b/library/Icingadb/Model/HostgroupCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $hostgroup_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class HostgroupCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/HostgroupMember.php b/library/Icingadb/Model/HostgroupMember.php
index 3660e71..e03db73 100644
--- a/library/Icingadb/Model/HostgroupMember.php
+++ b/library/Icingadb/Model/HostgroupMember.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $host_id
+ * @property string $hostgroup_id
+ * @property string $environment_id
+ */
class HostgroupMember extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Hostgroupsummary.php b/library/Icingadb/Model/Hostgroupsummary.php
index a9295bb..172413e 100644
--- a/library/Icingadb/Model/Hostgroupsummary.php
+++ b/library/Icingadb/Model/Hostgroupsummary.php
@@ -13,6 +13,27 @@ use ipl\Sql\Connection;
use ipl\Sql\Expression;
use ipl\Sql\Select;
+/**
+ * @property string $id
+ * @property string $display_name
+ * @property string $name_ci
+ * @property string $name
+ * @property int $hosts_down_handled
+ * @property int $hosts_down_unhandled
+ * @property int $hosts_pending
+ * @property int $hosts_total
+ * @property int $hosts_up
+ * @property int $hosts_severity
+ * @property int $services_critical_handled
+ * @property int $services_critical_unhandled
+ * @property int $services_ok
+ * @property int $services_pending
+ * @property int $services_total
+ * @property int $services_unknown_handled
+ * @property int $services_unknown_unhandled
+ * @property int $services_warning_handled
+ * @property int $services_warning_unhandled
+ */
class Hostgroupsummary extends UnionModel
{
public static function on(Connection $db)
@@ -55,6 +76,8 @@ class Hostgroupsummary extends UnionModel
public function getColumns()
{
return [
+ 'name' => 'hostgroup_name',
+ 'name_ci' => 'hostgroup_name_ci',
'display_name' => 'hostgroup_display_name',
'hosts_down_handled' => new Expression(
'SUM(CASE WHEN host_state = 1'
@@ -74,7 +97,6 @@ class Hostgroupsummary extends UnionModel
'SUM(CASE WHEN host_state = 0 THEN 1 ELSE 0 END)'
),
'hosts_severity' => new Expression('MAX(host_severity)'),
- 'name' => 'hostgroup_name',
'services_critical_handled' => new Expression(
'SUM(CASE WHEN service_state = 2'
. ' AND (service_handled = \'y\' OR service_reachable = \'n\') THEN 1 ELSE 0 END)'
@@ -113,7 +135,7 @@ class Hostgroupsummary extends UnionModel
public function getSearchColumns()
{
- return ['display_name'];
+ return ['name_ci', 'display_name'];
}
public function getDefaultSort()
@@ -133,6 +155,7 @@ class Hostgroupsummary extends UnionModel
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => 'hostgroup.name',
+ 'hostgroup_name_ci' => 'hostgroup.name_ci',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => 'host.id',
'host_state' => 'state.soft_state',
@@ -154,6 +177,7 @@ class Hostgroupsummary extends UnionModel
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => 'hostgroup.name',
+ 'hostgroup_name_ci' => 'hostgroup.name_ci',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => new Expression('NULL'),
'host_state' => new Expression('NULL'),
@@ -172,6 +196,7 @@ class Hostgroupsummary extends UnionModel
[
'hostgroup_id' => 'hostgroup.id',
'hostgroup_name' => 'hostgroup.name',
+ 'hostgroup_name_ci' => 'hostgroup.name_ci',
'hostgroup_display_name' => 'hostgroup.display_name',
'host_id' => new Expression('NULL'),
'host_state' => new Expression('NULL'),
diff --git a/library/Icingadb/Model/HoststateSummary.php b/library/Icingadb/Model/HoststateSummary.php
index 93268f3..3184c28 100644
--- a/library/Icingadb/Model/HoststateSummary.php
+++ b/library/Icingadb/Model/HoststateSummary.php
@@ -7,6 +7,20 @@ namespace Icinga\Module\Icingadb\Model;
use ipl\Sql\Connection;
use ipl\Sql\Expression;
+/**
+ * @property int $hosts_acknowledged
+ * @property int $hosts_active_checks_enabled
+ * @property int $hosts_passive_checks_enabled
+ * @property int $hosts_down_handled
+ * @property int $hosts_down_unhandled
+ * @property int $hosts_event_handler_enabled
+ * @property int $hosts_flapping_enabled
+ * @property int $hosts_notifications_enabled
+ * @property int $hosts_pending
+ * @property int $hosts_problems_unacknowledged
+ * @property int $hosts_total
+ * @property int $hosts_up
+ */
class HoststateSummary extends Host
{
public function getSummaryColumns()
diff --git a/library/Icingadb/Model/IconImage.php b/library/Icingadb/Model/IconImage.php
index 212234a..58f0be6 100644
--- a/library/Icingadb/Model/IconImage.php
+++ b/library/Icingadb/Model/IconImage.php
@@ -9,6 +9,11 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $icon_image
+ * @property string $environment_id
+ */
class IconImage extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Instance.php b/library/Icingadb/Model/Instance.php
index 73db565..716d23d 100644
--- a/library/Icingadb/Model/Instance.php
+++ b/library/Icingadb/Model/Instance.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\BoolCast;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -11,6 +12,21 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property DateTime $heartbeat
+ * @property bool $responsible
+ * @property bool $icinga2_active_host_checks_enabled
+ * @property bool $icinga2_active_service_checks_enabled
+ * @property bool $icinga2_event_handlers_enabled
+ * @property bool $icinga2_flap_detection_enabled
+ * @property bool $icinga2_notifications_enabled
+ * @property bool $icinga2_performance_data_enabled
+ * @property DateTime $icinga2_start_time
+ * @property string $icinga2_version
+ */
class Instance extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/NotesUrl.php b/library/Icingadb/Model/NotesUrl.php
index 5865c52..138eaba 100644
--- a/library/Icingadb/Model/NotesUrl.php
+++ b/library/Icingadb/Model/NotesUrl.php
@@ -10,6 +10,11 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string[] $notes_url
+ * @property string $environment_id
+ */
class NotesUrl extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Notification.php b/library/Icingadb/Model/Notification.php
index 8d42301..4c15d2e 100644
--- a/library/Icingadb/Model/Notification.php
+++ b/library/Icingadb/Model/Notification.php
@@ -11,6 +11,24 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property string $notificationcommand_id
+ * @property ?int $times_begin
+ * @property ?int $times_end
+ * @property int $notification_interval
+ * @property ?string $timeperiod_id
+ * @property string[] $states
+ * @property string[] $types
+ * @property ?string $zone_id
+ */
class Notification extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/NotificationCustomvar.php b/library/Icingadb/Model/NotificationCustomvar.php
index 620ae5c..655d1de 100644
--- a/library/Icingadb/Model/NotificationCustomvar.php
+++ b/library/Icingadb/Model/NotificationCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $notification_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class NotificationCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/NotificationHistory.php b/library/Icingadb/Model/NotificationHistory.php
index c635dbb..08903ad 100644
--- a/library/Icingadb/Model/NotificationHistory.php
+++ b/library/Icingadb/Model/NotificationHistory.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use Icinga\Module\Icingadb\Model\Behavior\ReRoute;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
@@ -16,6 +17,21 @@ use ipl\Orm\Relations;
*
* Please note that using this model will fetch history entries for decommissioned services. To avoid this, the
* query needs a `notification_history.service_id IS NULL OR notification_history_service.id IS NOT NULL` where.
+ *
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property string $notification_id
+ * @property string $type
+ * @property DateTime $send_time
+ * @property int $state
+ * @property int $previous_hard_state
+ * @property string $author
+ * @property string $text
+ * @property int $users_notified
*/
class NotificationHistory extends Model
{
diff --git a/library/Icingadb/Model/NotificationUser.php b/library/Icingadb/Model/NotificationUser.php
index ab23ad4..efb779c 100644
--- a/library/Icingadb/Model/NotificationUser.php
+++ b/library/Icingadb/Model/NotificationUser.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $notification_id
+ * @property string $user_id
+ * @property string $environment_id
+ */
class NotificationUser extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/NotificationUsergroup.php b/library/Icingadb/Model/NotificationUsergroup.php
index bd60fae..a503337 100644
--- a/library/Icingadb/Model/NotificationUsergroup.php
+++ b/library/Icingadb/Model/NotificationUsergroup.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $notification_id
+ * @property string $usergroup_id
+ * @property string $environment_id
+ */
class NotificationUsergroup extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Notificationcommand.php b/library/Icingadb/Model/Notificationcommand.php
index 6ee2a21..c170aae 100644
--- a/library/Icingadb/Model/Notificationcommand.php
+++ b/library/Icingadb/Model/Notificationcommand.php
@@ -10,6 +10,17 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property ?string $zone_id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $command
+ * @property int $timeout
+ */
class Notificationcommand extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/NotificationcommandArgument.php b/library/Icingadb/Model/NotificationcommandArgument.php
index e855022..e3a5e67 100644
--- a/library/Icingadb/Model/NotificationcommandArgument.php
+++ b/library/Icingadb/Model/NotificationcommandArgument.php
@@ -9,6 +9,22 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $notificationcommand_id
+ * @property string $argument_key
+ * @property string $environment_id
+ * @property string $properties_checksum
+ * @property ?string $argument_value
+ * @property ?int $argument_order
+ * @property ?string $description
+ * @property ?string $argument_key_override
+ * @property string $repeat_key
+ * @property string $required
+ * @property ?string $set_if
+ * @property ?string $separator
+ * @property string $skip_key
+ */
class NotificationcommandArgument extends Model
{
public function getTableName()
@@ -35,6 +51,7 @@ class NotificationcommandArgument extends Model
'repeat_key',
'required',
'set_if',
+ 'separator',
'skip_key'
];
}
diff --git a/library/Icingadb/Model/NotificationcommandCustomvar.php b/library/Icingadb/Model/NotificationcommandCustomvar.php
index bd103f7..f541927 100644
--- a/library/Icingadb/Model/NotificationcommandCustomvar.php
+++ b/library/Icingadb/Model/NotificationcommandCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $notificationcommand_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class NotificationcommandCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/NotificationcommandEnvvar.php b/library/Icingadb/Model/NotificationcommandEnvvar.php
index 09f77b0..0180be6 100644
--- a/library/Icingadb/Model/NotificationcommandEnvvar.php
+++ b/library/Icingadb/Model/NotificationcommandEnvvar.php
@@ -9,6 +9,14 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $notificationcommand_id
+ * @property string $envvar_key
+ * @property string $environment_id
+ * @property string $properties_checksum
+ * @property string $envvar_value
+ */
class NotificationcommandEnvvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Service.php b/library/Icingadb/Model/Service.php
index c57b6ba..1d97b96 100644
--- a/library/Icingadb/Model/Service.php
+++ b/library/Icingadb/Model/Service.php
@@ -14,6 +14,44 @@ use ipl\Orm\Model;
use ipl\Orm\Relations;
use ipl\Orm\ResultSet;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $host_id
+ * @property string $name
+ * @property string $name_ci
+ * @property string $display_name
+ * @property string $checkcommand_name
+ * @property string $checkcommand_id
+ * @property int $max_check_attempts
+ * @property string $check_timeperiod_name
+ * @property ?string $check_timeperiod_id
+ * @property ?int $check_timeout
+ * @property int $check_interval
+ * @property int $check_retry_interval
+ * @property bool $active_checks_enabled
+ * @property bool $passive_checks_enabled
+ * @property bool $event_handler_enabled
+ * @property bool $notifications_enabled
+ * @property bool $flapping_enabled
+ * @property float $flapping_threshold_low
+ * @property float $flapping_threshold_high
+ * @property bool $perfdata_enabled
+ * @property string $eventcommand_name
+ * @property ?string $eventcommand_id
+ * @property bool $is_volatile
+ * @property ?string $action_url_id
+ * @property ?string $notes_url_id
+ * @property string $notes
+ * @property ?string $icon_image_id
+ * @property string $icon_image_alt
+ * @property string $zone_name
+ * @property ?string $zone_id
+ * @property string $command_endpoint_name
+ * @property ?string $command_endpoint_id
+ */
class Service extends Model
{
use Auth;
diff --git a/library/Icingadb/Model/ServiceCustomvar.php b/library/Icingadb/Model/ServiceCustomvar.php
index 07ee84c..ba462f1 100644
--- a/library/Icingadb/Model/ServiceCustomvar.php
+++ b/library/Icingadb/Model/ServiceCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $service_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class ServiceCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/ServiceState.php b/library/Icingadb/Model/ServiceState.php
index c5daa08..1d7dc31 100644
--- a/library/Icingadb/Model/ServiceState.php
+++ b/library/Icingadb/Model/ServiceState.php
@@ -7,6 +7,11 @@ namespace Icinga\Module\Icingadb\Model;
use Icinga\Module\Icingadb\Common\ServiceStates;
use ipl\Orm\Relations;
+/**
+ * Service state model.
+ *
+ * @property string $service_id
+ */
class ServiceState extends State
{
public function getTableName()
diff --git a/library/Icingadb/Model/Servicegroup.php b/library/Icingadb/Model/Servicegroup.php
index 0da92fb..2e4b847 100644
--- a/library/Icingadb/Model/Servicegroup.php
+++ b/library/Icingadb/Model/Servicegroup.php
@@ -10,6 +10,16 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $display_name
+ * @property ?string $zone_id
+ */
class Servicegroup extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/ServicegroupCustomvar.php b/library/Icingadb/Model/ServicegroupCustomvar.php
index 23e536b..01479ee 100644
--- a/library/Icingadb/Model/ServicegroupCustomvar.php
+++ b/library/Icingadb/Model/ServicegroupCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $servicegroup_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class ServicegroupCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/ServicegroupMember.php b/library/Icingadb/Model/ServicegroupMember.php
index 5da537a..80a5054 100644
--- a/library/Icingadb/Model/ServicegroupMember.php
+++ b/library/Icingadb/Model/ServicegroupMember.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $service_id
+ * @property string $servicegroup_id
+ * @property string $environment_id
+ */
class ServicegroupMember extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/ServicegroupSummary.php b/library/Icingadb/Model/ServicegroupSummary.php
index 89a0953..c15ef07 100644
--- a/library/Icingadb/Model/ServicegroupSummary.php
+++ b/library/Icingadb/Model/ServicegroupSummary.php
@@ -13,6 +13,22 @@ use ipl\Sql\Connection;
use ipl\Sql\Expression;
use ipl\Sql\Select;
+/**
+ * @property string $id
+ * @property string $display_name
+ * @property string $name_ci
+ * @property string $name
+ * @property int $services_critical_handled
+ * @property int $services_critical_unhandled
+ * @property int $services_ok
+ * @property int $services_pending
+ * @property int $services_total
+ * @property int $services_unknown_handled
+ * @property int $services_unknown_unhandled
+ * @property int $services_warning_handled
+ * @property int $services_warning_unhandled
+ * @property int $services_severity
+ */
class ServicegroupSummary extends UnionModel
{
public static function on(Connection $db)
@@ -55,8 +71,9 @@ class ServicegroupSummary extends UnionModel
public function getColumns()
{
return [
- 'display_name' => 'servicegroup_display_name',
'name' => 'servicegroup_name',
+ 'name_ci' => 'servicegroup_name_ci',
+ 'display_name' => 'servicegroup_display_name',
'services_critical_handled' => new Expression(
'SUM(CASE WHEN service_state = 2'
. ' AND (service_handled = \'y\' OR service_reachable = \'n\') THEN 1 ELSE 0 END)'
@@ -96,7 +113,7 @@ class ServicegroupSummary extends UnionModel
public function getSearchColumns()
{
- return ['display_name'];
+ return ['name_ci', 'display_name'];
}
public function getDefaultSort()
@@ -116,6 +133,7 @@ class ServicegroupSummary extends UnionModel
[
'servicegroup_id' => 'servicegroup.id',
'servicegroup_name' => 'servicegroup.name',
+ 'servicegroup_name_ci' => 'servicegroup.name_ci',
'servicegroup_display_name' => 'servicegroup.display_name',
'service_id' => 'service.id',
'service_state' => 'state.soft_state',
@@ -130,6 +148,7 @@ class ServicegroupSummary extends UnionModel
[
'servicegroup_id' => 'servicegroup.id',
'servicegroup_name' => 'servicegroup.name',
+ 'servicegroup_name_ci' => 'servicegroup.name_ci',
'servicegroup_display_name' => 'servicegroup.display_name',
'service_id' => new Expression('NULL'),
'service_state' => new Expression('NULL'),
diff --git a/library/Icingadb/Model/ServicestateSummary.php b/library/Icingadb/Model/ServicestateSummary.php
index b1364f7..daf3bec 100644
--- a/library/Icingadb/Model/ServicestateSummary.php
+++ b/library/Icingadb/Model/ServicestateSummary.php
@@ -7,6 +7,24 @@ namespace Icinga\Module\Icingadb\Model;
use ipl\Sql\Connection;
use ipl\Sql\Expression;
+/**
+ * @property int $services_acknowledged
+ * @property int $services_active_checks_enabled
+ * @property int $services_passive_checks_enabled
+ * @property int $services_critical_handled
+ * @property int $services_critical_unhandled
+ * @property int $services_event_handler_enabled
+ * @property int $services_flapping_enabled
+ * @property int $services_notifications_enabled
+ * @property int $services_ok
+ * @property int $services_pending
+ * @property int $services_problems_unacknowledged
+ * @property int $services_total
+ * @property int $services_unknown_handled
+ * @property int $services_unknown_unhandled
+ * @property int $services_warning_handled
+ * @property int $services_warning_unhandled
+ */
class ServicestateSummary extends Service
{
public function getSummaryColumns()
diff --git a/library/Icingadb/Model/State.php b/library/Icingadb/Model/State.php
index 2d242a8..4529c9b 100644
--- a/library/Icingadb/Model/State.php
+++ b/library/Icingadb/Model/State.php
@@ -16,6 +16,7 @@ use ipl\Web\Widget\Icon;
/**
* Base class for the {@link HostState} and {@link ServiceState} models providing common columns.
*
+ * @property string $id
* @property string $environment_id The environment id
* @property string $state_type The state type (hard or soft)
* @property int $soft_state The current soft state code (0 = OK, 1 = WARNING, 2 = CRITICAL, 3 = UNKNOWN)
@@ -44,9 +45,9 @@ use ipl\Web\Widget\Icon;
* @property ?string $check_source The name of the node that executes the check
* @property ?string $scheduling_source The name of the node that schedules the check
* @property ?DateTime $last_update The time when the node was last updated
- * @property ?DateTime $last_state_change The time when the node last got a status change
- * @property ?DateTime $next_check The time when the node will execute the next check
- * @property ?DateTime $next_update The time when the next check of the node is expected to end
+ * @property DateTime $last_state_change The time when the node last got a status change
+ * @property DateTime $next_check The time when the node will execute the next check
+ * @property DateTime $next_update The time when the next check of the node is expected to end
*/
abstract class State extends Model
{
diff --git a/library/Icingadb/Model/StateHistory.php b/library/Icingadb/Model/StateHistory.php
index 9d80cb2..35d0115 100644
--- a/library/Icingadb/Model/StateHistory.php
+++ b/library/Icingadb/Model/StateHistory.php
@@ -4,6 +4,7 @@
namespace Icinga\Module\Icingadb\Model;
+use DateTime;
use ipl\Orm\Behavior\Binary;
use ipl\Orm\Behavior\MillisecondTimestamp;
use ipl\Orm\Behaviors;
@@ -15,6 +16,25 @@ use ipl\Orm\Relations;
*
* Please note that using this model will fetch history entries for decommissioned services. To avoid this,
* the query needs a `state_history.service_id IS NULL OR state_history_service.id IS NOT NULL` where.
+ *
+ * @property string $id
+ * @property string $environment_id
+ * @property ?string $endpoint_id
+ * @property string $object_type
+ * @property string $host_id
+ * @property ?string $service_id
+ * @property DateTime $event_time
+ * @property string $state_type
+ * @property int $soft_state
+ * @property int $hard_state
+ * @property int $check_attempt
+ * @property int $previous_soft_state
+ * @property int $previous_hard_state
+ * @property ?string $output
+ * @property ?string $long_output
+ * @property int $max_check_attempts
+ * @property ?string $check_source
+ * @property ?string $scheduling_source
*/
class StateHistory extends Model
{
diff --git a/library/Icingadb/Model/Timeperiod.php b/library/Icingadb/Model/Timeperiod.php
index 26dd722..e166410 100644
--- a/library/Icingadb/Model/Timeperiod.php
+++ b/library/Icingadb/Model/Timeperiod.php
@@ -10,6 +10,17 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $display_name
+ * @property string $prefer_includes
+ * @property ?string $zone_id
+ */
class Timeperiod extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/TimeperiodCustomvar.php b/library/Icingadb/Model/TimeperiodCustomvar.php
index 614a312..2931068 100644
--- a/library/Icingadb/Model/TimeperiodCustomvar.php
+++ b/library/Icingadb/Model/TimeperiodCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $timeperiod_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class TimeperiodCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/TimeperiodOverrideExclude.php b/library/Icingadb/Model/TimeperiodOverrideExclude.php
index c33df77..2764dfb 100644
--- a/library/Icingadb/Model/TimeperiodOverrideExclude.php
+++ b/library/Icingadb/Model/TimeperiodOverrideExclude.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $timeperiod_id
+ * @property string $override_id
+ * @property string $environment_id
+ */
class TimeperiodOverrideExclude extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/TimeperiodOverrideInclude.php b/library/Icingadb/Model/TimeperiodOverrideInclude.php
index 5418596..b92e9ee 100644
--- a/library/Icingadb/Model/TimeperiodOverrideInclude.php
+++ b/library/Icingadb/Model/TimeperiodOverrideInclude.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $timeperiod_id
+ * @property string $override_id
+ * @property string $environment_id
+ */
class TimeperiodOverrideInclude extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/TimeperiodRange.php b/library/Icingadb/Model/TimeperiodRange.php
index 62e87f8..af94573 100644
--- a/library/Icingadb/Model/TimeperiodRange.php
+++ b/library/Icingadb/Model/TimeperiodRange.php
@@ -9,6 +9,13 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $timeperiod_id
+ * @property string $range_key
+ * @property string $environment_id
+ * @property string $range_value
+ */
class TimeperiodRange extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/User.php b/library/Icingadb/Model/User.php
index 91d0d71..1218de9 100644
--- a/library/Icingadb/Model/User.php
+++ b/library/Icingadb/Model/User.php
@@ -11,6 +11,22 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $display_name
+ * @property string $email
+ * @property string $pager
+ * @property string $notifications_enabled
+ * @property ?string $timeperiod_id
+ * @property string[] $states
+ * @property string[] $types
+ * @property ?string $zone_id
+ */
class User extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/UserCustomvar.php b/library/Icingadb/Model/UserCustomvar.php
index a702b68..883858b 100644
--- a/library/Icingadb/Model/UserCustomvar.php
+++ b/library/Icingadb/Model/UserCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $customvar_id
+ * @property string $user_id
+ * @property string $environment_id
+ */
class UserCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Usergroup.php b/library/Icingadb/Model/Usergroup.php
index 34b0647..281c9ce 100644
--- a/library/Icingadb/Model/Usergroup.php
+++ b/library/Icingadb/Model/Usergroup.php
@@ -10,6 +10,16 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $display_name
+ * @property ?string $zone_id
+ */
class Usergroup extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/UsergroupCustomvar.php b/library/Icingadb/Model/UsergroupCustomvar.php
index ab97273..cdc79bc 100644
--- a/library/Icingadb/Model/UsergroupCustomvar.php
+++ b/library/Icingadb/Model/UsergroupCustomvar.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $usergroup_id
+ * @property string $customvar_id
+ * @property string $environment_id
+ */
class UsergroupCustomvar extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/UsergroupMember.php b/library/Icingadb/Model/UsergroupMember.php
index 7c61d67..7abd5c8 100644
--- a/library/Icingadb/Model/UsergroupMember.php
+++ b/library/Icingadb/Model/UsergroupMember.php
@@ -9,6 +9,12 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $usergroup_id
+ * @property string $user_id
+ * @property string $environment_id
+ */
class UsergroupMember extends Model
{
public function getTableName()
diff --git a/library/Icingadb/Model/Zone.php b/library/Icingadb/Model/Zone.php
index aaf3bbf..04d63ce 100644
--- a/library/Icingadb/Model/Zone.php
+++ b/library/Icingadb/Model/Zone.php
@@ -9,6 +9,17 @@ use ipl\Orm\Behaviors;
use ipl\Orm\Model;
use ipl\Orm\Relations;
+/**
+ * @property string $id
+ * @property string $environment_id
+ * @property string $name_checksum
+ * @property string $properties_checksum
+ * @property string $name
+ * @property string $name_ci
+ * @property string $is_global
+ * @property ?string $parent_id
+ * @property int $depth
+ */
class Zone extends Model
{
public function getTableName()
diff --git a/library/Icingadb/ProvidedHook/ApplicationState.php b/library/Icingadb/ProvidedHook/ApplicationState.php
index 8c7b008..208a97a 100644
--- a/library/Icingadb/ProvidedHook/ApplicationState.php
+++ b/library/Icingadb/ProvidedHook/ApplicationState.php
@@ -31,7 +31,7 @@ class ApplicationState extends ApplicationStateHook
$this->addError(
'icingadb/redis-down',
$downSince,
- sprintf(t("Can't connect to Icinga Redis: %s"), $e->getMessage())
+ sprintf(t("Can't connect to Redis: %s"), $e->getMessage())
);
return;
@@ -89,7 +89,7 @@ class ApplicationState extends ApplicationStateHook
$this->addError(
'icingadb/redis-outdated',
$lastIcingaHeartbeat,
- t('Icinga Redis is outdated. Make sure Icinga 2 is running and connected to Redis.')
+ t('Redis is outdated. Make sure Icinga 2 is running and connected to Redis.')
);
break;
diff --git a/library/Icingadb/ProvidedHook/RedisHealth.php b/library/Icingadb/ProvidedHook/RedisHealth.php
index 1471aba..681edac 100644
--- a/library/Icingadb/ProvidedHook/RedisHealth.php
+++ b/library/Icingadb/ProvidedHook/RedisHealth.php
@@ -16,7 +16,7 @@ class RedisHealth extends HealthHook
public function getName(): string
{
- return 'Icinga Redis';
+ return 'Redis';
}
public function checkHealth()
@@ -32,7 +32,7 @@ class RedisHealth extends HealthHook
if ($instance === null) {
$this->setState(self::STATE_UNKNOWN);
$this->setMessage(t(
- 'Can\'t check Icinga Redis: Icinga DB is not running or not writing into the database'
+ 'Can\'t check Redis: Icinga DB is not running or not writing into the database'
. ' (make sure the icinga feature "icingadb" is enabled)'
));
@@ -42,14 +42,14 @@ class RedisHealth extends HealthHook
$outdatedDbHeartbeat = $instance->heartbeat->getTimestamp() < time() - 60;
if (! $outdatedDbHeartbeat || $instance->heartbeat->getTimestamp() <= $lastIcingaHeartbeat) {
$this->setState(self::STATE_OK);
- $this->setMessage(t('Icinga Redis available and up to date.'));
+ $this->setMessage(t('Redis available and up to date.'));
} elseif ($instance->heartbeat->getTimestamp() > $lastIcingaHeartbeat) {
$this->setState(self::STATE_CRITICAL);
- $this->setMessage(t('Icinga Redis outdated. Make sure Icinga 2 is running and connected to Redis.'));
+ $this->setMessage(t('Redis outdated. Make sure Icinga 2 is running and connected to Redis.'));
}
} catch (Exception $e) {
$this->setState(self::STATE_CRITICAL);
- $this->setMessage(sprintf(t("Can't connect to Icinga Redis: %s"), $e->getMessage()));
+ $this->setMessage(sprintf(t("Can't connect to Redis: %s"), $e->getMessage()));
}
}
}
diff --git a/library/Icingadb/Setup/RedisPage.php b/library/Icingadb/Setup/RedisPage.php
index 3c0a741..69b04bb 100644
--- a/library/Icingadb/Setup/RedisPage.php
+++ b/library/Icingadb/Setup/RedisPage.php
@@ -12,9 +12,9 @@ class RedisPage extends Form
public function init()
{
$this->setName('setup_icingadb_redis');
- $this->setTitle(t('Icinga DB Redis'));
+ $this->setTitle(t('Redis'));
$this->addDescription(t(
- 'Please fill out the connection details to access the Icinga DB Redis.'
+ 'Please fill out the connection details to access the Redis server.'
));
$this->setValidatePartial(true);
}
diff --git a/library/Icingadb/Setup/RedisStep.php b/library/Icingadb/Setup/RedisStep.php
index 97e50e0..7f2baab 100644
--- a/library/Icingadb/Setup/RedisStep.php
+++ b/library/Icingadb/Setup/RedisStep.php
@@ -107,7 +107,7 @@ class RedisStep extends Step
$topic = new HtmlElement('div', Attributes::create(['class' => 'topic']));
$topic->addHtml(new HtmlElement('p', null, Text::create(mt(
'icingadb',
- 'The Icinga DB Redis will be accessed using the following connection details:'
+ 'Redis will be accessed using the following connection details:'
))));
$primaryOptions = new Table();
@@ -178,7 +178,7 @@ class RedisStep extends Step
$summary = new HtmlDocument();
$summary->addHtml(
- new HtmlElement('h2', null, Text::create(mt('icingadb', 'Icinga DB Redis'))),
+ new HtmlElement('h2', null, Text::create(mt('icingadb', 'Redis'))),
$topic
);
diff --git a/library/Icingadb/Util/PluginOutput.php b/library/Icingadb/Util/PluginOutput.php
index 71d08b1..03055a9 100644
--- a/library/Icingadb/Util/PluginOutput.php
+++ b/library/Icingadb/Util/PluginOutput.php
@@ -64,6 +64,9 @@ class PluginOutput extends HtmlString
/** @var bool Whether the output contains HTML */
protected $isHtml;
+ /** @var int The maximum amount of characters to process */
+ protected $characterLimit = 1000;
+
/** @var bool Whether output will be enriched */
protected $enrichOutput = true;
@@ -94,6 +97,20 @@ class PluginOutput extends HtmlString
}
/**
+ * Set the maximum amount of characters to process
+ *
+ * @param int $limit
+ *
+ * @return $this
+ */
+ public function setCharacterLimit(int $limit): self
+ {
+ $this->characterLimit = $limit;
+
+ return $this;
+ }
+
+ /**
* Set whether the output should be enriched
*
* @param bool $state
@@ -185,6 +202,10 @@ class PluginOutput extends HtmlString
$output = $this->processHtml($output);
}
+ if ($this->characterLimit) {
+ $output = substr($output, 0, $this->characterLimit);
+ }
+
$this->renderedOutput = $output;
return $output;
diff --git a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php
index b89e729..31b6483 100644
--- a/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php
+++ b/library/Icingadb/Web/Control/SearchBar/ObjectSuggestions.php
@@ -121,8 +121,12 @@ class ObjectSuggestions extends Suggestions
$quickFilter = Filter::any();
foreach ($model->getSearchColumns() as $column) {
- $where = Filter::like($resolver->qualifyColumn($column, $model->getTableName()), $searchTerm);
- $where->metaData()->set('columnLabel', $resolver->getColumnDefinition($where->getColumn())->getLabel());
+ if (strpos($column, '.') === false) {
+ $column = $resolver->qualifyColumn($column, $model->getTableName());
+ }
+
+ $where = Filter::like($column, $searchTerm);
+ $where->metaData()->set('columnLabel', $resolver->getColumnDefinition($column)->getLabel());
$quickFilter->add($where);
}
diff --git a/library/Icingadb/Web/Controller.php b/library/Icingadb/Web/Controller.php
index ad9f07e..ffa711a 100644
--- a/library/Icingadb/Web/Controller.php
+++ b/library/Icingadb/Web/Controller.php
@@ -307,10 +307,11 @@ class Controller extends CompatController
{
$columns = array_merge($query->getModel()->getSearchColumns(), $additionalColumns);
foreach ($columns as $column) {
- $filter->add(Filter::like(
- $query->getResolver()->qualifyColumn($column, $query->getModel()->getTableName()),
- "*$search*"
- ));
+ if (strpos($column, '.') === false) {
+ $column = $query->getResolver()->qualifyColumn($column, $query->getModel()->getTableName());
+ }
+
+ $filter->add(Filter::like($column, "*$search*"));
}
}
@@ -367,7 +368,10 @@ class Controller extends CompatController
// No matter the format, a limit should only apply if set
if ($this->format !== null) {
- $query->limit(Url::fromRequest()->getParam('limit'));
+ if (! Url::fromRequest()->hasParam('limit')) {
+ $query->limit(null)
+ ->offset(null);
+ }
}
if ($this->format === 'json' || $this->format === 'csv') {
@@ -512,7 +516,12 @@ class Controller extends CompatController
{
parent::preDispatch();
- $this->format = $this->params->shift('format');
+ $this->format = $this->params->shift(
+ 'format',
+ $this->getRequest()->isApiRequest()
+ ? 'json'
+ : null
+ );
}
public function postDispatch()
diff --git a/library/Icingadb/Web/Navigation/Action.php b/library/Icingadb/Web/Navigation/Action.php
index d02f933..449e9d2 100644
--- a/library/Icingadb/Web/Navigation/Action.php
+++ b/library/Icingadb/Web/Navigation/Action.php
@@ -113,7 +113,7 @@ class Action extends NavigationItem
public function getUrl(): ?\Icinga\Web\Url
{
$url = parent::getUrl();
- if (! $this->resolved && $url === null && $this->rawUrl !== null) {
+ if (! $this->resolved && $url === null && $this->rawUrl !== null && $this->object !== null) {
$this->setUrl(Url::fromPath($this->expandMacros($this->rawUrl, $this->getObject())));
$this->resolved = true;
return parent::getUrl();
diff --git a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php
index 658fa1c..5e0f555 100644
--- a/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php
+++ b/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php
@@ -52,7 +52,7 @@ abstract class ProblemsBadge extends NavigationItemRenderer
return $this->count;
}
- $this->count = $this->round($count);
+ $this->count = $count;
$this->setState(static::STATE_CRITICAL);
}
@@ -146,7 +146,7 @@ abstract class ProblemsBadge extends NavigationItemRenderer
$count = $this->getProblemsCount();
if ($count) {
- return (new StateBadge($count, $this->getState()))
+ return (new StateBadge($this->round($count), $this->getState()))
->addAttributes(['class' => 'badge', 'title' => $this->getTitle()]);
}
diff --git a/library/Icingadb/Widget/Detail/DowntimeCard.php b/library/Icingadb/Widget/Detail/DowntimeCard.php
index 81f59da..8184479 100644
--- a/library/Icingadb/Widget/Detail/DowntimeCard.php
+++ b/library/Icingadb/Widget/Detail/DowntimeCard.php
@@ -35,7 +35,7 @@ class DowntimeCard extends BaseHtmlElement
$this->start = $this->downtime->scheduled_start_time->getTimestamp();
$this->end = $this->downtime->scheduled_end_time->getTimestamp();
- if ($this->downtime->end_time > $this->downtime->scheduled_end_time) {
+ if ($this->downtime->end_time && $this->downtime->end_time > $this->downtime->scheduled_end_time) {
$this->duration = $this->downtime->end_time->getTimestamp() - $this->start;
} else {
$this->duration = $this->end - $this->start;
diff --git a/library/Icingadb/Widget/Detail/EventDetail.php b/library/Icingadb/Widget/Detail/EventDetail.php
index 181c9ae..aaf7608 100644
--- a/library/Icingadb/Widget/Detail/EventDetail.php
+++ b/library/Icingadb/Widget/Detail/EventDetail.php
@@ -366,7 +366,7 @@ class EventDetail extends BaseHtmlElement
}
$cancelInfo = [];
- if ($downtime->has_been_cancelled) {
+ if ($downtime->has_been_cancelled && $downtime->cancel_time) {
$cancelInfo = [
new HtmlElement('h2', null, Text::create(t('This downtime has been cancelled'))),
new HorizontalKeyValue(
@@ -430,7 +430,7 @@ class EventDetail extends BaseHtmlElement
}
$removedInfo = [];
- if ($comment->has_been_removed) {
+ if ($comment->has_been_removed && $comment->remove_time) {
$removedInfo[] = new HtmlElement('h2', null, Text::create(t('This comment has been removed')));
if ($comment->removed_by) {
$removedInfo[] = new HorizontalKeyValue(
@@ -487,7 +487,7 @@ class EventDetail extends BaseHtmlElement
$flapping->percent_state_change_start,
$flapping->flapping_threshold_high
));
- } else {
+ } elseif ($flapping->end_time !== null) {
$eventInfo[] = new HorizontalKeyValue(
t('Ended on'),
DateFormatter::formatDateTime($flapping->end_time->getTimestamp())
@@ -567,7 +567,7 @@ class EventDetail extends BaseHtmlElement
if ($acknowledgement->cleared_by) {
$eventInfo[] = new HorizontalKeyValue(
t('Cleared by'),
- [new Icon('user', $acknowledgement->cleared_by)]
+ [new Icon('user'), $acknowledgement->cleared_by]
);
} else {
$expired = false;
diff --git a/library/Icingadb/Widget/Detail/MultiselectQuickActions.php b/library/Icingadb/Widget/Detail/MultiselectQuickActions.php
index f398d80..b80ec9d 100644
--- a/library/Icingadb/Widget/Detail/MultiselectQuickActions.php
+++ b/library/Icingadb/Widget/Detail/MultiselectQuickActions.php
@@ -67,6 +67,7 @@ class MultiselectQuickActions extends BaseHtmlElement
) {
$removeAckForm = (new RemoveAcknowledgementForm())
->setAction($this->getLink('removeAcknowledgement'))
+ // TODO: This is a hack as for the button label the count of objects is used. setCount? setMultiple?
->setObjects(array_fill(0, $this->summary->$acks, null));
$this->add(Html::tag('li', $removeAckForm));
diff --git a/library/Icingadb/Widget/Detail/ObjectDetail.php b/library/Icingadb/Widget/Detail/ObjectDetail.php
index a688173..4ba0e69 100644
--- a/library/Icingadb/Widget/Detail/ObjectDetail.php
+++ b/library/Icingadb/Widget/Detail/ObjectDetail.php
@@ -423,7 +423,10 @@ class ObjectDetail extends BaseHtmlElement
if (empty($this->object->state->output) && empty($this->object->state->long_output)) {
$pluginOutput = new EmptyState(t('Output unavailable.'));
} else {
- $pluginOutput = new PluginOutputContainer(PluginOutput::fromObject($this->object));
+ $pluginOutput = new PluginOutputContainer(
+ PluginOutput::fromObject($this->object)
+ ->setCharacterLimit(10000)
+ );
CopyToClipboard::attachTo($pluginOutput);
}
diff --git a/library/Icingadb/Widget/HostSummaryDonut.php b/library/Icingadb/Widget/HostSummaryDonut.php
index db5fef8..5efcf74 100644
--- a/library/Icingadb/Widget/HostSummaryDonut.php
+++ b/library/Icingadb/Widget/HostSummaryDonut.php
@@ -47,7 +47,7 @@ class HostSummaryDonut extends Card
->addSlice($this->summary->hosts_down_handled, ['class' => 'slice-state-critical-handled'])
->addSlice($this->summary->hosts_down_unhandled, ['class' => 'slice-state-critical'])
->addSlice($this->summary->hosts_pending, ['class' => 'slice-state-pending'])
- ->setLabelBig($this->summary->hosts_down_unhandled)
+ ->setLabelBig((string) $this->summary->hosts_down_unhandled)
->setLabelBigUrl(Links::hosts()->setFilter($labelBigUrlFilter)->addParams([
'sort' => 'host.state.last_state_change'
]))
diff --git a/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php b/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
index 7ebc1f6..dedaa72 100644
--- a/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
+++ b/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
@@ -56,7 +56,11 @@ abstract class BaseDowntimeListItem extends BaseListItem
protected function init(): void
{
- if ($this->item->is_flexible && $this->item->is_in_effect) {
+ if (
+ isset($this->item->start_time, $this->item->end_time)
+ && $this->item->is_flexible
+ && $this->item->is_in_effect
+ ) {
$this->startTime = $this->item->start_time->getTimestamp();
$this->endTime = $this->item->end_time->getTimestamp();
} else {
diff --git a/library/Icingadb/Widget/ItemList/HostDetailHeader.php b/library/Icingadb/Widget/ItemList/HostDetailHeader.php
index 97176da..b7afb23 100644
--- a/library/Icingadb/Widget/ItemList/HostDetailHeader.php
+++ b/library/Icingadb/Widget/ItemList/HostDetailHeader.php
@@ -50,7 +50,9 @@ class HostDetailHeader extends HostListItemMinimal
}
$stateChange->setIcon($this->state->getIcon());
- $stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable);
+ $stateChange->setHandled(
+ $this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)
+ );
$visual->addHtml($stateChange);
}
diff --git a/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php b/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php
index 2f0dbbd..8c5094d 100644
--- a/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php
+++ b/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php
@@ -50,7 +50,9 @@ class ServiceDetailHeader extends ServiceListItemMinimal
}
$stateChange->setIcon($this->state->getIcon());
- $stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable);
+ $stateChange->setHandled(
+ $this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)
+ );
$visual->addHtml($stateChange);
}
diff --git a/library/Icingadb/Widget/ItemList/StateList.php b/library/Icingadb/Widget/ItemList/StateList.php
index 1e6dcb9..9671c97 100644
--- a/library/Icingadb/Widget/ItemList/StateList.php
+++ b/library/Icingadb/Widget/ItemList/StateList.php
@@ -53,7 +53,7 @@ abstract class StateList extends BaseItemList
if ($this->data instanceof VolatileStateResults && $this->data->isRedisUnavailable()) {
$this->prependWrapper((new HtmlDocument())->addHtml(new Notice(
- t('Icinga Redis is currently unavailable. The shown information might be outdated.')
+ t('Redis is currently unavailable. The shown information might be outdated.')
)));
}
}
diff --git a/library/Icingadb/Widget/ItemList/StateListItem.php b/library/Icingadb/Widget/ItemList/StateListItem.php
index d0b3363..cd8ff16 100644
--- a/library/Icingadb/Widget/ItemList/StateListItem.php
+++ b/library/Icingadb/Widget/ItemList/StateListItem.php
@@ -99,7 +99,7 @@ abstract class StateListItem extends BaseListItem
{
$stateBall = new StateBall($this->state->getStateText(), $this->getStateBallSize());
$stateBall->add($this->state->getIcon());
- if ($this->state->is_handled || ! $this->state->is_reachable) {
+ if ($this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)) {
$stateBall->getAttributes()->add('class', 'handled');
}
diff --git a/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php b/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
index c56a1f8..b3099c8 100644
--- a/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
+++ b/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
@@ -5,7 +5,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
use Icinga\Module\Icingadb\Common\Links;
-use Icinga\Module\Icingadb\Model\Hostgroup;
+use Icinga\Module\Icingadb\Model\Hostgroupsummary;
use ipl\Html\Attributes;
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
@@ -18,7 +18,7 @@ use ipl\Web\Widget\Link;
/**
* Hostgroup item of a hostgroup list. Represents one database row.
*
- * @property Hostgroup $item
+ * @property Hostgroupsummary $item
* @property HostgroupTable $table
*/
abstract class BaseHostGroupItem extends BaseTableRowItem
diff --git a/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php b/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
index 7bee532..24f0bea 100644
--- a/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
+++ b/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
@@ -5,7 +5,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
use Icinga\Module\Icingadb\Common\Links;
-use Icinga\Module\Icingadb\Model\Servicegroup;
+use Icinga\Module\Icingadb\Model\ServicegroupSummary;
use ipl\Html\Attributes;
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
@@ -18,7 +18,7 @@ use ipl\Web\Widget\Link;
/**
* Servicegroup item of a servicegroup list. Represents one database row.
*
- * @property Servicegroup $item
+ * @property ServicegroupSummary $item
* @property ServicegroupTable $table
*/
abstract class BaseServiceGroupItem extends BaseTableRowItem
diff --git a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
index 6aa61c2..cb3f06a 100644
--- a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
+++ b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
@@ -4,7 +4,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
-use Icinga\Module\Icingadb\Model\Hostgroup;
+use Icinga\Module\Icingadb\Model\Hostgroupsummary;
use Icinga\Module\Icingadb\Widget\Detail\HostStatistics;
use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics;
use ipl\Html\BaseHtmlElement;
@@ -13,7 +13,7 @@ use ipl\Stdlib\Filter;
/**
* Hostgroup table row of a hostgroup table. Represents one database row.
*
- * @property Hostgroup $item
+ * @property Hostgroupsummary $item
* @property HostgroupTable $table
*/
class HostgroupTableRow extends BaseHostGroupItem
diff --git a/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php b/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
index 3dea4c1..e34c029 100644
--- a/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
+++ b/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
@@ -4,7 +4,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
-use Icinga\Module\Icingadb\Model\Servicegroup;
+use Icinga\Module\Icingadb\Model\ServicegroupSummary;
use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics;
use ipl\Html\BaseHtmlElement;
use ipl\Stdlib\Filter;
@@ -12,7 +12,7 @@ use ipl\Stdlib\Filter;
/**
* Servicegroup item of a servicegroup list. Represents one database row.
*
- * @property Servicegroup $item
+ * @property ServicegroupSummary $item
* @property ServicegroupTable $table
*/
class ServicegroupTableRow extends BaseServiceGroupItem
diff --git a/library/Icingadb/Widget/ItemTable/StateRowItem.php b/library/Icingadb/Widget/ItemTable/StateRowItem.php
index f62286b..7ca9392 100644
--- a/library/Icingadb/Widget/ItemTable/StateRowItem.php
+++ b/library/Icingadb/Widget/ItemTable/StateRowItem.php
@@ -33,7 +33,7 @@ abstract class StateRowItem extends BaseStateRowItem
$stateBall = new StateBall($this->item->state->getStateText(), StateBall::SIZE_LARGE);
$stateBall->add($this->item->state->getIcon());
- if ($this->item->state->is_handled) {
+ if ($this->item->state->is_problem && ($this->item->state->is_handled || ! $this->item->state->is_reachable)) {
$stateBall->getAttributes()->add('class', 'handled');
}
diff --git a/library/Icingadb/Widget/ServiceSummaryDonut.php b/library/Icingadb/Widget/ServiceSummaryDonut.php
index e806fba..e6b38a1 100644
--- a/library/Icingadb/Widget/ServiceSummaryDonut.php
+++ b/library/Icingadb/Widget/ServiceSummaryDonut.php
@@ -50,7 +50,7 @@ class ServiceSummaryDonut extends Card
->addSlice($this->summary->services_unknown_handled, ['class' => 'slice-state-unknown-handled'])
->addSlice($this->summary->services_unknown_unhandled, ['class' => 'slice-state-unknown'])
->addSlice($this->summary->services_pending, ['class' => 'slice-state-pending'])
- ->setLabelBig($this->summary->services_critical_unhandled)
+ ->setLabelBig((string) $this->summary->services_critical_unhandled)
->setLabelBigUrl(Links::services()->setFilter($labelBigUrlFilter)->addParams([
'sort' => 'service.state.last_state_change'
]))
diff --git a/module.info b/module.info
index c86c744..b77e7ce 100644
--- a/module.info
+++ b/module.info
@@ -1,6 +1,6 @@
Module: icingadb
-Version: 1.1.1
+Version: 1.1.2
Requires:
- Libraries: icinga-php-library (>=0.13.0), icinga-php-thirdparty (>=0.12.0)
+ Libraries: icinga-php-library (>=0.13.2), icinga-php-thirdparty (>=0.12.0)
Description: Icinga DB Web
UI for Icinga DB – Provides a graphical interface to your Icinga monitoring
diff --git a/phpstan-baseline-7x.neon b/phpstan-baseline-7x.neon
new file mode 100644
index 0000000..6da3525
--- /dev/null
+++ b/phpstan-baseline-7x.neon
@@ -0,0 +1,116 @@
+parameters:
+ ignoreErrors:
+ -
+ message: "#^Parameter \\#1 \\$data of function hex2bin expects string, mixed given\\.$#"
+ count: 1
+ path: application/controllers/EventController.php
+
+ -
+ message: "#^Parameter \\#1 \\$str of function md5 expects string, mixed given\\.$#"
+ count: 1
+ path: application/forms/RedisConfigForm.php
+
+ -
+ message: "#^Parameter \\#1 \\$stack of function array_pop expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Command/Transport/ApiCommandTransport.php
+
+ -
+ message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Common/IcingaRedis.php
+
+ -
+ message: "#^Parameter \\#1 \\$arr1 of function array_diff_key expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Common/ObjectInspectionDetail.php
+
+ -
+ message: "#^Parameter \\#1 \\$data of function bin2hex expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Common/ObjectInspectionDetail.php
+
+ -
+ message: "#^Parameter \\#1 \\$str of function strtolower expects string, mixed given\\.$#"
+ count: 2
+ path: library/Icingadb/Compat/UrlMigrator.php
+
+ -
+ message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/CsvResultSet.php
+
+ -
+ message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/CsvResultSet.php
+
+ -
+ message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/PivotTable.php
+
+ -
+ message: "#^Parameter \\#1 \\$input of function array_keys expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Parameter \\#1 \\$input of function array_values expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php
+
+ -
+ message: "#^Parameter \\#2 \\.\\.\\.\\$args of function array_merge expects array, array\\<int, string\\>\\|false given\\.$#"
+ count: 1
+ path: library/Icingadb/Model/CustomvarFlat.php
+
+ -
+ message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#"
+ count: 1
+ path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php
+
+ -
+ message: "#^Parameter \\#1 \\$number of function number_format expects float, float\\|int\\|string given\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PerfData.php
+
+ -
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:render\\(\\) should return string but returns string\\|false\\|null\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PluginOutput.php
+
+ -
+ message: "#^Parameter \\#1 \\$str of function trim expects string, string\\|null given\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PluginOutput.php
+
+ -
+ message: "#^Parameter \\#3 \\$encoding of function htmlspecialchars expects string, null given\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PluginOutput.php
+
+ -
+ message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:\\$renderedOutput \\(string\\) does not accept string\\|false\\|null\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PluginOutput.php
+
+ -
+ message: "#^Parameter \\#1 \\$str of function trim expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Web/Controller.php
+
+ -
+ message: "#^Parameter \\#2 \\$str of function explode expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Web/Controller.php
+
+ -
+ message: "#^Parameter \\#1 \\$objects of method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:setObjects\\(\\) expects array\\<ipl\\\\Orm\\\\Model\\>\\|\\(Countable&Traversable\\<mixed, ipl\\\\Orm\\\\Model\\>\\), array\\<int, null\\>\\|false given\\.$#"
+ count: 1
+ path: library/Icingadb/Widget/Detail/MultiselectQuickActions.php
diff --git a/phpstan-baseline-8x.neon b/phpstan-baseline-8x.neon
new file mode 100644
index 0000000..b5b85f7
--- /dev/null
+++ b/phpstan-baseline-8x.neon
@@ -0,0 +1,111 @@
+parameters:
+ ignoreErrors:
+ -
+ message: "#^Parameter \\#1 \\$string of function hex2bin expects string, mixed given\\.$#"
+ count: 1
+ path: application/controllers/EventController.php
+
+ -
+ message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#"
+ count: 1
+ path: application/forms/RedisConfigForm.php
+
+ -
+ message: "#^Parameter \\#1 \\$array of function array_pop expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Command/Transport/ApiCommandTransport.php
+
+ -
+ message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Common/IcingaRedis.php
+
+ -
+ message: "#^Parameter \\#1 \\$array of function array_diff_key expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Common/ObjectInspectionDetail.php
+
+ -
+ message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Common/ObjectInspectionDetail.php
+
+ -
+ message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
+ count: 2
+ path: library/Icingadb/Compat/UrlMigrator.php
+
+ -
+ message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/CsvResultSet.php
+
+ -
+ message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/CsvResultSet.php
+
+ -
+ message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/PivotTable.php
+
+ -
+ message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php
+
+ -
+ message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\<int, string\\>\\|false given\\.$#"
+ count: 1
+ path: library/Icingadb/Model/CustomvarFlat.php
+
+ -
+ message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#"
+ count: 1
+ path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php
+
+ -
+ message: "#^Parameter \\#1 \\$num of function number_format expects float, float\\|int\\|string given\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PerfData.php
+
+ -
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:render\\(\\) should return string but returns string\\|null\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PluginOutput.php
+
+ -
+ message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PluginOutput.php
+
+ -
+ message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:\\$renderedOutput \\(string\\) does not accept string\\|null\\.$#"
+ count: 1
+ path: library/Icingadb/Util/PluginOutput.php
+
+ -
+ message: "#^Parameter \\#1 \\$string of function trim expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Web/Controller.php
+
+ -
+ message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Web/Controller.php
+
+ -
+ message: "#^Parameter \\#1 \\$objects of method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:setObjects\\(\\) expects array\\<ipl\\\\Orm\\\\Model\\>\\|\\(Countable&Traversable\\<mixed, ipl\\\\Orm\\\\Model\\>\\), array\\<int, null\\> given\\.$#"
+ count: 1
+ path: library/Icingadb/Widget/Detail/MultiselectQuickActions.php
diff --git a/phpstan-baseline-by-php-version.php b/phpstan-baseline-by-php-version.php
new file mode 100644
index 0000000..4bd791e
--- /dev/null
+++ b/phpstan-baseline-by-php-version.php
@@ -0,0 +1,12 @@
+<?php
+
+$includes = [];
+if (PHP_VERSION_ID >= 80000) {
+ $includes[] = __DIR__ . '/phpstan-baseline-8x.neon';
+} else {
+ $includes[] = __DIR__ . '/phpstan-baseline-7x.neon';
+}
+
+return [
+ 'includes' => $includes
+];
diff --git a/phpstan-baseline.neon b/phpstan-baseline-standard.neon
index 262245d..5d23e82 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline-standard.neon
@@ -121,16 +121,6 @@ parameters:
path: application/controllers/CommentController.php
-
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\CommentController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) does not accept array\\.$#"
- count: 1
- path: application/controllers/CommentController.php
-
- -
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\CommentController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) in isset\\(\\) is not nullable\\.$#"
- count: 1
- path: application/controllers/CommentController.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\CommentController\\:\\:\\$comment \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Comment\\) does not accept ipl\\\\Orm\\\\Model\\.$#"
count: 1
path: application/controllers/CommentController.php
@@ -261,16 +251,6 @@ parameters:
path: application/controllers/DowntimeController.php
-
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\DowntimeController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) does not accept array\\.$#"
- count: 1
- path: application/controllers/DowntimeController.php
-
- -
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\DowntimeController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) in isset\\(\\) is not nullable\\.$#"
- count: 1
- path: application/controllers/DowntimeController.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\DowntimeController\\:\\:\\$downtime \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Downtime\\) does not accept ipl\\\\Orm\\\\Model\\.$#"
count: 1
path: application/controllers/DowntimeController.php
@@ -331,11 +311,6 @@ parameters:
path: application/controllers/EventController.php
-
- message: "#^Parameter \\#1 \\$string of function hex2bin expects string, mixed given\\.$#"
- count: 1
- path: application/controllers/EventController.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\EventController\\:\\:\\$event \\(Icinga\\\\Module\\\\Icingadb\\\\Model\\\\History\\) does not accept ipl\\\\Orm\\\\Model\\|null\\.$#"
count: 1
path: application/controllers/EventController.php
@@ -496,11 +471,6 @@ parameters:
path: application/controllers/HostController.php
-
- message: "#^Parameter \\#1 \\$title of method ipl\\\\Web\\\\Compat\\\\CompatController\\:\\:setTitle\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: application/controllers/HostController.php
-
- -
message: "#^Parameter \\#2 \\$apiResult of class Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\HostInspectionDetail constructor expects array, mixed given\\.$#"
count: 1
path: application/controllers/HostController.php
@@ -522,7 +492,7 @@ parameters:
-
message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 4
+ count: 1
path: application/controllers/HostController.php
-
@@ -536,16 +506,6 @@ parameters:
path: application/controllers/HostController.php
-
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\HostController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) does not accept array\\.$#"
- count: 1
- path: application/controllers/HostController.php
-
- -
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\HostController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) in isset\\(\\) is not nullable\\.$#"
- count: 1
- path: application/controllers/HostController.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\HostgroupController\\:\\:indexAction\\(\\) has no return type specified\\.$#"
count: 1
path: application/controllers/HostgroupController.php
@@ -557,7 +517,7 @@ parameters:
-
message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
+ count: 1
path: application/controllers/HostgroupController.php
-
@@ -706,11 +666,6 @@ parameters:
path: application/controllers/HostsController.php
-
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\HostsController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) in isset\\(\\) is not nullable\\.$#"
- count: 1
- path: application/controllers/HostsController.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\MigrateController\\:\\:backendSupportAction\\(\\) has no return type specified\\.$#"
count: 1
path: application/controllers/MigrateController.php
@@ -917,7 +872,7 @@ parameters:
-
message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 4
+ count: 2
path: application/controllers/ServiceController.php
-
@@ -931,16 +886,6 @@ parameters:
path: application/controllers/ServiceController.php
-
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\ServiceController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) does not accept array\\.$#"
- count: 1
- path: application/controllers/ServiceController.php
-
- -
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\ServiceController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) in isset\\(\\) is not nullable\\.$#"
- count: 1
- path: application/controllers/ServiceController.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\ServicegroupController\\:\\:indexAction\\(\\) has no return type specified\\.$#"
count: 1
path: application/controllers/ServicegroupController.php
@@ -952,7 +897,7 @@ parameters:
-
message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
+ count: 1
path: application/controllers/ServicegroupController.php
-
@@ -1141,11 +1086,6 @@ parameters:
path: application/controllers/ServicesController.php
-
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\ServicesController\\:\\:\\$commandTargets \\(ipl\\\\Orm\\\\Query\\) in isset\\(\\) is not nullable\\.$#"
- count: 1
- path: application/controllers/ServicesController.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Controllers\\\\TacticalController\\:\\:completeAction\\(\\) has no return type specified\\.$#"
count: 1
path: application/controllers/TacticalController.php
@@ -1271,11 +1211,6 @@ parameters:
path: application/forms/Command/CommandForm.php
-
- message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:filterGrantedOn\\(\\) has parameter \\$objects with no value type specified in iterable type Traversable\\.$#"
- count: 1
- path: application/forms/Command/CommandForm.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:onSuccess\\(\\) has no return type specified\\.$#"
count: 1
path: application/forms/Command/CommandForm.php
@@ -1296,11 +1231,6 @@ parameters:
path: application/forms/Command/CommandForm.php
-
- message: "#^Parameter \\#1 \\$objects of method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:getCommands\\(\\) expects Traversable\\<mixed, ipl\\\\Orm\\\\Model\\>, mixed given\\.$#"
- count: 1
- path: application/forms/Command/CommandForm.php
-
- -
message: "#^Parameter \\#1 \\$queryString of method Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\CommandForm\\:\\:parseRestriction\\(\\) expects string, array\\<string\\> given\\.$#"
count: 3
path: application/forms/Command/CommandForm.php
@@ -1361,16 +1291,6 @@ parameters:
path: application/forms/Command/Object/AcknowledgeProblemForm.php
-
- message: "#^Parameter \\#1 \\$iterable of function ipl\\\\Stdlib\\\\iterable_value_first expects iterable, mixed given\\.$#"
- count: 1
- path: application/forms/Command/Object/AcknowledgeProblemForm.php
-
- -
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/AcknowledgeProblemForm.php
-
- -
message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#"
count: 1
path: application/forms/Command/Object/AddCommentForm.php
@@ -1391,66 +1311,16 @@ parameters:
path: application/forms/Command/Object/AddCommentForm.php
-
- message: "#^Parameter \\#1 \\$iterable of function ipl\\\\Stdlib\\\\iterable_value_first expects iterable, mixed given\\.$#"
- count: 1
- path: application/forms/Command/Object/AddCommentForm.php
-
- -
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/AddCommentForm.php
-
- -
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 1
- path: application/forms/Command/Object/CheckNowForm.php
-
- -
message: "#^Cannot call method getUsername\\(\\) on Icinga\\\\User\\|null\\.$#"
count: 1
path: application/forms/Command/Object/DeleteCommentForm.php
-
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/DeleteCommentForm.php
-
- -
- message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
- count: 1
- path: application/forms/Command/Object/DeleteDowntimeForm.php
-
- -
- message: "#^Cannot access property \\$scheduled_by on mixed\\.$#"
- count: 1
- path: application/forms/Command/Object/DeleteDowntimeForm.php
-
- -
message: "#^Cannot call method getUsername\\(\\) on Icinga\\\\User\\|null\\.$#"
count: 1
path: application/forms/Command/Object/DeleteDowntimeForm.php
-
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/DeleteDowntimeForm.php
-
- -
- message: "#^Cannot access property \\$passive_checks_enabled on mixed\\.$#"
- count: 1
- path: application/forms/Command/Object/ProcessCheckResultForm.php
-
- -
- message: "#^Parameter \\#1 \\$iterable of function ipl\\\\Stdlib\\\\iterable_value_first expects iterable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/ProcessCheckResultForm.php
-
- -
- message: "#^Parameter \\#1 \\$objects of method Icinga\\\\Module\\\\Icingadb\\\\Command\\\\Object\\\\ObjectsCommand\\:\\:setObjects\\(\\) expects Traversable\\<mixed, ipl\\\\Orm\\\\Model\\>, Generator\\<int, mixed, mixed, void\\> given\\.$#"
- count: 1
- path: application/forms/Command/Object/ProcessCheckResultForm.php
-
- -
message: "#^Parameter \\#1 \\$output of method Icinga\\\\Module\\\\Icingadb\\\\Command\\\\Object\\\\ProcessCheckResultCommand\\:\\:setOutput\\(\\) expects string, mixed given\\.$#"
count: 1
path: application/forms/Command/Object/ProcessCheckResultForm.php
@@ -1466,26 +1336,11 @@ parameters:
path: application/forms/Command/Object/ProcessCheckResultForm.php
-
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/ProcessCheckResultForm.php
-
- -
message: "#^Cannot call method getUsername\\(\\) on Icinga\\\\User\\|null\\.$#"
count: 1
path: application/forms/Command/Object/RemoveAcknowledgementForm.php
-
- message: "#^Parameter \\#1 \\$iterable of function ipl\\\\Stdlib\\\\iterable_value_first expects iterable, mixed given\\.$#"
- count: 1
- path: application/forms/Command/Object/RemoveAcknowledgementForm.php
-
- -
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/RemoveAcknowledgementForm.php
-
- -
message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#"
count: 1
path: application/forms/Command/Object/ScheduleCheckForm.php
@@ -1496,16 +1351,6 @@ parameters:
path: application/forms/Command/Object/ScheduleCheckForm.php
-
- message: "#^Parameter \\#1 \\$iterable of function ipl\\\\Stdlib\\\\iterable_value_first expects iterable, mixed given\\.$#"
- count: 1
- path: application/forms/Command/Object/ScheduleCheckForm.php
-
- -
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/ScheduleCheckForm.php
-
- -
message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#"
count: 2
path: application/forms/Command/Object/ScheduleHostDowntimeForm.php
@@ -1536,11 +1381,6 @@ parameters:
path: application/forms/Command/Object/ScheduleHostDowntimeForm.php
-
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 1
- path: application/forms/Command/Object/ScheduleHostDowntimeForm.php
-
- -
message: "#^Call to an undefined method ipl\\\\Html\\\\Contract\\\\FormElement\\:\\:isChecked\\(\\)\\.$#"
count: 1
path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php
@@ -1571,11 +1411,6 @@ parameters:
path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php
-
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Forms\\\\Command\\\\Object\\\\ScheduleServiceDowntimeForm\\:\\:\\$flexibleEnd has no type specified\\.$#"
count: 1
path: application/forms/Command/Object/ScheduleServiceDowntimeForm.php
@@ -1596,16 +1431,6 @@ parameters:
path: application/forms/Command/Object/SendCustomNotificationForm.php
-
- message: "#^Parameter \\#1 \\$iterable of function ipl\\\\Stdlib\\\\iterable_value_first expects iterable, mixed given\\.$#"
- count: 1
- path: application/forms/Command/Object/SendCustomNotificationForm.php
-
- -
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
- count: 2
- path: application/forms/Command/Object/SendCustomNotificationForm.php
-
- -
message: "#^Cannot call method getAttributes\\(\\) on ipl\\\\Html\\\\Contract\\\\Wrappable\\|null\\.$#"
count: 1
path: application/forms/Command/Object/ToggleObjectFeaturesForm.php
@@ -1836,11 +1661,6 @@ parameters:
path: application/forms/RedisConfigForm.php
-
- message: "#^Parameter \\#1 \\$string of function md5 expects string, mixed given\\.$#"
- count: 1
- path: application/forms/RedisConfigForm.php
-
- -
message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
count: 1
path: application/forms/RedisConfigForm.php
@@ -2006,11 +1826,6 @@ parameters:
path: library/Icingadb/Command/Renderer/IcingaApiCommandRenderer.php
-
- message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Command/Renderer/IcingaApiCommandRenderer.php
-
- -
message: "#^Cannot access offset 'code' on mixed\\.$#"
count: 1
path: library/Icingadb/Command/Transport/ApiCommandTransport.php
@@ -2041,16 +1856,6 @@ parameters:
path: library/Icingadb/Command/Transport/ApiCommandTransport.php
-
- message: "#^Parameter \\#1 \\$array of function array_pop expects array, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Command/Transport/ApiCommandTransport.php
-
- -
- message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Command/Transport/CommandTransport.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Command\\\\Transport\\\\CommandTransportConfig\\:\\:\\$configs type has no value type specified in iterable type array\\.$#"
count: 1
path: library/Icingadb/Command/Transport/CommandTransportConfig.php
@@ -2116,11 +1921,6 @@ parameters:
path: library/Icingadb/Common/IcingaRedis.php
-
- message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Common/IcingaRedis.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\Links\\:\\:hostgroup\\(\\) has parameter \\$hostgroup with no type specified\\.$#"
count: 1
path: library/Icingadb/Common/Links.php
@@ -2131,11 +1931,6 @@ parameters:
path: library/Icingadb/Common/Links.php
-
- message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Common/Links.php
-
- -
message: "#^Call to an undefined method Predis\\\\Client\\:\\:hGet\\(\\)\\.$#"
count: 1
path: library/Icingadb/Common/ObjectInspectionDetail.php
@@ -2216,21 +2011,11 @@ parameters:
path: library/Icingadb/Common/ObjectInspectionDetail.php
-
- message: "#^Parameter \\#1 \\$array of function array_diff_key expects array, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Common/ObjectInspectionDetail.php
-
- -
message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Table\\:\\:td\\(\\) expects array\\|ipl\\\\Html\\\\Html\\|string\\|null, mixed given\\.$#"
count: 1
path: library/Icingadb/Common/ObjectInspectionDetail.php
-
- message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Common/ObjectInspectionDetail.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Common\\\\ObjectInspectionDetail\\:\\:\\$attrs type has no value type specified in iterable type array\\.$#"
count: 1
path: library/Icingadb/Common/ObjectInspectionDetail.php
@@ -2381,11 +2166,6 @@ parameters:
path: library/Icingadb/Compat/CompatHost.php
-
- message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatHost\\:\\:getBoolType\\(\\) never returns null so it can be removed from the return type\\.$#"
- count: 1
- path: library/Icingadb/Compat/CompatHost.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatHost\\:\\:getName\\(\\) should return string but returns mixed\\.$#"
count: 1
path: library/Icingadb/Compat/CompatHost.php
@@ -2611,11 +2391,6 @@ parameters:
path: library/Icingadb/Compat/CompatService.php
-
- message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatService\\:\\:getBoolType\\(\\) never returns null so it can be removed from the return type\\.$#"
- count: 1
- path: library/Icingadb/Compat/CompatService.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatService\\:\\:getHost\\(\\) should return Icinga\\\\Module\\\\Icingadb\\\\Compat\\\\CompatHost but returns Icinga\\\\Module\\\\Monitoring\\\\Object\\\\Host\\.$#"
count: 1
path: library/Icingadb/Compat/CompatService.php
@@ -2826,11 +2601,6 @@ parameters:
path: library/Icingadb/Compat/UrlMigrator.php
-
- message: "#^Parameter \\#1 \\$string of function strtolower expects string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Compat/UrlMigrator.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\CsvResultSet\\:\\:extractKeysAndValues\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: library/Icingadb/Data/CsvResultSet.php
@@ -2841,16 +2611,6 @@ parameters:
path: library/Icingadb/Data/CsvResultSet.php
-
- message: "#^Parameter \\#1 \\$array of function array_keys expects array, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Data/CsvResultSet.php
-
- -
- message: "#^Parameter \\#1 \\$array of function array_values expects array, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Data/CsvResultSet.php
-
- -
message: "#^Parameter \\#1 \\$key of method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\CsvResultSet\\:\\:formatValue\\(\\) expects string, mixed given\\.$#"
count: 1
path: library/Icingadb/Data/CsvResultSet.php
@@ -2866,6 +2626,11 @@ parameters:
path: library/Icingadb/Data/JsonResultSet.php
-
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\JsonResultSet\\:\\:formatValue\\(\\) has no return type specified\\.$#"
+ count: 1
+ path: library/Icingadb/Data/JsonResultSet.php
+
+ -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\JsonResultSet\\:\\:formatValue\\(\\) has parameter \\$value with no type specified\\.$#"
count: 1
path: library/Icingadb/Data/JsonResultSet.php
@@ -2901,11 +2666,6 @@ parameters:
path: library/Icingadb/Data/PivotTable.php
-
- message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Data/PivotTable.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Data\\\\PivotTable\\:\\:\\$gridcols type has no value type specified in iterable type array\\.$#"
count: 1
path: library/Icingadb/Data/PivotTable.php
@@ -2926,6 +2686,51 @@ parameters:
path: library/Icingadb/Data/PivotTable.php
-
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileCsvResults\\:\\:extractKeysAndValues\\(\\) return type has no value type specified in iterable type array\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileCsvResults\\:\\:formatValue\\(\\) has parameter \\$value with no type specified\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Parameter \\#1 \\$key of method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileCsvResults\\:\\:formatValue\\(\\) expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Parameter \\#1 \\$model of method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileCsvResults\\:\\:extractKeysAndValues\\(\\) expects ipl\\\\Orm\\\\Model, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileCsvResults.php
+
+ -
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileJsonResults\\:\\:createObject\\(\\) return type has no value type specified in iterable type array\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileJsonResults.php
+
+ -
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileJsonResults\\:\\:formatValue\\(\\) has no return type specified\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileJsonResults.php
+
+ -
+ message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileJsonResults\\:\\:formatValue\\(\\) has parameter \\$value with no type specified\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileJsonResults.php
+
+ -
+ message: "#^Parameter \\#1 \\$key of method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileJsonResults\\:\\:formatValue\\(\\) expects string, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileJsonResults.php
+
+ -
+ message: "#^Parameter \\#1 \\$model of method Icinga\\\\Module\\\\Icingadb\\\\Data\\\\VolatileJsonResults\\:\\:createObject\\(\\) expects ipl\\\\Orm\\\\Model, mixed given\\.$#"
+ count: 1
+ path: library/Icingadb/Data/VolatileJsonResults.php
+
+ -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Hook\\\\ActionsHook\\\\ObjectActionsHook\\:\\:init\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Hook/ActionsHook/ObjectActionsHook.php
@@ -3101,11 +2906,6 @@ parameters:
path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php
-
- message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Model/Behavior/ActionAndNoteUrl.php
-
- -
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
count: 1
path: library/Icingadb/Model/Behavior/Bitmask.php
@@ -3196,11 +2996,6 @@ parameters:
path: library/Icingadb/Model/Behavior/FlattenedObjectVars.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:like\\(\\) expects array\\<string\\>\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Model/Behavior/FlattenedObjectVars.php
-
- -
message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, string\\|null given\\.$#"
count: 1
path: library/Icingadb/Model/Behavior/FlattenedObjectVars.php
@@ -3386,11 +3181,6 @@ parameters:
path: library/Icingadb/Model/CustomvarFlat.php
-
- message: "#^Parameter \\#2 \\.\\.\\.\\$arrays of function array_merge expects array, array\\<int, string\\>\\|false given\\.$#"
- count: 1
- path: library/Icingadb/Model/CustomvarFlat.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Downtime\\:\\:createBehaviors\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Model/Downtime.php
@@ -4386,11 +4176,6 @@ parameters:
path: library/Icingadb/ProvidedHook/ApplicationState.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/ProvidedHook/CreateHostSlaReport.php
-
- -
message: "#^Parameter \\#1 \\$rule of static method ipl\\\\Web\\\\Filter\\\\QueryString\\:\\:render\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 1
path: library/Icingadb/ProvidedHook/CreateHostsSlaReport.php
@@ -4401,11 +4186,6 @@ parameters:
path: library/Icingadb/ProvidedHook/CreateServiceSlaReport.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/ProvidedHook/CreateServiceSlaReport.php
-
- -
message: "#^Parameter \\#1 \\$rule of static method ipl\\\\Web\\\\Filter\\\\QueryString\\:\\:render\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 1
path: library/Icingadb/ProvidedHook/CreateServicesSlaReport.php
@@ -4421,11 +4201,6 @@ parameters:
path: library/Icingadb/ProvidedHook/IcingaHealth.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#"
- count: 3
- path: library/Icingadb/ProvidedHook/IcingaHealth.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\ProvidedHook\\\\IcingaHealth\\:\\:getInstance\\(\\) should return Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Instance\\|null but returns ipl\\\\Orm\\\\Model\\|null\\.$#"
count: 1
path: library/Icingadb/ProvidedHook/IcingaHealth.php
@@ -4596,11 +4371,6 @@ parameters:
path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php
-
- message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, Icinga\\\\Module\\\\Reporting\\\\ReportData\\|null given\\.$#"
- count: 1
- path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php
-
- -
message: "#^Parameter \\#2 \\$array of function join expects array\\<string\\>, array\\<int, \\(Closure\\)\\|string\\> given\\.$#"
count: 1
path: library/Icingadb/ProvidedHook/Reporting/SlaReport.php
@@ -4806,11 +4576,6 @@ parameters:
path: library/Icingadb/Redis/VolatileStateResults.php
-
- message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Redis/VolatileStateResults.php
-
- -
message: "#^Parameter \\#2 \\$array of function join expects array\\<string\\>, array\\<int, \\(Closure\\)\\|string\\> given\\.$#"
count: 1
path: library/Icingadb/Redis/VolatileStateResults.php
@@ -5031,11 +4796,6 @@ parameters:
path: library/Icingadb/Util/PerfData.php
-
- message: "#^Parameter \\#1 \\$num of function number_format expects float, float\\|int\\|string given\\.$#"
- count: 1
- path: library/Icingadb/Util/PerfData.php
-
- -
message: "#^Parameter \\#1 \\$value of method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\ThresholdRange\\:\\:contains\\(\\) expects float, float\\|null given\\.$#"
count: 2
path: library/Icingadb/Util/PerfData.php
@@ -5216,11 +4976,6 @@ parameters:
path: library/Icingadb/Util/PluginOutput.php
-
- message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:render\\(\\) should return string but returns string\\|null\\.$#"
- count: 1
- path: library/Icingadb/Util/PluginOutput.php
-
- -
message: "#^Parameter \\#1 \\$html of method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:processHtml\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: library/Icingadb/Util/PluginOutput.php
@@ -5231,11 +4986,6 @@ parameters:
path: library/Icingadb/Util/PluginOutput.php
-
- message: "#^Parameter \\#1 \\$name of method Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:setCommandName\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Util/PluginOutput.php
-
- -
message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|null given\\.$#"
count: 1
path: library/Icingadb/Util/PluginOutput.php
@@ -5247,12 +4997,7 @@ parameters:
-
message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|null given\\.$#"
- count: 2
- path: library/Icingadb/Util/PluginOutput.php
-
- -
- message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#"
- count: 1
+ count: 3
path: library/Icingadb/Util/PluginOutput.php
-
@@ -5261,11 +5006,6 @@ parameters:
path: library/Icingadb/Util/PluginOutput.php
-
- message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput\\:\\:\\$renderedOutput \\(string\\) does not accept string\\|null\\.$#"
- count: 1
- path: library/Icingadb/Util/PluginOutput.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Web\\\\Control\\\\GridViewModeSwitcher\\:\\:getTitle\\(\\) should return string but returns string\\|null\\.$#"
count: 1
path: library/Icingadb/Web/Control/GridViewModeSwitcher.php
@@ -5606,31 +5346,16 @@ parameters:
path: library/Icingadb/Web/Controller.php
-
- message: "#^Parameter \\#1 \\$limit of method ipl\\\\Orm\\\\Query\\:\\:limit\\(\\) expects int\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Web/Controller.php
-
- -
message: "#^Parameter \\#1 \\$queryString of method Icinga\\\\Module\\\\Icingadb\\\\Web\\\\Controller\\:\\:parseRestriction\\(\\) expects string, array\\<string\\> given\\.$#"
count: 3
path: library/Icingadb/Web/Controller.php
-
- message: "#^Parameter \\#1 \\$string of function trim expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Web/Controller.php
-
- -
message: "#^Parameter \\#2 \\$array of function join expects array\\<string\\>, array\\<int, \\(Closure\\)\\|string\\> given\\.$#"
count: 1
path: library/Icingadb/Web/Controller.php
-
- message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Web/Controller.php
-
- -
message: "#^Parameter \\#2 \\$tableName of method ipl\\\\Orm\\\\Resolver\\:\\:qualifyColumn\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\>\\|string given\\.$#"
count: 4
path: library/Icingadb/Web/Controller.php
@@ -6091,11 +5816,6 @@ parameters:
path: library/Icingadb/Widget/Detail/CustomVarTable.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#"
- count: 3
- path: library/Icingadb/Widget/Detail/DowntimeCard.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\DowntimeCard\\:\\:assemble\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/DowntimeCard.php
@@ -6186,11 +5906,6 @@ parameters:
path: library/Icingadb/Widget/Detail/DowntimeDetail.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#"
- count: 5
- path: library/Icingadb/Widget/Detail/DowntimeDetail.php
-
- -
message: "#^Cannot call method isUnrestricted\\(\\) on Icinga\\\\User\\|null\\.$#"
count: 4
path: library/Icingadb/Widget/Detail/DowntimeDetail.php
@@ -6231,11 +5946,6 @@ parameters:
path: library/Icingadb/Widget/Detail/DowntimeDetail.php
-
- message: "#^Parameter \\#1 \\$text of class Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\MarkdownText constructor expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/DowntimeDetail.php
-
- -
message: "#^Parameter \\#2 \\$array of function join expects array\\<string\\>, array\\<int, \\(Closure\\)\\|string\\> given\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/DowntimeDetail.php
@@ -6251,11 +5961,6 @@ parameters:
path: library/Icingadb/Widget/Detail/DowntimeDetail.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 5
- path: library/Icingadb/Widget/Detail/DowntimeDetail.php
-
- -
message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/EventDetail.php
@@ -6321,11 +6026,6 @@ parameters:
path: library/Icingadb/Widget/Detail/EventDetail.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#"
- count: 21
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
message: "#^Cannot call method isUnrestricted\\(\\) on Icinga\\\\User\\|null\\.$#"
count: 4
path: library/Icingadb/Widget/Detail/EventDetail.php
@@ -6401,11 +6101,6 @@ parameters:
path: library/Icingadb/Widget/Detail/EventDetail.php
-
- message: "#^Parameter \\#1 \\$content of class Icinga\\\\Module\\\\Icingadb\\\\Util\\\\PluginOutput constructor expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
message: "#^Parameter \\#1 \\$denylist of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\EventDetail\\:\\:parseDenylist\\(\\) expects string, array\\<string\\> given\\.$#"
count: 2
path: library/Icingadb/Widget/Detail/EventDetail.php
@@ -6431,41 +6126,16 @@ parameters:
path: library/Icingadb/Widget/Detail/EventDetail.php
-
- message: "#^Parameter \\#1 \\$state of static method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\HostStates\\:\\:text\\(\\) expects int\\|null, mixed given\\.$#"
- count: 6
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
- message: "#^Parameter \\#1 \\$state of static method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\ServiceStates\\:\\:text\\(\\) expects int\\|null, mixed given\\.$#"
- count: 6
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
message: "#^Parameter \\#1 \\$stateChange of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\EventDetail\\:\\:assembleStateChangeEvent\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\StateHistory, mixed given\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/EventDetail.php
-
- message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
- message: "#^Parameter \\#1 \\$subject of static method ipl\\\\Stdlib\\\\Str\\:\\:camel\\(\\) expects string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
message: "#^Parameter \\#2 \\$array of function join expects array\\<string\\>, array\\<int, \\(Closure\\)\\|string\\> given\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/EventDetail.php
-
- message: "#^Parameter \\#2 \\$attributes of class ipl\\\\Web\\\\Widget\\\\Icon constructor expects array\\|ipl\\\\Html\\\\Attributes\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
message: "#^Parameter \\#2 \\$tableName of method ipl\\\\Orm\\\\Resolver\\:\\:qualifyColumn\\(\\) expects string, int\\<min, \\-1\\>\\|int\\<1, max\\>\\|string given\\.$#"
count: 4
path: library/Icingadb/Widget/Detail/EventDetail.php
@@ -6476,21 +6146,6 @@ parameters:
path: library/Icingadb/Widget/Detail/EventDetail.php
-
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 5
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
- message: "#^Parameter \\#3 \\$number of function tp expects int\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
- message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 3
- path: library/Icingadb/Widget/Detail/EventDetail.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\HostDetail\\:\\:assemble\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/HostDetail.php
@@ -6961,11 +6616,6 @@ parameters:
path: library/Icingadb/Widget/Detail/QuickActions.php
-
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/QuickActions.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\ServiceDetail\\:\\:assemble\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/ServiceDetail.php
@@ -7111,16 +6761,6 @@ parameters:
path: library/Icingadb/Widget/Detail/UserDetail.php
-
- message: "#^Parameter \\#1 \\$states of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\UserDetail\\:\\:separateStates\\(\\) expects array, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/UserDetail.php
-
- -
- message: "#^Parameter \\#1 \\$types of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\Detail\\\\UserDetail\\:\\:localizeTypes\\(\\) expects array, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/Detail/UserDetail.php
-
- -
message: "#^Parameter \\#2 \\$array of function join expects array\\<string\\>, array\\<int, \\(Closure\\)\\|string\\> given\\.$#"
count: 1
path: library/Icingadb/Widget/Detail/UserDetail.php
@@ -7266,11 +6906,6 @@ parameters:
path: library/Icingadb/Widget/HostStatusBar.php
-
- message: "#^Cannot cast mixed to int\\.$#"
- count: 1
- path: library/Icingadb/Widget/HostSummaryDonut.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\HostSummaryDonut\\:\\:assembleBody\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/HostSummaryDonut.php
@@ -7286,16 +6921,6 @@ parameters:
path: library/Icingadb/Widget/HostSummaryDonut.php
-
- message: "#^Parameter \\#1 \\$data of method Icinga\\\\Chart\\\\Donut\\:\\:addSlice\\(\\) expects int, mixed given\\.$#"
- count: 4
- path: library/Icingadb/Widget/HostSummaryDonut.php
-
- -
- message: "#^Parameter \\#1 \\$labelBig of method Icinga\\\\Chart\\\\Donut\\:\\:setLabelBig\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/HostSummaryDonut.php
-
- -
message: "#^Parameter \\#1 \\$rule of method ipl\\\\Stdlib\\\\Filter\\\\Chain\\:\\:add\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 1
path: library/Icingadb/Widget/HostSummaryDonut.php
@@ -7306,11 +6931,6 @@ parameters:
path: library/Icingadb/Widget/IconImage.php
-
- message: "#^Cannot access offset 0 on mixed\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- -
message: "#^Cannot access property \\$host on mixed\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
@@ -7321,21 +6941,11 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseCommentListItem\\:\\:createTicketLinks\\(\\) has parameter \\$text with no type specified\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- -
message: "#^Parameter \\#1 \\$host of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseCommentListItem\\:\\:createHostLink\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, mixed given\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
@@ -7346,16 +6956,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- -
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseCommentListItem.php
-
- -
message: "#^Cannot access property \\$host on mixed\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
@@ -7366,21 +6966,11 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#"
- count: 5
- path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseDowntimeListItem\\:\\:createTicketLinks\\(\\) has parameter \\$text with no type specified\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
-
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
-
- -
message: "#^Parameter \\#1 \\$host of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseDowntimeListItem\\:\\:createHostLink\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, mixed given\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
@@ -7391,32 +6981,22 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
-
- -
message: "#^Property Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseDowntimeListItem\\:\\:\\$duration \\(int\\) does not accept string\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
-
message: "#^Access to an undefined property object\\:\\:\\$author\\.$#"
- count: 3
- path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- -
- message: "#^Access to an undefined property object\\:\\:\\$text\\.$#"
- count: 1
+ count: 4
path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- message: "#^Access to an undefined property object\\|object\\:\\:\\$author\\.$#"
+ message: "#^Access to an undefined property object\\:\\:\\$comment\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- message: "#^Access to an undefined property object\\|object\\:\\:\\$comment\\.$#"
+ message: "#^Access to an undefined property object\\:\\:\\$text\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
@@ -7551,11 +7131,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on mixed\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseHistoryListItem\\:\\:createTicketLinks\\(\\) has parameter \\$text with no type specified\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
@@ -7571,31 +7146,11 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- message: "#^Parameter \\#1 \\$string of function bin2hex expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- -
- message: "#^Parameter \\#1 \\$string of function ucfirst expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- -
message: "#^Parameter \\#2 \\$host of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\BaseHistoryListItem\\:\\:createServiceLink\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, object given\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseHistoryListItem.php
-
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseHostListItem.php
-
- -
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemList/BaseHostListItem.php
-
- -
message: "#^Access to an undefined property object\\:\\:\\$author\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseNotificationListItem.php
@@ -7676,11 +7231,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php
-
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php
-
- -
message: "#^Parameter \\#1 \\$host of static method Icinga\\\\Module\\\\Icingadb\\\\Common\\\\Links\\:\\:host\\(\\) expects Icinga\\\\Module\\\\Icingadb\\\\Model\\\\Host, mixed given\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php
@@ -7691,11 +7241,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemList/BaseServiceListItem.php
-
- -
message: "#^Access to an undefined property object\\:\\:\\$name\\.$#"
count: 7
path: library/Icingadb/Widget/ItemList/CommandTransportListItem.php
@@ -7751,11 +7296,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/HostListItemDetailed.php
-
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/HostListItemDetailed.php
-
- -
message: "#^Parameter \\#2 \\$value of method Icinga\\\\Web\\\\Url\\:\\:setParam\\(\\) expects array\\|bool\\|string, int given\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/NotificationList.php
@@ -7796,11 +7336,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php
-
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/ServiceListItemDetailed.php
-
- -
message: "#^Access to an undefined property object\\:\\:\\$icon_image_alt\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/StateListItem.php
@@ -7816,11 +7351,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/StateListItem.php
-
- message: "#^Cannot call method getTimestamp\\(\\) on DateTime\\|null\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemList/StateListItem.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemList\\\\StateListItem\\:\\:createSubject\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/ItemList/StateListItem.php
@@ -7831,36 +7361,6 @@ parameters:
path: library/Icingadb/Widget/ItemList/StateListItem.php
-
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
-
- -
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
-
- -
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
-
- -
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
-
- -
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
-
- -
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemTable\\\\BaseStateRowItem\\:\\:assemble\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/ItemTable/BaseStateRowItem.php
@@ -7921,41 +7421,11 @@ parameters:
path: library/Icingadb/Widget/ItemTable/HostRowItem.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemTable/HostRowItem.php
-
- -
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php
-
- -
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 5
- path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php
-
- -
- message: "#^Parameter \\#3 \\$number of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemTable\\\\BaseHostGroupItem\\:\\:translatePlural\\(\\) expects int\\|null, mixed given\\.$#"
- count: 4
- path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php
-
- -
- message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 4
- path: library/Icingadb/Widget/ItemTable/HostgroupGridCell.php
-
- -
message: "#^Parameter \\#1 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 2
path: library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
-
- -
message: "#^Parameter \\#2 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 2
path: library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
@@ -8001,41 +7471,11 @@ parameters:
path: library/Icingadb/Widget/ItemTable/ServiceRowItem.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 2
- path: library/Icingadb/Widget/ItemTable/ServiceRowItem.php
-
- -
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php
-
- -
- message: "#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 9
- path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php
-
- -
- message: "#^Parameter \\#3 \\$number of method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ItemTable\\\\BaseServiceGroupItem\\:\\:translatePlural\\(\\) expects int\\|null, mixed given\\.$#"
- count: 8
- path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php
-
- -
- message: "#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#"
- count: 8
- path: library/Icingadb/Widget/ItemTable/ServicegroupGridCell.php
-
- -
message: "#^Parameter \\#1 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 1
path: library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
-
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
-
- -
message: "#^Parameter \\#2 \\.\\.\\.\\$rules of static method ipl\\\\Stdlib\\\\Filter\\:\\:all\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 1
path: library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
@@ -8126,6 +7566,16 @@ parameters:
path: library/Icingadb/Widget/ItemTable/StateRowItem.php
-
+ message: "#^Cannot access property \\$is_problem on mixed\\.$#"
+ count: 1
+ path: library/Icingadb/Widget/ItemTable/StateRowItem.php
+
+ -
+ message: "#^Cannot access property \\$is_reachable on mixed\\.$#"
+ count: 1
+ path: library/Icingadb/Widget/ItemTable/StateRowItem.php
+
+ -
message: "#^Cannot access property \\$last_state_change on mixed\\.$#"
count: 1
path: library/Icingadb/Widget/ItemTable/StateRowItem.php
@@ -8211,36 +7661,6 @@ parameters:
path: library/Icingadb/Widget/ItemTable/StateRowItem.php
-
- message: "#^Cannot access offset 0 on mixed\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/UserTableRow.php
-
- -
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 3
- path: library/Icingadb/Widget/ItemTable/UserTableRow.php
-
- -
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/UserTableRow.php
-
- -
- message: "#^Cannot access offset 0 on mixed\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/UsergroupTableRow.php
-
- -
- message: "#^Parameter \\#1 \\$content of static method ipl\\\\Html\\\\Text\\:\\:create\\(\\) expects string, mixed given\\.$#"
- count: 3
- path: library/Icingadb/Widget/ItemTable/UsergroupTableRow.php
-
- -
- message: "#^Parameter \\#2 \\$value of static method ipl\\\\Stdlib\\\\Filter\\:\\:equal\\(\\) expects array\\|bool\\|float\\|int\\|string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ItemTable/UsergroupTableRow.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ServiceStateBadges\\:\\:assemble\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/ServiceStateBadges.php
@@ -8256,11 +7676,6 @@ parameters:
path: library/Icingadb/Widget/ServiceStatusBar.php
-
- message: "#^Cannot cast mixed to int\\.$#"
- count: 1
- path: library/Icingadb/Widget/ServiceSummaryDonut.php
-
- -
message: "#^Method Icinga\\\\Module\\\\Icingadb\\\\Widget\\\\ServiceSummaryDonut\\:\\:assembleBody\\(\\) has no return type specified\\.$#"
count: 1
path: library/Icingadb/Widget/ServiceSummaryDonut.php
@@ -8276,16 +7691,6 @@ parameters:
path: library/Icingadb/Widget/ServiceSummaryDonut.php
-
- message: "#^Parameter \\#1 \\$data of method Icinga\\\\Chart\\\\Donut\\:\\:addSlice\\(\\) expects int, mixed given\\.$#"
- count: 8
- path: library/Icingadb/Widget/ServiceSummaryDonut.php
-
- -
- message: "#^Parameter \\#1 \\$labelBig of method Icinga\\\\Chart\\\\Donut\\:\\:setLabelBig\\(\\) expects string, mixed given\\.$#"
- count: 1
- path: library/Icingadb/Widget/ServiceSummaryDonut.php
-
- -
message: "#^Parameter \\#1 \\$rule of method ipl\\\\Stdlib\\\\Filter\\\\Chain\\:\\:add\\(\\) expects ipl\\\\Stdlib\\\\Filter\\\\Rule, ipl\\\\Stdlib\\\\Filter\\\\Rule\\|null given\\.$#"
count: 1
path: library/Icingadb/Widget/ServiceSummaryDonut.php
diff --git a/phpstan.neon b/phpstan.neon
index 4cfb7e5..a0656a4 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,5 +1,6 @@
includes:
- - phpstan-baseline.neon
+ - phpstan-baseline-standard.neon
+ - phpstan-baseline-by-php-version.php
parameters:
level: max
@@ -13,7 +14,9 @@ parameters:
- library
scanDirectories:
- - vendor
+ - /icingaweb2
+ - /usr/share/icinga-php
+ - /usr/share/icingaweb2-modules
ignoreErrors:
-
@@ -26,3 +29,4 @@ parameters:
- ipl\Orm\Model
- Icinga\Web\View
- Icinga\Data\ConfigObject
+ - Icinga\Module\Monitoring\Object\MonitoredObject
diff --git a/public/js/action-list.js b/public/js/action-list.js
index 69cab05..c176a0d 100644
--- a/public/js/action-list.js
+++ b/public/js/action-list.js
@@ -126,6 +126,7 @@
&& _this.icinga.loader.getLinkTargetFor($(target)).attr('id') === 'col2'
) {
_this.icinga.ui.layout1col();
+ _this.icinga.history.pushCurrentState();
_this.enableAutoRefresh('col1');
return;
}
diff --git a/test/php/Lib/StrikingCommandTransport.php b/test/php/Lib/StrikingCommandTransport.php
new file mode 100644
index 0000000..5e14ef9
--- /dev/null
+++ b/test/php/Lib/StrikingCommandTransport.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Tests\Icinga\Module\Icingadb\Lib;
+
+use Icinga\Application\Config;
+use Icinga\Data\ConfigObject;
+use Icinga\Module\Icingadb\Command\IcingaApiCommand;
+use Icinga\Module\Icingadb\Command\Transport\ApiCommandTransport;
+use Icinga\Module\Icingadb\Command\Transport\CommandTransport;
+use Icinga\Module\Icingadb\Command\Transport\CommandTransportException;
+
+class StrikingCommandTransport extends CommandTransport
+{
+ public static function getConfig(): Config
+ {
+ return Config::fromArray(['endpoint1' => ['host' => 'endpointA'], 'endpoint2' => ['host' => 'endpointB']]);
+ }
+
+ public static function createTransport(ConfigObject $config): ApiCommandTransport
+ {
+ return (new class extends ApiCommandTransport {
+ protected function sendCommand(IcingaApiCommand $command)
+ {
+ throw new CommandTransportException(sprintf('%s strikes!', $this->getHost()));
+ }
+ })->setHost($config->host);
+ }
+}
diff --git a/test/php/library/Icingadb/Command/Transport/CommandTransportTest.php b/test/php/library/Icingadb/Command/Transport/CommandTransportTest.php
new file mode 100644
index 0000000..63a1b66
--- /dev/null
+++ b/test/php/library/Icingadb/Command/Transport/CommandTransportTest.php
@@ -0,0 +1,48 @@
+<?php
+
+namespace Tests\Icinga\Module\Icingadb\Command\Transport;
+
+use Icinga\Module\Icingadb\Command\Object\AddCommentCommand;
+use Icinga\Module\Icingadb\Command\Transport\CommandTransportException;
+use Icinga\Module\Icingadb\Model\Host;
+use PHPUnit\Framework\TestCase;
+use Tests\Icinga\Module\Icingadb\Lib\StrikingCommandTransport;
+
+class CommandTransportTest extends TestCase
+{
+ public function testFallbackHandling()
+ {
+ $this->expectException(CommandTransportException::class);
+ $this->expectExceptionMessage('endpointB strikes!');
+
+ (new StrikingCommandTransport())->send(
+ (new AddCommentCommand())
+ ->setExpireTime(42)
+ ->setAuthor('GLaDOS')
+ ->setComment('The cake is a lie')
+ ->setObjects(new \CallbackFilterIterator(new \ArrayIterator([
+ (new Host())->setProperties(['name' => 'host1']),
+ (new Host())->setProperties(['name' => 'host2']),
+ ]), function ($host) {
+ return $host->name === 'host2';
+ }))
+ );
+ }
+
+ public function testGeneratorsAreNotSupported()
+ {
+ $this->expectException(\InvalidArgumentException::class);
+ $this->expectExceptionMessage('Generators are not supported');
+
+ (new StrikingCommandTransport())->send(
+ (new AddCommentCommand())
+ ->setExpireTime(42)
+ ->setAuthor('GLaDOS')
+ ->setComment('The cake is a lie')
+ ->setObjects((function () {
+ yield (new Host())->setProperties(['name' => 'host1']);
+ yield (new Host())->setProperties(['name' => 'host2']);
+ })())
+ );
+ }
+}
diff --git a/test/php/library/Icingadb/Model/Behavior/FlattenedObjectVarsTest.php b/test/php/library/Icingadb/Model/Behavior/FlattenedObjectVarsTest.php
new file mode 100644
index 0000000..7cfd97a
--- /dev/null
+++ b/test/php/library/Icingadb/Model/Behavior/FlattenedObjectVarsTest.php
@@ -0,0 +1,161 @@
+<?php
+
+/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */
+
+namespace Tests\Icinga\Modules\Icingadb\Model\Behavior;
+
+use Icinga\Module\Icingadb\Model\Host;
+use ipl\Sql\Connection;
+use ipl\Sql\Test\SqlAssertions;
+use ipl\Sql\Test\TestConnection;
+use ipl\Stdlib\Filter;
+use PHPUnit\Framework\TestCase;
+
+class FlattenedObjectVarsTest extends TestCase
+{
+ use SqlAssertions;
+
+ private const SINGLE_UNEQUAL_RESULT = <<<'SQL'
+SELECT host.id
+FROM host
+WHERE (host.id NOT IN ((SELECT sub_customvar_flat_host.id AS sub_customvar_flat_host_id
+ FROM customvar_flat sub_customvar_flat
+ INNER JOIN host_customvar sub_customvar_flat_host_customvar
+ ON sub_customvar_flat_host_customvar.customvar_id =
+ sub_customvar_flat.customvar_id
+ INNER JOIN host sub_customvar_flat_host
+ ON sub_customvar_flat_host.id = sub_customvar_flat_host_customvar.host_id
+ WHERE ((sub_customvar_flat.flatname = ?) AND (sub_customvar_flat.flatvalue = ?))
+ AND (sub_customvar_flat_host.id IS NOT NULL)
+ GROUP BY sub_customvar_flat_host.id
+ HAVING COUNT(DISTINCT sub_customvar_flat.id) >= ?)) OR host.id IS NULL)
+ORDER BY host.id
+SQL;
+
+ private const DOUBLE_UNEQUAL_RESULT = <<<'SQL'
+SELECT host.id
+FROM host
+WHERE (host.id NOT IN ((SELECT sub_customvar_flat_host.id AS sub_customvar_flat_host_id
+ FROM customvar_flat sub_customvar_flat
+ INNER JOIN host_customvar sub_customvar_flat_host_customvar
+ ON sub_customvar_flat_host_customvar.customvar_id =
+ sub_customvar_flat.customvar_id
+ INNER JOIN host sub_customvar_flat_host
+ ON sub_customvar_flat_host.id = sub_customvar_flat_host_customvar.host_id
+ WHERE (((sub_customvar_flat.flatname = ?) AND (sub_customvar_flat.flatvalue = ?)) OR
+ ((sub_customvar_flat.flatname = ?) AND (sub_customvar_flat.flatvalue = ?)))
+ AND (sub_customvar_flat_host.id IS NOT NULL)
+ GROUP BY sub_customvar_flat_host.id
+ HAVING COUNT(DISTINCT sub_customvar_flat.id) >= ?)) OR host.id IS NULL)
+ORDER BY host.id
+SQL;
+
+ private const EQUAL_UNEQUAL_RESULT = <<<'SQL'
+SELECT host.id
+FROM host
+WHERE ((host.id NOT IN ((SELECT sub_customvar_flat_host.id AS sub_customvar_flat_host_id
+ FROM customvar_flat sub_customvar_flat
+ INNER JOIN host_customvar sub_customvar_flat_host_customvar
+ ON sub_customvar_flat_host_customvar.customvar_id =
+ sub_customvar_flat.customvar_id
+ INNER JOIN host sub_customvar_flat_host
+ ON sub_customvar_flat_host.id = sub_customvar_flat_host_customvar.host_id
+ WHERE ((sub_customvar_flat.flatname = ?) AND (sub_customvar_flat.flatvalue = ?))
+ AND (sub_customvar_flat_host.id IS NOT NULL)
+ GROUP BY sub_customvar_flat_host.id
+ HAVING COUNT(DISTINCT sub_customvar_flat.id) >= ?)) OR host.id IS NULL))
+ AND (host.id IN ((SELECT sub_customvar_flat_host.id AS sub_customvar_flat_host_id
+ FROM customvar_flat sub_customvar_flat
+ INNER JOIN host_customvar sub_customvar_flat_host_customvar
+ ON sub_customvar_flat_host_customvar.customvar_id =
+ sub_customvar_flat.customvar_id
+ INNER JOIN host sub_customvar_flat_host
+ ON sub_customvar_flat_host.id = sub_customvar_flat_host_customvar.host_id
+ WHERE (sub_customvar_flat.flatname = ?)
+ AND (sub_customvar_flat.flatvalue = ?)
+ GROUP BY sub_customvar_flat_host.id
+ HAVING COUNT(DISTINCT sub_customvar_flat.id) >= ?)))
+ORDER BY host.id
+SQL;
+
+ private const DOUBLE_EQUAL_RESULT = <<<'SQL'
+SELECT host.id
+FROM host
+WHERE host.id IN ((SELECT sub_customvar_flat_host.id AS sub_customvar_flat_host_id
+ FROM customvar_flat sub_customvar_flat
+ INNER JOIN host_customvar sub_customvar_flat_host_customvar
+ ON sub_customvar_flat_host_customvar.customvar_id =
+ sub_customvar_flat.customvar_id
+ INNER JOIN host sub_customvar_flat_host
+ ON sub_customvar_flat_host.id = sub_customvar_flat_host_customvar.host_id
+ WHERE ((sub_customvar_flat.flatname = ?) AND (sub_customvar_flat.flatvalue = ?))
+ OR ((sub_customvar_flat.flatname = ?) AND (sub_customvar_flat.flatvalue = ?))
+ GROUP BY sub_customvar_flat_host.id
+ HAVING COUNT(DISTINCT sub_customvar_flat.id) >= ?))
+ORDER BY host.id
+SQL;
+
+ /** @var Connection */
+ private $connection;
+
+ public function setUp(): void
+ {
+ $this->connection = new TestConnection();
+ $this->setUpSqlAssertions();
+ }
+
+ public function testSingleUnequalCondition()
+ {
+ $query = Host::on($this->connection)
+ ->columns('host.id')
+ ->orderBy('host.id')
+ ->filter(Filter::unequal('host.vars.in.valid', 'foo'));
+
+ $this->assertSql(self::SINGLE_UNEQUAL_RESULT, $query->assembleSelect(), ['in.valid', 'foo', 1]);
+ }
+
+ public function testDoubleUnequalCondition()
+ {
+ $query = Host::on($this->connection)
+ ->columns('host.id')
+ ->orderBy('host.id')
+ ->filter(Filter::unequal('host.vars.in.valid', 'foo'))
+ ->filter(Filter::unequal('host.vars.missing', 'bar'));
+
+ $this->assertSql(
+ self::DOUBLE_UNEQUAL_RESULT,
+ $query->assembleSelect(),
+ ['in.valid', 'foo', 'missing', 'bar', 1]
+ );
+ }
+
+ public function testEqualAndUnequalCondition()
+ {
+ $query = Host::on($this->connection)
+ ->columns('host.id')
+ ->orderBy('host.id')
+ ->filter(Filter::unequal('host.vars.in.valid', 'bar'))
+ ->filter(Filter::equal('host.vars.env', 'foo'));
+
+ $this->assertSql(
+ self::EQUAL_UNEQUAL_RESULT,
+ $query->assembleSelect(),
+ ['in.valid', 'bar', 1, 'env', 'foo', 1]
+ );
+ }
+
+ public function testDoubleEqualCondition()
+ {
+ $query = Host::on($this->connection)
+ ->columns('host.id')
+ ->orderBy('host.id')
+ ->filter(Filter::equal('host.vars.env', 'foo'))
+ ->filter(Filter::equal('host.vars.os', 'bar'));
+
+ $this->assertSql(
+ self::DOUBLE_EQUAL_RESULT,
+ $query->assembleSelect(),
+ ['env', 'foo', 'os', 'bar', 2]
+ );
+ }
+}