Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
6932d60
Feature GLP11
stonebuzz Jun 26, 2025
17b17ae
Use same PHP requirements as GLPI 11.0
AdrienClairembault Aug 14, 2025
057adef
Fix spelling mistakes and punctuation inconsistencies
AdrienClairembault Aug 14, 2025
81e7612
Fix incorrect license
AdrienClairembault Aug 14, 2025
4790cd9
Add global modified to sed command when replacing $LNAME
AdrienClairembault Aug 14, 2025
cc49ec5
Rename master to main
AdrienClairembault Aug 14, 2025
8a265bd
Fix headers
AdrienClairembault Aug 14, 2025
f06ea48
Remove punctuation for short description
AdrienClairembault Aug 14, 2025
e3a3707
Add trailling comas to comply with our default phpcsfixer configuration
AdrienClairembault Aug 14, 2025
20e86c2
Fix another typo
AdrienClairembault Aug 14, 2025
99e5548
Add typehints
AdrienClairembault Aug 14, 2025
8f68e77
Add makefile
AdrienClairembault Aug 18, 2025
b1ab662
Unignore compose.lock
AdrienClairembault Aug 18, 2025
82884d5
Update glpi-project/tools
AdrienClairembault Aug 18, 2025
2a0e8ad
Add cy integration
AdrienClairembault Aug 18, 2025
40322de
Add src folder
AdrienClairembault Aug 18, 2025
ec213bc
Add phpunit
AdrienClairembault Aug 18, 2025
f52639f
Add PHPStan
AdrienClairembault Aug 18, 2025
ddd0bfd
Add PHP-CS-Fixer
AdrienClairembault Aug 18, 2025
4716717
Add psalm
AdrienClairembault Aug 18, 2025
5fde1f6
Apply PHPStan
AdrienClairembault Aug 18, 2025
6584ae0
Add rector
AdrienClairembault Aug 18, 2025
2474616
Fix missing file in sed command
AdrienClairembault Aug 18, 2025
b3affb7
Use core dependencies
AdrienClairembault Aug 18, 2025
83fee41
Fix phpstan ignore on wrong line
AdrienClairembault Aug 18, 2025
69aef8b
Use ignoreVCSIgnored
AdrienClairembault Aug 18, 2025
f6f4042
Simplify makefile
AdrienClairembault Aug 19, 2025
7eba56a
Update phpstan configuration following latest main changes
AdrienClairembault Aug 19, 2025
503ad92
Remove useless exclusions
AdrienClairembault Aug 19, 2025
64088b9
Keep .git exclusion
AdrienClairembault Aug 19, 2025
f3960e6
Rector tweaks
AdrienClairembault Aug 19, 2025
41aa052
Remove git exclusion
AdrienClairembault Aug 20, 2025
76d2d44
Use PER3
AdrienClairembault Aug 20, 2025
af3274c
Set glpi-project to ^0.7
AdrienClairembault Aug 20, 2025
53bbe9b
Remove composer.lock
AdrienClairembault Aug 20, 2025
593a3db
Ignore lock file
AdrienClairembault Aug 20, 2025
9200c03
Fix phpunit.xml indentation
AdrienClairembault Aug 20, 2025
88661bb
Remove specific value for processIsolation that is already used by
AdrienClairembault Aug 20, 2025
c5c0fc2
Add g flag for sed
AdrienClairembault Aug 20, 2025
aede47b
Fix screenshots links
AdrienClairembault Aug 20, 2025
422f750
Update phpdoc
AdrienClairembault Aug 20, 2025
ce862fc
Use absolute path
AdrienClairembault Aug 20, 2025
3379600
Remove rector
AdrienClairembault Aug 20, 2025
ffaecb6
Simplify bootstrap
AdrienClairembault Aug 20, 2025
30e5d7e
fixup! Simplify bootstrap
AdrienClairembault Aug 20, 2025
88cd0b8
an attempt to run CI
cedric-anne Aug 20, 2025
d360119
force CI
cedric-anne Aug 20, 2025
d62a0c4
fix script
cedric-anne Aug 20, 2025
411b2aa
fix script
cedric-anne Aug 20, 2025
0d261e0
fix script
cedric-anne Aug 20, 2025
5da5248
fix script
cedric-anne Aug 20, 2025
1509567
excludes from rsync
cedric-anne Aug 20, 2025
2b3e569
do not change dir in tests
cedric-anne Aug 20, 2025
a9f39e1
excludes from rsync
cedric-anne Aug 20, 2025
c35a94c
revert force CI
cedric-anne Aug 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Continuous integration"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
generate-ci-matrix:
name: "Generate CI matrix"
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
with:
glpi-version: "11.0.x"
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
needs: "generate-ci-matrix"
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-ci-matrix.outputs.matrix) }}
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
with:
plugin-key: "empty"
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"
init-script: "./.github/workflows/create-plugin.sh"
35 changes: 35 additions & 0 deletions .github/workflows/continuous-integration.yml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Continuous integration"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
generate-ci-matrix:
name: "Generate CI matrix"
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
with:
glpi-version: "11.0.x"
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
needs: "generate-ci-matrix"
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-ci-matrix.outputs.matrix) }}
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
with:
plugin-key: "{LNAME}"
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"
38 changes: 38 additions & 0 deletions .github/workflows/create-plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
#
# -------------------------------------------------------------------------
# {NAME} plugin for GLPI
# Copyright (C) {YEAR} by the {NAME} Development Team.
# -------------------------------------------------------------------------
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# --------------------------------------------------------------------------
#

set -e -u -o pipefail

# `rsync` is required by the `plugin.sh` script
sudo apt update
sudo apt install --assume-yes --no-install-recommends --quiet rsync

# move self to `template` then create an `empty` plugin`
(cd .. && mv empty template && cd template && ./plugin.sh empty "1.0.0")
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ dist/
node_modules/
vendor/
.gh_token
composer.lock
*.min.*

var
composer.lock
52 changes: 52 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

/**
* -------------------------------------------------------------------------
* {NAME} plugin for GLPI
* -------------------------------------------------------------------------
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* -------------------------------------------------------------------------
* @copyright Copyright (C) {YEAR} by the {NAME} plugin team.
* @license MIT https://opensource.org/licenses/mit-license.php
* @link https://github.com/pluginsGLPI/{LNAME}
* -------------------------------------------------------------------------
*/

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in(__DIR__)
->ignoreVCSIgnored(true)
->name('*.php');

$config = new Config();

$rules = [
'@PER-CS' => true, // Latest PER rules.
];

return $config
->setRules($rules)
->setFinder($finder)
->setCacheFile(__DIR__ . '/var/php-cs-fixer/.php-cs-fixer.cache')
;
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../PluginsMakefile.mk
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"require": {
"php": ">=7.4"
"php": ">=8.2"
},
"require-dev": {
"glpi-project/tools": "^0.4"
"glpi-project/tools": "^0.7"
},
"config": {
"optimize-autoloader": true,
"platform": {
"php": "7.4.0"
"php": "8.2.99"
},
"sort-packages": true
}
Expand Down
16 changes: 7 additions & 9 deletions hook.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/**
* -------------------------------------------------------------------------
* {NAME} plugin for GLPI
* Copyright (C) {YEAR} by the {NAME} Development Team.
* -------------------------------------------------------------------------
*
* MIT License
Expand All @@ -25,26 +24,25 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* --------------------------------------------------------------------------
* -------------------------------------------------------------------------
* @copyright Copyright (C) {YEAR} by the {NAME} plugin team.
* @license MIT https://opensource.org/licenses/mit-license.php
* @link https://github.com/pluginsGLPI/{LNAME}
* -------------------------------------------------------------------------
*/

/**
* Plugin install process
*
* @return boolean
*/
function plugin_{LNAME}_install()
function plugin_{LNAME}_install(): bool
{
return true;
}

/**
* Plugin uninstall process
*
* @return boolean
*/
function plugin_{LNAME}_uninstall()
function plugin_{LNAME}_uninstall(): bool
{
return true;
}
17 changes: 17 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
includes:
- ../../vendor/glpi-project/phpstan-glpi/extension.neon
- ../../vendor/phpstan/phpstan-deprecation-rules/rules.neon
- ../../vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon

parameters:
level: max
paths:
- src
- hook.php
- setup.php
scanDirectories:
- ../../src
bootstrapFiles:
- ../../stubs/glpi_constants.php
- ../../vendor/autoload.php
treatPhpDocTypesAsCertain: false
14 changes: 14 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<phpunit
bootstrap="tests/bootstrap.php"
colors="true"
cacheDirectory="var/phpunit"
>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="memory_limit" value="2G"/>
</php>
</phpunit>
28 changes: 17 additions & 11 deletions plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
# --------------------------------------------------------------------------
#

set -e -u -o pipefail

if [[ $# -ne 2 && $# -ne 3 ]]; then
echo $0: usage: plugin.sh name version [destination/path]
exit 1
Expand Down Expand Up @@ -61,29 +63,33 @@ mkdir "$DEST"

rsync \
--exclude '.git' \
--exclude '.github/workflows/continuous-integration.yml' \
--exclude '.github/workflows/create-plugin.sh' \
--exclude 'plugin.sh' \
--exclude 'dist' \
--exclude 'README.md' \
-a . "$DEST"

pushd "$DEST" > /dev/null

#rename .tpl...
for f in `ls *.tpl`
do
mv $f ${f%.*}
done
# Remove .tpl suffix (current folder and subdirectories)
# Note: the .tpl suffix is used to prevent some files from being detected by
# GLPI (like the setup.php) or github (the ci configuration).
find . -type f -name "*.tpl" -exec bash -c 'mv "$0" "${0%.*}"' {} \;

# move xml file
mv plugin.xml $LNAME.xml

#do replacements
sed \
-e "s/{NAME}/$NAME/" \
-e "s/{LNAME}/$LNAME/" \
-e "s/{UNAME}/$UNAME/" \
-e "s/{VERSION}/$VERSION/" \
-e "s/{YEAR}/$YEAR/" \
-i setup.php hook.php $LNAME.xml tools/HEADER README.md
-e "s/{NAME}/$NAME/g" \
-e "s/{LNAME}/$LNAME/g" \
-e "s/{UNAME}/$UNAME/g" \
-e "s/{VERSION}/$VERSION/g" \
-e "s/{YEAR}/$YEAR/g" \
-i setup.php hook.php $LNAME.xml tools/HEADER README.md Makefile .github/workflows/continuous-integration.yml tests/bootstrap.php composer.json

# Unignore composer lock
sed -i '/^[[:space:]]*composer\.lock[[:space:]]*$/d' .gitignore

popd > /dev/null
18 changes: 8 additions & 10 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<key>{LNAME}</key>
<!-- stable, beta, development, alpha, ... -->
<state>stable</state>
<logo>https://raw.githubusercontent.com/pluginsGLPI/{LNAME}/master/{LNAME}.png</logo>
<logo>https://raw.githubusercontent.com/pluginsGLPI/{LNAME}/main/{LNAME}.png</logo>
<description>
<short>
<!-- Add as many lang tag you want -->
<en>{NAME} GLPI plugin.</en>
<en>{NAME} GLPI plugin</en>
<fr>Plugin GLPI {NAME}</fr>
</short>
<long>
<!-- Add as many lang tag you want -->
<en>A long description for {NAME} GLPI plugin.</en>
<fr>Un description longue pour le plugin GLPI {NAME}</fr>
<fr>Une description longue pour le plugin GLPI {NAME}.</fr>
</long>
</description>
<homepage>https://github.com/pluginsGLPI/{LNAME}</homepage>
<download>https://github.com/pluginsGLPI/{LNAME}/releases</download>
<issues>https://github.com/pluginsGLPI/{LNAME}/issues</issues>
<readme>https://github.com/pluginsGLPI/{LNAME}/blob/master/README.md</readme>
<readme>https://github.com/pluginsGLPI/{LNAME}/blob/main/README.md</readme>
<authors>
<!-- Add as many author tag you want -->
<author>Teclib'</author>
Expand All @@ -29,17 +29,15 @@
<version>
<num>{VERSION}</num>
<!-- Add as many compatibility tag you want -->
<compatibility>9.4</compatibility>
<compatibility>9.3</compatibility>
<compatibility>9.2</compatibility>
<compatibility>~11.0.0</compatibility>
</version>
</versions>
<langs>
<!-- Add as many lang tag you want -->
<lang>en_GB</lang>
<lang>fr_FR</lang>
</langs>
<license>GPL V3+</license>
<license>MIT</license>
<!--tags>
<en>
<tag>One tag</tag>
Expand All @@ -51,7 +49,7 @@
</fr>
</tags-->
<!--screenshots>
<screenshot>https://github.com/pluginsGLPI/fields/raw/master/screenshot.png</screenshot>
<screenshot>https://github.com/pluginsGLPI/fields/raw/master/screenshot2.png</screenshot>
<screenshot>https://github.com/pluginsGLPI/{LNAME}/raw/main/screenshot.png</screenshot>
<screenshot>https://github.com/pluginsGLPI/{LNAME}/raw/main/screenshot2.png</screenshot>
</screenshots-->
</root>
10 changes: 10 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<psalm
runTaintAnalysis="true"
>
<projectFiles>
<directory name="src"/>
<file name="hook.php"/>
<file name="setup.php"/>
</projectFiles>
</psalm>
Loading