Merge pull request #316 from Icinga/php-81-support

PHP 8.1 Support
This commit is contained in:
Johannes Meyer 2022-01-24 14:30:11 +01:00 committed by GitHub
commit 3fe1c9d1a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 7 deletions

View file

@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
os: ['ubuntu-latest']
steps:

View file

@ -101,6 +101,12 @@ class ProcessCommand extends Command
*/
public function checkAction()
{
$nodeName = $this->params->shift();
if (! $nodeName) {
Logger::error('A process name is required');
exit(1);
}
try {
$name = $this->params->get('config');
if ($name === null) {
@ -125,7 +131,7 @@ class ProcessCommand extends Command
/** @var BpNode $node */
try {
$node = $bp->getNode($this->params->shift());
$node = $bp->getNode($nodeName);
MonitoringState::apply($bp);
if ($bp->hasErrors()) {
Logger::error("Checking Business Process '%s' failed: %s\n", $name, $bp->getErrors());
@ -133,7 +139,7 @@ class ProcessCommand extends Command
exit(3);
}
} catch (Exception $err) {
Logger::error("Checking Business Process '%s' failed: %s", $name, $err->getMessage());
Logger::error("Checking Business Process '%s' failed: %s", $name, $err);
exit(3);
}

View file

@ -54,10 +54,13 @@ class SimulationForm extends QuickForm
'class' => 'autosubmit',
'value' => $this->simulatedNode ? $node->getState() : null,
));
if (in_array($this->getSentValue('state'), array('0', '99'))) {
$sentState = $this->getSentValue('state');
if (in_array($sentState, array('0', '99'))) {
return;
}
if ($hasSimulation || ctype_digit($this->getSentValue('state'))) {
if ($hasSimulation || ($sentState !== null && ctype_digit($sentState))) {
$this->addElement('checkbox', 'acknowledged', array(
'label' => $this->translate('Acknowledged'),
'value' => $node->isAcknowledged(),
@ -98,8 +101,9 @@ class SimulationForm extends QuickForm
public function onSuccess()
{
$nodeName = $this->node->getName();
$state = $this->getValue('state');
if (ctype_digit($this->getValue('state'))) {
if ($state !== null && ctype_digit($state)) {
$this->notifySuccess($this->translate('Simulation has been set'));
$this->simulation->set($nodeName, (object) array(
'state' => $this->getValue('state'),

View file

@ -5,7 +5,7 @@ Requirements
------------
* Icinga Web 2 (>= 2.9)
* PHP (>= 7.1)
* PHP (>= 7.2)
* Icinga Web 2 modules:
* The `monitoring` module needs to be configured and enabled.