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

PHP 8.1 Support
This commit is contained in:
Johannes Meyer 2022-03-24 16:00:32 +01:00 committed by GitHub
commit 45f2f2aa2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 41 deletions

View file

@ -17,11 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
php: ['7.2', '7.3', '7.4', '8.0', '8.1']
os: ['ubuntu-latest']
include:
- php: '7.0'
allow_failure: true
steps:
- name: Checkout code base

View file

@ -1,6 +1,6 @@
# Icinga DB Web
[![PHP Support](https://img.shields.io/badge/php-%3E%3D%207.0-777BB4?logo=PHP)](https://php.net/)
[![PHP Support](https://img.shields.io/badge/php-%3E%3D%207.2-777BB4?logo=PHP)](https://php.net/)
![Build Status](https://github.com/icinga/icingaweb2-module-icingadb/workflows/PHP%20Tests/badge.svg?branch=master)
[![Github Tag](https://img.shields.io/github/tag/Icinga/icingaweb2-module-icingadb.svg)](https://github.com/Icinga/icingaweb2-module-icingadb)

View file

@ -6,14 +6,13 @@
## Requirements
* PHP (>= 7.3)
* Older versions (7.0+) still work, but may stop doing so with near future updates
* PHP (>= 7.2)
* MySQL or PostgreSQL PHP libraries
* The following PHP modules must be installed: cURL, dom, json, libxml, pdo
* [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.7)
* [Icinga PHP Thirdparty](https://github.com/Icinga/icinga-php-thirdparty) (>= 0.10)
* [Icinga PHP Library (ipl)](https://github.com/Icinga/icinga-php-library) (>= 0.9)
* [Icinga PHP Thirdparty](https://github.com/Icinga/icinga-php-thirdparty) (>= 0.11)
* For exports to PDF the [pdfexport](https://github.com/Icinga/icingaweb2-module-pdfexport) (>= 0.10)
module is required (Optional)

View file

@ -62,7 +62,7 @@ class Bitmask extends PropertyBehavior implements RewriteFilterBehavior
$values = $condition->getValue();
if (! is_array($values)) {
if (ctype_digit($values)) {
if (is_int($values) || ctype_digit($values)) {
return;
}

View file

@ -19,7 +19,7 @@ class IdKey implements RewriteFilterBehavior
$column = $condition->metaData()->get('columnName');
if ($column === 'id' || substr($column, -3) === '_id') {
$value = $condition->getValue();
if ($value && ctype_alnum($value)) {
if ($value && is_string($value) && ctype_alnum($value)) {
$condition->setValue(hex2bin($value));
}
}

View file

@ -23,7 +23,7 @@ class Timestamp extends PropertyBehavior
return $value;
}
if (! ctype_digit($value)) {
if (is_string($value) && ! ctype_digit($value)) {
$timestamp = strtotime($value);
if ($timestamp === false) {
return $value;

View file

@ -27,7 +27,7 @@ class VolatileStateResults extends ResultSet
return parent::current();
}
public function key()
public function key(): int
{
if (! $this->updatesApplied && ! $this->isCacheDisabled) {
$this->rewind();
@ -36,7 +36,7 @@ class VolatileStateResults extends ResultSet
return parent::key();
}
public function rewind()
public function rewind(): void
{
if (! $this->updatesApplied && ! $this->isCacheDisabled) {
$this->updatesApplied = true;

View file

@ -4,7 +4,6 @@
namespace Icinga\Module\Icingadb\Setup;
use Icinga\Application\Platform;
use Icinga\Module\Setup\Forms\SummaryPage;
use Icinga\Module\Setup\Requirement\PhpModuleRequirement;
use Icinga\Module\Setup\Requirement\PhpVersionRequirement;
@ -51,35 +50,19 @@ class IcingaDbWizard extends Wizard implements SetupWizard
{
$set = new RequirementSet();
$phpVersion = Platform::getPhpVersion();
if (
version_compare($phpVersion, '7.0', '>=')
&& version_compare($phpVersion, '7.3', '<')
) {
$set->add(new PhpVersionRequirement([
'optional' => true,
'condition' => ['>=', '7.3'],
'description' => t(
'For Icinga DB Web PHP 7.3+ is highly recommended.'
. ' Older versions still work, but may stop doing so with near future updates.'
)
]));
} else {
$set->add(new PhpVersionRequirement([
'condition' => ['>=', '7.3'],
'description' => t('Icinga DB Web requires PHP version 7.3.')
]));
}
$set->add(new PhpVersionRequirement([
'condition' => ['>=', '7.2'],
'description' => sprintf(t('Icinga DB Web requires PHP version %s.'), '7.2')
]));
$set->add(new WebLibraryRequirement([
'condition' => ['icinga-php-library', '>=', '0.7.0'],
'condition' => ['icinga-php-library', '>=', '0.9.0'],
'alias' => 'Icinga PHP library',
'description' => t('The Icinga PHP library (IPL) is required for Icinga DB Web')
]));
$set->add(new WebLibraryRequirement([
'condition' => ['icinga-php-thirdparty', '>=', '0.10.0'],
'condition' => ['icinga-php-thirdparty', '>=', '0.11.0'],
'alias' => 'Icinga PHP Thirdparty',
'description' => t('The Icinga PHP Thirdparty library is required for Icinga DB Web')
]));

View file

@ -17,11 +17,11 @@ use Icinga\Module\Icingadb\Common\HostLinks;
use Icinga\Module\Icingadb\Common\Icons;
use Icinga\Module\Icingadb\Common\Links;
use Icinga\Module\Icingadb\Common\Macros;
use Icinga\Module\Icingadb\Compat\CompatHost;
use Icinga\Module\Icingadb\Model\CustomvarFlat;
use Icinga\Module\Icingadb\Web\Navigation\Action;
use Icinga\Module\Icingadb\Widget\MarkdownText;
use Icinga\Module\Icingadb\Common\ServiceLinks;
use Icinga\Module\Icingadb\Compat\CompatObject;
use Icinga\Module\Icingadb\Forms\Command\Object\ToggleObjectFeaturesForm;
use Icinga\Module\Icingadb\Hook\ActionsHook\ObjectActionsHook;
use Icinga\Module\Icingadb\Hook\ExtensionHook\ObjectDetailExtensionHook;
@ -34,7 +34,6 @@ use Icinga\Module\Icingadb\Widget\EmptyState;
use Icinga\Module\Icingadb\Widget\StateChange;
use ipl\Web\Widget\HorizontalKeyValue;
use Icinga\Module\Icingadb\Widget\ItemList\CommentList;
use Icinga\Module\Icingadb\Widget\Detail\PerfDataTable;
use Icinga\Module\Icingadb\Widget\PluginOutputContainer;
use Icinga\Module\Icingadb\Widget\ShowMore;
use Icinga\Module\Icingadb\Widget\TagList;
@ -75,7 +74,7 @@ class ObjectDetail extends BaseHtmlElement
public function __construct($object)
{
$this->object = $object;
$this->compatObject = CompatObject::fromModel($object);
$this->compatObject = CompatHost::fromModel($object);
$this->objectType = $object instanceof Host ? 'host' : 'service';
}

View file

@ -1,6 +1,6 @@
Module: icingadb
Version: 1.0.0-rc2
Requires:
Libraries: icinga-php-library (>=0.7.0), icinga-php-thirdparty (>=0.10.0)
Libraries: icinga-php-library (>=0.9.0), icinga-php-thirdparty (>=0.11.0)
Description: Icinga DB Web
UI for Icinga DB Provides a graphical interface to your Icinga monitoring