Skip to content

Commit 49ded53

Browse files
Mary-ClbRom1-B
andauthored
GLPI 11 compatibility (#48)
* fix version setup.php * diplaying configuration page even if conf is not registered yet * refacto * fix phpcs * fix phpcs * fix logo url * fix ajax URL's and front files with correct rights * fix URL's for host timeline * fix downtimes and cancel * fix phpcs * add functions comments * fix phpstan * fix phpstan * fix phpstan * add ajax and settimeout * fix phpcs * fix review errors * fix acknowledgement * rm php_codesniffer * fix setup.php * rm php-unit * fixes for CIs * fix phpstan errors * fix phpstan & phpcs * fixes for review * fix for review * fixes for review * update plugin version to 1.1.0-beta1 * psalm * beta2 * psalm + rector * release GLPI 11.0 --------- Co-authored-by: Rom1-B <[email protected]>
1 parent 571c5c1 commit 49ded53

30 files changed

+885
-4400
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: "Generate CI matrix"
2121
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
2222
with:
23-
glpi-version: "10.0.x"
23+
glpi-version: "11.0.x"
2424
ci:
2525
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
2626
needs: "generate-ci-matrix"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules/
33
tests/files/_logs/*.log
44
vendor/
55
.gh_token
6+
.phpunit.result.cache

.twig_cs.dist.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
declare(strict_types=1);
44

5-
use FriendsOfTwig\Twigcs;
5+
use FriendsOfTwig\Twigcs\Finder\TemplateFinder;
6+
use FriendsOfTwig\Twigcs\Config\Config;
7+
use Glpi\Tools\GlpiTwigRuleset;
68

7-
$finder = Twigcs\Finder\TemplateFinder::create()
9+
$finder = TemplateFinder::create()
810
->in(__DIR__ . '/templates')
911
->name('*.html.twig')
1012
->ignoreVCSIgnored(true);
1113

12-
return Twigcs\Config\Config::create()
14+
return Config::create()
1315
->setFinder($finder)
14-
->setRuleSet(\Glpi\Tools\GlpiTwigRuleset::class)
16+
->setRuleSet(GlpiTwigRuleset::class)
1517
;

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## [UNRELEASED]
8+
## [1.1.0] - 2025-09-29
9+
10+
### Added
11+
12+
- GLPI 11 compatibility
913

1014
## [1.0.3] - 2025-09-04
1115

ajax/ack.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
use GlpiPlugin\Centreon\Host;
3232

33-
include('../../../inc/includes.php');
34-
3533
Session::checkRight('computer', UPDATE);
3634

3735
header('Content-Type: text/html; charset=UTF-8');

ajax/cancelDowntime.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030

3131
use GlpiPlugin\Centreon\Host;
3232

33-
include('../../../inc/includes.php');
34-
33+
Session::checkLoginUser();
3534
Session::checkRight('computer', UPDATE);
3635

3736
header('Content-Type: text/html; charset=UTF-8');

ajax/checkDowntime.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/**
4+
* -------------------------------------------------------------------------
5+
* Centreon plugin for GLPI
6+
* -------------------------------------------------------------------------
7+
*
8+
* LICENSE
9+
*
10+
* This file is part of Centreon.
11+
*
12+
* Centreon is free software; you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 3 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* Centreon is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License
23+
* along with Centreon. If not, see <http://www.gnu.org/licenses/>.
24+
* -------------------------------------------------------------------------
25+
* @copyright Copyright (C) 2022-2023 by Centreon plugin team.
26+
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
27+
* @link https://github.com/pluginsGLPI/centreon
28+
* -------------------------------------------------------------------------
29+
*/
30+
31+
use GlpiPlugin\Centreon\Host;
32+
33+
use function Safe\json_encode;
34+
35+
Session::checkRight('computer', UPDATE);
36+
37+
header('Content-Type: application/json');
38+
39+
if (!isset($_GET['host_id'])) {
40+
echo json_encode(['error' => 'Missing host_id']);
41+
} else {
42+
$host_id = $_GET['host_id'];
43+
$host = new Host();
44+
$res = $host->oneHost($host_id);
45+
echo json_encode(['in_downtime' => $res['in_downtime'] ?? null]);
46+
}

ajax/hostTimeline.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
use GlpiPlugin\Centreon\Host;
3333

34-
include('../../../inc/includes.php');
35-
3634
Session::checkRight('computer', READ);
3735

3836
header('Content-Type: text/html; charset=UTF-8');

ajax/sendCheck.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
use GlpiPlugin\Centreon\Host;
3232

33-
include('../../../inc/includes.php');
34-
3533
Session::checkRight('computer', UPDATE);
3634

3735
header('Content-Type: text/html; charset=UTF-8');

ajax/setDowntime.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
use GlpiPlugin\Centreon\Host;
3232

33-
include('../../../inc/includes.php');
34-
3533
Session::checkRight('computer', UPDATE);
3634

3735
header('Content-Type: text/html; charset=UTF-8');

0 commit comments

Comments
 (0)