Skip to content

Commit

Permalink
Feature/ci (#54)
Browse files Browse the repository at this point in the history
* Add CI

* phpcbf

* visibility

* phpstan lvl 0

* phpstan lvl 1

* phpstan lvl 5

* Move external lib

* Remove empty file
  • Loading branch information
trasher authored Nov 14, 2023
1 parent 064d1fe commit 06c9011
Show file tree
Hide file tree
Showing 18 changed files with 1,207 additions and 894 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Continuous integration"

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

jobs:
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
strategy:
fail-fast: false
matrix:
include:
- {glpi-version: "10.0.x", php-version: "7.4", db-image: "mysql:5.7"}
- {glpi-version: "10.0.x", php-version: "8.0", db-image: "mysql:8.0"}
- {glpi-version: "10.0.x", php-version: "8.1", db-image: "mariadb:10.2"}
- {glpi-version: "10.0.x", php-version: "8.2", db-image: "mariadb:11.0"}
- {glpi-version: "10.0.x", php-version: "8.3-rc", db-image: "mysql:8.0"}
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
with:
plugin-key: "treeview"
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"
17 changes: 17 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset>
<file>.</file>
<exclude-pattern>/.git/</exclude-pattern>
<exclude-pattern type="relative">^vendor/</exclude-pattern>

<arg name="colors" />
<arg name="extensions" value="php" />
<arg value="p" />
<arg name="warning-severity" value="0" />

<rule ref="PSR12">
<exclude name="Generic.Files.LineLength" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
<rule ref="Generic.Arrays.ArrayIndent"></rule>
</ruleset>
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"php": ">=7.4"
},
"require-dev": {
"glpi-project/tools": "^0.6"
"glpi-project/tools": "^0.7.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.7"
},
"config": {
"optimize-autoloader": true,
Expand Down
196 changes: 188 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,25 @@
* -------------------------------------------------------------------------
*/

include ('../../../inc/includes.php');
include('../../../inc/includes.php');


$config = new PluginTreeviewConfig();
if (isset($_POST["update"])) {
$config->update($_POST);
Html::back();
$config->update($_POST);
Html::back();
} else {
if (Plugin::isPluginActive("treeview")) {
Html::header(PluginTreeviewConfig::getTypeName(), $_SERVER['PHP_SELF'], "config", "plugin");
$config->showForm(1);
} else {
Html::header(__('Setup'), $_SERVER['PHP_SELF'], "config", "plugin");
// Get the configuration from the database and show it
echo " <script type='text/javascript'>
if (Plugin::isPluginActive("treeview")) {
Html::header(PluginTreeviewConfig::getTypeName(), $_SERVER['PHP_SELF'], "config", "plugin");
$config->showForm(1);
} else {
Html::header(__('Setup'), $_SERVER['PHP_SELF'], "config", "plugin");
// Get the configuration from the database and show it
echo " <script type='text/javascript'>
if (top != self)
top.location = self.location;
</script>";
}
}
}

Html::footer();
8 changes: 4 additions & 4 deletions front/preference.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
* -------------------------------------------------------------------------
*/

include ('../../../inc/includes.php');
include('../../../inc/includes.php');

$pref = new PluginTreeviewPreference();

//Save user preferences
if (isset($_POST['plugin_treeview_user_preferences_save'])) {
$pref->update($_POST);
Html::back();
}
$pref->update($_POST);
Html::back();
}
8 changes: 4 additions & 4 deletions front/preference.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
* -------------------------------------------------------------------------
*/

include ('../../../inc/includes.php');
include('../../../inc/includes.php');

if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
Html::header("TITRE", $_SERVER['PHP_SELF'], "plugins", "pluginexampleexample", "");
Html::header("TITRE", $_SERVER['PHP_SELF'], "plugins", "pluginexampleexample", "");
} else {
Html::helpHeader("TITRE", $_SERVER['PHP_SELF']);
Html::helpHeader("TITRE", $_SERVER['PHP_SELF']);
}

//checkTypeRight('PluginExampleExample',"r");

Search::show('PluginExampleExample');

Html::footer();
Html::footer();
Loading

0 comments on commit 06c9011

Please sign in to comment.