Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Oct 27, 2023
2 parents ddd0e98 + c485ac3 commit b2b7335
Show file tree
Hide file tree
Showing 52 changed files with 3,134 additions and 3,095 deletions.
21 changes: 21 additions & 0 deletions .composer-require-checker.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"php-core-extensions": [
"core",
"standard",
"spl",
"json",
"pcre",
"session",
"mbstring"

],
"symbol-whitelist": [
"Twig\\Extension\\DebugExtension",
"Illuminate\\Support\\Facades\\DB"
],
"scan-files": [
"*.php",
"app/**/.php",
"public/*.php"
]
}
69 changes: 69 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Galette CI

on:
push:
branches:
- master
- develop
- 'feature/*'
- 'hotfix/*'
- 'release/*'
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
name: "Lint on PHP ${{ matrix.php-versions }}"

strategy:
fail-fast: false
matrix:
php-versions: [ '8.1', '8.2', '8.3-rc' ]

steps:
- name: PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer, pecl
coverage: ${{ matrix.coverage }}
extensions: apcu
ini-values: apc.enable_cli=1

- name: "Show versions"
run: |
php --version
composer --version
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Get composer cache directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: |
composer install
- name: CS
run: |
vendor/bin/phpcs -n -p --standard=PSR2 app/ public/index.php
- name: Check missing symbols
run: |
vendor/bin/composer-require-checker check --config-file=.composer-require-checker.config.json composer.json
- name: PHPStan checks
run: |
vendor/bin/phpstan analyze --ansi --memory-limit=2G --no-interaction --no-progress
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ _site/
.buildpath
.project
.settings/
.idea/
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

53 changes: 0 additions & 53 deletions CHANGELOG.md

This file was deleted.

3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2017 GLPI
Copyright (c) 2017-2023 GLPI
Copyright (c) 2023 Galette

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
# Telemetry

PHP application that aims to store some [Telemetry informations](https://glpi-project.github.io/telemetry) sent from your project and display charts based on it.
PHP application that aims to store some Telemetry information sent from your instances and display charts based on it.
It is also able to store references :)

Telemetry has been developped for the [GLPI Project](http://glpi-project.org/) needs; but you can also [configure Telemetry application to suits your project's needs](https://glpi-project.github.io/telemetry/project.html).

Check [installation instructions](https://glpi-project.github.io/telemetry/install.html) to know how to run it.

## Under the hood

* [Slim frawework](https://slimframework.com/)
* [Laravel query builder](https://laravel.com/docs/5.5/queries)
* [PostgreSQL](https://www.postgresql.org/)
* [Boostrap](https://getbootstrap.com/)
* [plotly](https://plot.ly/javascript/)
37 changes: 0 additions & 37 deletions app/Controllers/Contact.php

This file was deleted.

7 changes: 4 additions & 3 deletions app/Controllers/ControllerAbstract.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace GLPI\Telemetry\Controllers;
<?php namespace GaletteTelemetry\Controllers;

use Slim\Container;
use Slim\Views\Twig;
use Slim\Http\Request;
use Slim\Http\Response;
Expand All @@ -19,9 +20,9 @@ abstract class ControllerAbstract
/**
* Controller constructor
*
* @param ContainerInterface $container
* @param Container $container
*/
public function __construct(ContainerInterface $container)
public function __construct(Container $container)
{
$this->container = $container;

Expand Down
23 changes: 11 additions & 12 deletions app/Controllers/Reference.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php namespace GLPI\Telemetry\Controllers;
<?php namespace GaletteTelemetry\Controllers;

use GLPI\Telemetry\Controllers\ControllerAbstract;
use GLPI\Telemetry\Models\Reference as ReferenceModel;
use GLPI\Telemetry\Models\DynamicReference;
use Illuminate\Pagination\LengthAwarePaginator;
use GaletteTelemetry\Models\Reference as ReferenceModel;
use GaletteTelemetry\Models\DynamicReference;
use PHPMailer\PHPMailer\PHPMailer;
use Slim\Http\Request;
use Slim\Http\Response;

Expand Down Expand Up @@ -38,6 +37,7 @@ public function view(Request $req, Response $res, array $args)
$order_sort = $_SESSION['reference']['sort'];

try {
$join_table = '';
//prepare model and common queries
$ref = new ReferenceModel();
$model = $ref->newInstance();
Expand Down Expand Up @@ -111,19 +111,18 @@ function ($key) use ($join_table) {
$references->setPath($this->container->router->pathFor('reference'));

$ref_countries = [];
$existing_countries = ReferenceModel::select('country')->groupBy('country')->get();
$existing_countries = ReferenceModel::query()->select('country')->groupBy('country')->get();
foreach ($existing_countries as $existing_country) {
$ref_countries[] = $existing_country['country'];
}

// render in twig view
$this->render($this->container->project->pathFor('reference.html.twig'), [
'total' => ReferenceModel::active()->count(),
$this->render('default/reference.html.twig', [
'total' => ReferenceModel::query()->where('is_displayed', '=', true)->count(),
'class' => 'reference',
'showmodal' => isset($get['showmodal']),
'uuid' => isset($get['uuid']) ? $get['uuid'] : '',
'references' => $references,
'pagination' => $references->appends($_GET)->render(),
'orderby' => $_SESSION['reference']['orderby'],
'sort' => $_SESSION['reference']['sort'],
'dyn_refs' => $dyn_refs,
Expand Down Expand Up @@ -159,11 +158,11 @@ public function register(Request $req, Response $res)

// create reference in db
if ('' == $ref_data['uuid']) {
$reference = ReferenceModel::create(
$reference = ReferenceModel::query()->create(
$ref_data
);
} else {
$reference = ReferenceModel::updateOrCreate(
$reference = ReferenceModel::query()->updateOrCreate(
['uuid' => $ref_data['uuid']],
$ref_data
);
Expand All @@ -189,7 +188,7 @@ public function register(Request $req, Response $res)
}

// send a mail to admin
$mail = new \PHPMailer;
$mail = new PHPMailer;
$mail->setFrom($this->container['settings']['mail_from']);
$mail->addAddress($this->container['settings']['mail_admin']);
$mail->Subject = "A new reference has been submitted: ".$post['name'];
Expand Down
Loading

0 comments on commit b2b7335

Please sign in to comment.