diff --git a/.gitignore b/.gitignore
index 8dc8d69..669c779 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,5 @@ _site
.sass-cache
.jekyll-metadata
/vendor/*
+.php-cs-fixer.cache
+/tmp-phpqa/*
\ No newline at end of file
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 0000000..886793c
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,14 @@
+in(__DIR__.'/')
+;
+
+return (new PhpCsFixer\Config())
+ ->setRules([
+ '@PhpCsFixer' => true,
+ '@Symfony' => true,
+ ])
+ ->setFinder($finder)
+ ->setCacheFile('.php-cs-fixer.cache')
+;
diff --git a/.spells b/.spells
new file mode 100644
index 0000000..c07b123
--- /dev/null
+++ b/.spells
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+function php-cs-fixer() {
+ docker run --init -it --rm -v "$(pwd):/project" -v "$(pwd)/tmp-phpqa:/tmp" -w /project jakzal/phpqa php-cs-fixer fix -v --no-interaction tools/
+}
+
+function phpstan() {
+ docker run --init -it --rm -v "$(pwd):/project" -v "$(pwd)/tmp-phpqa:/tmp" -w /project jakzal/phpqa phpstan analyse --level=7 tools/
+}
+
+echo php-cs-fixer phpstan php
\ No newline at end of file
diff --git a/_config.yml b/_config.yml
index fbff253..8c6e7a7 100644
--- a/_config.yml
+++ b/_config.yml
@@ -42,3 +42,4 @@ exclude:
- Gemfile.lock
- docker-compose.yml
- vendor/bundle/
+ - tools/
diff --git a/check_faros_version/check_10_1.php b/check_faros_version/check_10_1.php
deleted file mode 100644
index c810c57..0000000
--- a/check_faros_version/check_10_1.php
+++ /dev/null
@@ -1,489 +0,0 @@
- $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
- ],
- \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
- ]);
- //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
- $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
- //var_dump(curl_getinfo($ch));
- curl_close($ch);
- if (200 === $httpCode) {
- $check = true;
- }
-
- return [
- 'prerequis' => 'SSL & HTTP/2',
- 'check' => $check,
- 'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
- ];
-}
-
-// for OpCache
-function get_call_itself_check(string $url, ?string $username, ?string $password): array
-{
- $check = false;
- $curl = curl_init();
-
- curl_setopt_array($curl, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
- ],
- ]);
-
- $response = curl_exec($curl);
-
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- $response = curl_exec($curl);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = true;
- }
-
- return [
- 'prerequis' => 'Peut appeler '.$url,
- 'check' => $check,
- 'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
- ];
-}
-
-function get_bs_class(bool $check): string
-{
- return true === $check ? 'success' : 'danger';
-}
-
-function get_binaries_check(): array
-{
- $checks = [];
- $binaries = ['/usr/bin/git', '/usr/bin/curl'];
- foreach ($binaries as $binary) {
- $check = is_executable($binary);
- $checks[] = [
- 'prerequis' => 'Binaire '.$binary,
- 'check' => $check,
- 'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
- }
-
- return $checks;
-}
-
-// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
-function get_lephare_keys_check(): array
-{
- $check = false;
- $curl = curl_init();
- curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
- curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, \CURLOPT_HEADER, false);
- $data = curl_exec($curl);
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
- }
-
- return [
- 'prerequis' => 'Authentification SSH',
- 'check' => $check,
- 'errorMessage' => true === $check ? '' : 'Contenus différents',
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
-}
-
-function get_php_version_check(string $PHP_VERSION): array
-{
- $check = version_compare(\PHP_VERSION, $PHP_VERSION, 'gt') && PHP_VERSION_ID < 80000;
-
- return [
- 'prerequis' => 'PHP_VERSION',
- 'check' => $check,
- 'errorMessage' => $check ? '' : 'Valeur détectée: '.\PHP_VERSION.'. Valeur attendue: '.$PHP_VERSION,
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
-}
-
-function get_document_root_check(): array
-{
- $check = false;
- $documentRoot = realpath($_SERVER['DOCUMENT_ROOT']);
- if (__DIR__ !== $documentRoot) {
- $errorMessage = 'DocumentRoot:KO : Le serveur pointe sur '.__DIR__.' au lieu de '.$documentRoot;
- } else {
- $check = true;
- }
-
- return [
- 'prerequis' => 'DocumentRoot',
- 'check' => $check,
- 'errorMessage' => $errorMessage ?? '',
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
-}
-
-function get_php_configuration_checks(): array
-{
- $checks = [];
- $settings = [
- // 'short_open_tag' => 'off', PHP_INI_PERDIR https://www.php.net/manual/en/ini.core.php
- // 'magic_quotes_gpc' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- // 'register_globals' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- 'session.auto_start' => 'off',
- 'date.timezone' => 'Europe/Paris',
- 'upload_max_filesize' => '32M',
- 'post_max_size' => '33M',
- 'sys_temp_dir' => '/var/tmp',
- 'upload_tmp_dir' => '/var/tmp',
- 'session.save_handler' => 'memcached',
- 'session.save_path' => 'localhost:11211',
- 'memcached.sess_lock_wait_min' => '150',
- 'memcached.sess_lock_wait_max' => '150',
- 'memcached.sess_lock_retries' => '800',
- 'opcache.revalidate_freq' => '0',
- 'opcache.validate_timestamps' => '0',
- 'opcache.max_accelerated_files' => '7963',
- 'opcache.memory_consumption' => '192',
- 'opcache.interned_strings_buffer' => '16',
- // 'opcache.fast_shutdown' => '1', // removed in php 7.2
- 'memory_limit' => '128M',
- 'opcache.enable' => '1',
- ];
- foreach ($settings as $key => $expected) {
- $check = strtolower($expected) === strtolower(ini_get($key));
- $checks[] = [
- 'prerequis' => $key.' = '.$expected,
- 'check' => $check,
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : ini_get($key),
- ];
- }
-
- return $checks;
-}
-
-function get_loaded_extensions_symfony_checks(): array
-{
- $checks = [];
- $symfonyRequirements = [
- 'ctype',
- 'iconv',
- 'json',
- 'pcre',
- 'session',
- 'SimpleXML',
- 'tokenizer',
- ];
-
- foreach ($symfonyRequirements as $item) {
- $check = extension_loaded($item);
- $checks[] = [
- 'prerequis' => $item,
- 'check' => $check,
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
- }
-
- return $checks;
-}
-
-function get_loaded_extensions_faros_checks(): array
-{
- $checks = [];
- $farosRequirements = [
- 'curl',
- 'gd',
- 'intl',
- 'mbstring',
- 'pdo',
- 'pdo_pgsql',
- 'pgsql',
- 'posix',
- 'xml',
- //'opcache',
- 'memcached',
- 'imagick',
- 'apcu',
- // TODO: ne marche pas 'apcu_bc',
- 'exif',
- 'zip',
- 'soap',
- ];
- foreach ($farosRequirements as $item) {
- $check = extension_loaded($item);
- $checks[] = [
- 'prerequis' => $item,
- 'check' => $check,
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
- }
-
- return $checks;
-}
-
-$html = <<
-
-
-
-
- Test compatibilité faros {$FAROS_VERSION}
-
-
-
-
-
-
-
-
Test compatibilité Faros {$FAROS_VERSION}
-
-HTML;
-$mainChecks = <<
-
-
- Prérequis |
- OK ? |
-
-
-
-HTML;
-
-/*
-$lephareKeysCheck = getLephareKeysCheck();
-$mainChecks .= <<
- {$lephareKeysCheck['prerequis']} |
- {$lephareKeysCheck['checkLabel']} {$lephareKeysCheck['errorMessage']} |
-
-HTML;
- */
-
-$callItselfCheck = get_call_itself_check($URL, $USERNAME, $PASSWORD);
-$mainChecks .= <<
- {$callItselfCheck['prerequis']} |
- {$callItselfCheck['checkLabel']} {$callItselfCheck['errorMessage']} |
-
-HTML;
-
-$phpVersionCheck = get_php_version_check($PHP_VERSION);
-$mainChecks .= <<
- {$phpVersionCheck['prerequis']} |
- {$phpVersionCheck['checkLabel']} {$phpVersionCheck['errorMessage']} |
-
-HTML;
-
-$mainChecks .= <<
-
-HTML;
-
-$html .= $mainChecks;
-
-$binariesChecksTable = <<
-
-
- Binaires |
- OK ? |
-
-
-
-HTML;
-$binariesChecks = get_binaries_check();
-foreach ($binariesChecks as $binaryCheck) {
- $binariesChecksTable .= <<
- {$binaryCheck['prerequis']} |
- {$binaryCheck['checkLabel']} |
-
-HTML;
-}
-$binariesChecksTable .= <<
-
-HTML;
-
-$html .= $binariesChecksTable;
-
-$html .= <<Configuration PHP
-Extensions #
-HTML;
-
-$symfonyExtensionsTable = <<
-
-
- Pré-requis pour Symfony |
- OK ? |
-
-
-
-HTML;
-$loadedExtensionsSymfonyChecks = get_loaded_extensions_symfony_checks();
-foreach ($loadedExtensionsSymfonyChecks as $loadedExtensionsCheck) {
- $symfonyExtensionsTable .= <<
- {$loadedExtensionsCheck['prerequis']} |
- {$loadedExtensionsCheck['checkLabel']} |
-
-HTML;
-}
-$symfonyExtensionsTable .= <<
-
-HTML;
-
-$html .= $symfonyExtensionsTable;
-
-$farosExtensionsTable = <<
-
-
- Extensions supplémentaires pour nos applications |
- OK ? |
-
-
-
-HTML;
-$loadedExtensionsFarosChecks = get_loaded_extensions_faros_checks();
-foreach ($loadedExtensionsFarosChecks as $loadedExtensionsCheck) {
- $farosExtensionsTable .= <<
- {$loadedExtensionsCheck['prerequis']} |
- {$loadedExtensionsCheck['checkLabel']} |
-
-HTML;
-}
-$farosExtensionsTable .= <<
-
-HTML;
-
-$html .= $farosExtensionsTable;
-
-$html .= <<php.ini #
-HTML;
-
-$phpConfigurationCheckTable = <<
-
-
- Setting |
- OK ? |
-
-
-
-HTML;
-$phpConfigurationChecks = get_php_configuration_checks();
-foreach ($phpConfigurationChecks as $check) {
- $phpConfigurationCheckTable .= <<
- {$check['prerequis']} |
- {$check['checkLabel']} {$check['errorMessage']} |
-
-HTML;
-}
-$phpConfigurationCheckTable .= <<
-
-HTML;
-
-$html .= $phpConfigurationCheckTable;
-
-$html .= <<Configuration Apache #
-HTML;
-
-$documentRootCheck = get_document_root_check();
-$sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
-$apacheChecks = <<
-
-
- Setting |
- OK ? |
-
-
-
-
-HTML;
-
-$apacheChecks .= <<
- {$documentRootCheck['prerequis']} |
- {$documentRootCheck['checkLabel']} {$documentRootCheck['errorMessage']} |
-
-HTML;
-
-/*
-
- {$sslHttp2Check['prerequis']} |
- {$sslHttp2Check['checkLabel']} {$sslHttp2Check['errorMessage']} |
-
-*/
-
-$apacheChecks .= <<
-
-
-
-
-
-HTML;
-
-echo $html;
diff --git a/docs/config/base.md b/docs/config/base.md
deleted file mode 100644
index db393fa..0000000
--- a/docs/config/base.md
+++ /dev/null
@@ -1,134 +0,0 @@
----
-layout: default
-title: Configuration
-nav_order: 2
-permalink: /configuration
-has_children: true
----
-
-# Configuration de base
-{: .no_toc }
-
-1. TOC
-{:toc}
-
-## Dimensionnement machine
-
-Nous exigeons au minimum :
- * 2 vCPU
- * 4Go RAM
-
-## Authentification SSH
-
-La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
-
- curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
- chmod 0600 ~/.ssh/authorized_keys
-
-La liste des adresses ips à autoriser :
- * 37.59.114.65
- * 193.39.2.4
- * 80.15.143.1
-
-
-## Binaires
-
- - git
- - git-lfs
- - curl
- - rsync
- - pg_dump (utilisé par lephare/ansible-deploy)
- - Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
-
-## Droits
-
-### Logs
-
-Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
-
-- Apache access.log
-- Apache error.log
-- PHP-FPM log
-
-## Configuration PHP
-
-### Extensions
-
-Pré-requis pour Symfony 6.x
-
- * ctype
- * iconv
- * pcre
- * session
- * SimpleXML
- * tokenizer
- * sodium
-
-Extensions supplémentaires pour nos applications
-
- * curl
- * gd
- * intl
- * mbstring
- * pcntl
- * pdo
- * pdo_pgsql
- * pgsql
- * posix
- * xml
- * opcache
- * memcached
- * imagick
- * apcu
- * exif
- * zip
- * soap
-
-### php.ini
-
- display_errors = Off
- display_startup_errors = Off
- short_open_tag = Off
- session.auto_start = Off
- date.timezone = Europe/Paris
- upload_max_filesize = 32M
- post_max_size = 33M
- sys_temp_dir = /var/tmp
- upload_tmp_dir = /var/tmp
-
- # Les sessions sont stockées dans memcached
- session.save_handler = memcached
- session.save_path = localhost:11211
- memcached.sess_lock_wait_min = 150
- memcached.sess_lock_wait_max = 150
- memcached.sess_lock_retries = 800
-
- # Optimisation Opcache
- opcache.revalidate_freq=0
- opcache.validate_timestamps=0
- opcache.max_accelerated_files=20000
- opcache.memory_consumption=256
- opcache.interned_strings_buffer=16
-
- # Realpath cache
- realpath_cache_size=4096K
- realpath_cache_ttl=60
-
-## Configuration Apache
-
-### SSL & HTTP/2
-
-Chaque vhost doit être accessible en HTTPS et HTTP/2.
-
-### Configuration vhost
-
- DocumentRoot /current/public/
- Options FollowSymLinks
- Protocols h2 http/1.1
-
-### Modules
-
- * mod_rewrite On
- * mod_headers On
- * mod_expires On
- * mod_deflate On
diff --git a/docs/generated/versions_pages/10.0.md b/docs/generated/versions_pages/10.0.md
new file mode 100644
index 0000000..0916f8b
--- /dev/null
+++ b/docs/generated/versions_pages/10.0.md
@@ -0,0 +1,168 @@
+---
+layout: default
+title: 10.0 (2019.10)
+nav_order: 6
+parent: Versions
+permalink: docs/versions/10.0.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# 10.0
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_10.0.php](../versions_tests_scripts/check_10.0.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian 10
+- PHP 7.3
+- Apache 2.4
+- PostgreSQL 11
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * 2 vCPU
+ * 4 Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+* 37.59.114.65
+* 193.39.2.4
+* 80.15.143.1
+
+
+## Binaires
+* Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
+* curl
+* git
+* git-lfs
+* pg_dump (utilisé par lephare/ansible-deploy)
+* rsync
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+* SimpleXML
+* ctype
+* iconv
+* json
+* pcre
+* session
+* tokenizer
+
+Extensions supplémentaires pour nos applications
+* opcache - not tested by check_script
+* pcntl - not tested by check_script
+* apcu
+* curl
+* exif
+* gd
+* imagick
+* intl
+* mbstring
+* memcached
+* pdo
+* pdo_pgsql
+* pgsql
+* posix
+* soap
+* xml
+* zip
+
+### php.ini
+ display_errors = Off
+ display_startup_errors = Off
+ session.auto_start = off
+ date.timezone = Europe/Paris
+ upload_max_filesize = 32M
+ post_max_size = 33M
+ sys_temp_dir = /var/tmp
+ upload_tmp_dir = /var/tmp
+
+
+ # Les sessions sont stockées dans memcached -->
+ session.save_handler = memcached
+ session.save_path = localhost:11211
+ memcached.sess_lock_wait_min = 150
+ memcached.sess_lock_wait_max = 150
+ memcached.sess_lock_retries = 800
+
+
+ # Optimisation opcache -->
+ opcache.revalidate_freq = 0
+ opcache.validate_timestamps = 0
+ opcache.max_accelerated_files = 20000
+ opcache.memory_consumption = 256
+ opcache.interned_strings_buffer = 16
+ short_open_tag = Off
+ memory_limit = 128M
+ opcache.enable = 1
+
+
+ # Realpath cache -->
+ realpath_cache_size = 4096K
+ realpath_cache_ttl = 60
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/docs/generated/versions_pages/10.1.md b/docs/generated/versions_pages/10.1.md
new file mode 100644
index 0000000..adb703f
--- /dev/null
+++ b/docs/generated/versions_pages/10.1.md
@@ -0,0 +1,168 @@
+---
+layout: default
+title: 10.1 (2021.03)
+nav_order: 5
+parent: Versions
+permalink: docs/versions/10.1.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# 10.1
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_10.1.php](../versions_tests_scripts/check_10.1.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian 10
+- PHP 7.4
+- Apache 2.4
+- PostgreSQL 11
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * 2 vCPU
+ * 4 Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+* 37.59.114.65
+* 193.39.2.4
+* 80.15.143.1
+
+
+## Binaires
+* Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
+* curl
+* git
+* git-lfs
+* pg_dump (utilisé par lephare/ansible-deploy)
+* rsync
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+* SimpleXML
+* ctype
+* iconv
+* json
+* pcre
+* session
+* tokenizer
+
+Extensions supplémentaires pour nos applications
+* opcache - not tested by check_script
+* pcntl - not tested by check_script
+* apcu
+* curl
+* exif
+* gd
+* imagick
+* intl
+* mbstring
+* memcached
+* pdo
+* pdo_pgsql
+* pgsql
+* posix
+* soap
+* xml
+* zip
+
+### php.ini
+ display_errors = Off
+ display_startup_errors = Off
+ session.auto_start = off
+ date.timezone = Europe/Paris
+ upload_max_filesize = 32M
+ post_max_size = 33M
+ sys_temp_dir = /var/tmp
+ upload_tmp_dir = /var/tmp
+
+
+ # Les sessions sont stockées dans memcached -->
+ session.save_handler = memcached
+ session.save_path = localhost:11211
+ memcached.sess_lock_wait_min = 150
+ memcached.sess_lock_wait_max = 150
+ memcached.sess_lock_retries = 800
+
+
+ # Optimisation opcache -->
+ opcache.revalidate_freq = 0
+ opcache.validate_timestamps = 0
+ opcache.max_accelerated_files = 20000
+ opcache.memory_consumption = 256
+ opcache.interned_strings_buffer = 16
+ short_open_tag = Off
+ memory_limit = 128M
+ opcache.enable = 1
+
+
+ # Realpath cache -->
+ realpath_cache_size = 4096K
+ realpath_cache_ttl = 60
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/docs/generated/versions_pages/2022.01.md b/docs/generated/versions_pages/2022.01.md
new file mode 100644
index 0000000..2527a93
--- /dev/null
+++ b/docs/generated/versions_pages/2022.01.md
@@ -0,0 +1,168 @@
+---
+layout: default
+title: 2022.01
+nav_order: 4
+parent: Versions
+permalink: docs/versions/2022.01.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# 2022.01
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_2022.01.php](../versions_tests_scripts/check_2022.01.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian 11.2
+- PHP 8.1
+- Apache 2.4
+- PostgreSQL 13
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * 2 vCPU
+ * 4 Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+* 37.59.114.65
+* 193.39.2.4
+* 80.15.143.1
+
+
+## Binaires
+* Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
+* curl
+* git
+* git-lfs
+* pg_dump (utilisé par lephare/ansible-deploy)
+* rsync
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+* SimpleXML
+* ctype
+* iconv
+* json
+* pcre
+* session
+* tokenizer
+
+Extensions supplémentaires pour nos applications
+* opcache - not tested by check_script
+* pcntl - not tested by check_script
+* apcu
+* curl
+* exif
+* gd
+* imagick
+* intl
+* mbstring
+* memcached
+* pdo
+* pdo_pgsql
+* pgsql
+* posix
+* soap
+* xml
+* zip
+
+### php.ini
+ display_errors = Off
+ display_startup_errors = Off
+ session.auto_start = off
+ date.timezone = Europe/Paris
+ upload_max_filesize = 32M
+ post_max_size = 33M
+ sys_temp_dir = /var/tmp
+ upload_tmp_dir = /var/tmp
+
+
+ # Les sessions sont stockées dans memcached -->
+ session.save_handler = memcached
+ session.save_path = localhost:11211
+ memcached.sess_lock_wait_min = 150
+ memcached.sess_lock_wait_max = 150
+ memcached.sess_lock_retries = 800
+
+
+ # Optimisation opcache -->
+ opcache.revalidate_freq = 0
+ opcache.validate_timestamps = 0
+ opcache.max_accelerated_files = 20000
+ opcache.memory_consumption = 256
+ opcache.interned_strings_buffer = 16
+ short_open_tag = Off
+ memory_limit = 128M
+ opcache.enable = 1
+
+
+ # Realpath cache -->
+ realpath_cache_size = 4096K
+ realpath_cache_ttl = 60
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/docs/generated/versions_pages/2022.07.md b/docs/generated/versions_pages/2022.07.md
new file mode 100644
index 0000000..0a1703b
--- /dev/null
+++ b/docs/generated/versions_pages/2022.07.md
@@ -0,0 +1,168 @@
+---
+layout: default
+title: 2022.07
+nav_order: 3
+parent: Versions
+permalink: docs/versions/2022.07.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# 2022.07
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_2022.07.php](../versions_tests_scripts/check_2022.07.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian 11.3
+- PHP 8.1
+- Apache 2.4
+- PostgreSQL 13
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * 2 vCPU
+ * 4 Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+* 37.59.114.65
+* 193.39.2.4
+* 80.15.143.1
+
+
+## Binaires
+* Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
+* curl
+* git
+* git-lfs
+* pg_dump (utilisé par lephare/ansible-deploy)
+* rsync
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+* SimpleXML
+* ctype
+* iconv
+* json
+* pcre
+* session
+* tokenizer
+
+Extensions supplémentaires pour nos applications
+* opcache - not tested by check_script
+* pcntl - not tested by check_script
+* apcu
+* curl
+* exif
+* gd
+* imagick
+* intl
+* mbstring
+* memcached
+* pdo
+* pdo_pgsql
+* pgsql
+* posix
+* soap
+* xml
+* zip
+
+### php.ini
+ display_errors = Off
+ display_startup_errors = Off
+ session.auto_start = off
+ date.timezone = Europe/Paris
+ upload_max_filesize = 32M
+ post_max_size = 33M
+ sys_temp_dir = /var/tmp
+ upload_tmp_dir = /var/tmp
+
+
+ # Les sessions sont stockées dans memcached -->
+ session.save_handler = memcached
+ session.save_path = localhost:11211
+ memcached.sess_lock_wait_min = 150
+ memcached.sess_lock_wait_max = 150
+ memcached.sess_lock_retries = 800
+
+
+ # Optimisation opcache -->
+ opcache.revalidate_freq = 0
+ opcache.validate_timestamps = 0
+ opcache.max_accelerated_files = 20000
+ opcache.memory_consumption = 256
+ opcache.interned_strings_buffer = 16
+ short_open_tag = Off
+ memory_limit = 128M
+ opcache.enable = 1
+
+
+ # Realpath cache -->
+ realpath_cache_size = 4096K
+ realpath_cache_ttl = 60
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/docs/generated/versions_pages/2023.04.md b/docs/generated/versions_pages/2023.04.md
new file mode 100644
index 0000000..4506787
--- /dev/null
+++ b/docs/generated/versions_pages/2023.04.md
@@ -0,0 +1,168 @@
+---
+layout: default
+title: 2023.04
+nav_order: 2
+parent: Versions
+permalink: docs/versions/2023.04.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# 2023.04
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_2023.04.php](../versions_tests_scripts/check_2023.04.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian 11.6
+- PHP 8.2
+- Apache 2.4
+- PostgreSQL 14
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * 2 vCPU
+ * 4 Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+* 37.59.114.65
+* 193.39.2.4
+* 80.15.143.1
+
+
+## Binaires
+* Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
+* curl
+* git
+* git-lfs
+* pg_dump (utilisé par lephare/ansible-deploy)
+* rsync
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+* SimpleXML
+* ctype
+* iconv
+* json
+* pcre
+* session
+* tokenizer
+
+Extensions supplémentaires pour nos applications
+* opcache - not tested by check_script
+* pcntl - not tested by check_script
+* apcu
+* curl
+* exif
+* gd
+* imagick
+* intl
+* mbstring
+* memcached
+* pdo
+* pdo_pgsql
+* pgsql
+* posix
+* soap
+* xml
+* zip
+
+### php.ini
+ display_errors = Off
+ display_startup_errors = Off
+ session.auto_start = off
+ date.timezone = Europe/Paris
+ upload_max_filesize = 32M
+ post_max_size = 33M
+ sys_temp_dir = /var/tmp
+ upload_tmp_dir = /var/tmp
+
+
+ # Les sessions sont stockées dans memcached -->
+ session.save_handler = memcached
+ session.save_path = localhost:11211
+ memcached.sess_lock_wait_min = 150
+ memcached.sess_lock_wait_max = 150
+ memcached.sess_lock_retries = 800
+
+
+ # Optimisation opcache -->
+ opcache.revalidate_freq = 0
+ opcache.validate_timestamps = 0
+ opcache.max_accelerated_files = 20000
+ opcache.memory_consumption = 256
+ opcache.interned_strings_buffer = 16
+ short_open_tag = Off
+ memory_limit = 128M
+ opcache.enable = 1
+
+
+ # Realpath cache -->
+ realpath_cache_size = 4096K
+ realpath_cache_ttl = 60
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/docs/generated/versions_pages/2023.06.md b/docs/generated/versions_pages/2023.06.md
new file mode 100644
index 0000000..756f1f0
--- /dev/null
+++ b/docs/generated/versions_pages/2023.06.md
@@ -0,0 +1,168 @@
+---
+layout: default
+title: 2023.06
+nav_order: 1
+parent: Versions
+permalink: docs/versions/2023.06.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# 2023.06
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_2023.06.php](../versions_tests_scripts/check_2023.06.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian 12
+- PHP 8.2
+- Apache 2.4
+- PostgreSQL 15
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * 2 vCPU
+ * 4 Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+* 37.59.114.65
+* 193.39.2.4
+* 80.15.143.1
+
+
+## Binaires
+* Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
+* curl
+* git
+* git-lfs
+* pg_dump (utilisé par lephare/ansible-deploy)
+* rsync
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+* SimpleXML
+* ctype
+* iconv
+* json
+* pcre
+* session
+* tokenizer
+
+Extensions supplémentaires pour nos applications
+* opcache - not tested by check_script
+* pcntl - not tested by check_script
+* apcu
+* curl
+* exif
+* gd
+* imagick
+* intl
+* mbstring
+* memcached
+* pdo
+* pdo_pgsql
+* pgsql
+* posix
+* soap
+* xml
+* zip
+
+### php.ini
+ display_errors = Off
+ display_startup_errors = Off
+ session.auto_start = off
+ date.timezone = Europe/Paris
+ upload_max_filesize = 32M
+ post_max_size = 33M
+ sys_temp_dir = /var/tmp
+ upload_tmp_dir = /var/tmp
+
+
+ # Les sessions sont stockées dans memcached -->
+ session.save_handler = memcached
+ session.save_path = localhost:11211
+ memcached.sess_lock_wait_min = 150
+ memcached.sess_lock_wait_max = 150
+ memcached.sess_lock_retries = 800
+
+
+ # Optimisation opcache -->
+ opcache.revalidate_freq = 0
+ opcache.validate_timestamps = 0
+ opcache.max_accelerated_files = 20000
+ opcache.memory_consumption = 256
+ opcache.interned_strings_buffer = 16
+ short_open_tag = Off
+ memory_limit = 128M
+ opcache.enable = 1
+
+
+ # Realpath cache -->
+ realpath_cache_size = 4096K
+ realpath_cache_ttl = 60
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/docs/generated/versions_pages/9.0.md b/docs/generated/versions_pages/9.0.md
new file mode 100644
index 0000000..066c42e
--- /dev/null
+++ b/docs/generated/versions_pages/9.0.md
@@ -0,0 +1,168 @@
+---
+layout: default
+title: 9.0 (2019.03)
+nav_order: 7
+parent: Versions
+permalink: docs/versions/9.0.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# 9.0
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_9.0.php](../versions_tests_scripts/check_9.0.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian 9
+- PHP 7.3
+- Apache 2.4
+- PostgreSQL 9.6
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * 2 vCPU
+ * 4 Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+* 37.59.114.65
+* 193.39.2.4
+* 80.15.143.1
+
+
+## Binaires
+* Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)
+* curl
+* git
+* git-lfs
+* pg_dump (utilisé par lephare/ansible-deploy)
+* rsync
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+* SimpleXML
+* ctype
+* iconv
+* json
+* pcre
+* session
+* tokenizer
+
+Extensions supplémentaires pour nos applications
+* opcache - not tested by check_script
+* pcntl - not tested by check_script
+* apcu
+* curl
+* exif
+* gd
+* imagick
+* intl
+* mbstring
+* memcached
+* pdo
+* pdo_pgsql
+* pgsql
+* posix
+* soap
+* xml
+* zip
+
+### php.ini
+ display_errors = Off
+ display_startup_errors = Off
+ session.auto_start = off
+ date.timezone = Europe/Paris
+ upload_max_filesize = 32M
+ post_max_size = 33M
+ sys_temp_dir = /var/tmp
+ upload_tmp_dir = /var/tmp
+
+
+ # Les sessions sont stockées dans memcached -->
+ session.save_handler = memcached
+ session.save_path = localhost:11211
+ memcached.sess_lock_wait_min = 150
+ memcached.sess_lock_wait_max = 150
+ memcached.sess_lock_retries = 800
+
+
+ # Optimisation opcache -->
+ opcache.revalidate_freq = 0
+ opcache.validate_timestamps = 0
+ opcache.max_accelerated_files = 20000
+ opcache.memory_consumption = 256
+ opcache.interned_strings_buffer = 16
+ short_open_tag = Off
+ memory_limit = 128M
+ opcache.enable = 1
+
+
+ # Realpath cache -->
+ realpath_cache_size = 4096K
+ realpath_cache_ttl = 60
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/docs/generated/versions_tests_scripts/check_10.0.php b/docs/generated/versions_tests_scripts/check_10.0.php
new file mode 100644
index 0000000..f9dcf5f
--- /dev/null
+++ b/docs/generated/versions_tests_scripts/check_10.0.php
@@ -0,0 +1,505 @@
+","session.save_handler":"memcached","session.save_path":"localhost:11211","memcached.sess_lock_wait_min":"150","memcached.sess_lock_wait_max":"150","memcached.sess_lock_retries":"800","_comment2":"\n\n\t# Optimisation opcache -->","opcache.revalidate_freq":"0","opcache.validate_timestamps":"0","opcache.max_accelerated_files":"20000","opcache.memory_consumption":"<=256","opcache.interned_strings_buffer":"16","short_open_tag":"Off","memory_limit":"128M","opcache.enable":"1","_comment3":"\n\n\t# Realpath cache -->","realpath_cache_size":"4096K","realpath_cache_ttl":"60"},"symfony_requirements":["SimpleXML","ctype","iconv","json","pcre","session","tokenizer"],"URL":"https:\/\/acme.fr"}'); // injected by the generator php script, homemade php template manager
+// DEBUT ZONE A EDITER *************************************************************************************************
+if (null === $versionData) {
+ echo 'injected json read is null';
+ exit(84);
+}
+$FAROS_VERSION = $versionData->version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
+
+// htaccess
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
+
+// FIN DE ZONE A EDITER *******************************************************************************************
+
+$PHP_VERSION = $versionData->php_version;
+
+// TODO: KO
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
+
+// for OpCache
+function get_call_itself_check(string $url, ?string $username, ?string $password): array
+{
+ $check = false;
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+ ],
+ ]);
+
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
+ }
+
+ return [
+ 'prerequis' => 'Peut appeler '.$url,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
+ ];
+}
+
+function get_bs_class(bool $check): string
+{
+ return true === $check ? 'success' : 'danger';
+}
+
+function get_binaries_check(): array
+{
+ global $versionData;
+ $checks = [];
+ $binaries = $versionData->binaries;
+ foreach ($binaries as $binary) {
+ $check = is_executable($binary);
+ $checks[] = [
+ 'prerequis' => 'Binaire '.$binary,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
+
+function get_php_version_check(string $PHP_VERSION): array
+{
+ $check = version_compare(\PHP_VERSION, $PHP_VERSION, 'gt') && 0 === strpos(\PHP_VERSION, $PHP_VERSION[0]);
+
+ return [
+ 'prerequis' => 'PHP_VERSION',
+ 'check' => $check,
+ 'errorMessage' => $check ? '' : 'Valeur détectée: '.\PHP_VERSION.'. Valeur attendue: '.$PHP_VERSION,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function get_document_root_check(): array
+{
+ $check = false;
+ $documentRoot = realpath($_SERVER['DOCUMENT_ROOT']);
+ if (__DIR__ !== $documentRoot) {
+ $errorMessage = 'DocumentRoot:KO : Le serveur pointe sur '.__DIR__.' au lieu de '.$documentRoot;
+ } else {
+ $check = true;
+ }
+
+ return [
+ 'prerequis' => 'DocumentRoot',
+ 'check' => $check,
+ 'errorMessage' => $errorMessage ?? '',
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
+function get_php_configuration_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $settings = $versionData->settings;
+
+ foreach ($settings as $key => $expected) {
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
+ $checks[] = [
+ 'prerequis' => $key.' = '.$expected,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ 'errorMessage' => true === $check ? '' : $errMessage,
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_symfony_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $symfonyRequirements = $versionData->symfony_requirements;
+
+ foreach ($symfonyRequirements as $item) {
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_faros_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $farosRequirements = $versionData->faros_requirements;
+ foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+$html = <<
+
+
+
+
+ Test compatibilité faros {$FAROS_VERSION}
+
+
+
+
+
+
+
+
Test compatibilité Faros {$FAROS_VERSION}
+
+HTML;
+$mainChecks = <<<'HTML'
+
+
+
+
+ Prérequis |
+ OK ? |
+
+
+
+HTML;
+
+/*
+$lephareKeysCheck = getLephareKeysCheck();
+$mainChecks .= <<
+ {$lephareKeysCheck['prerequis']} |
+ {$lephareKeysCheck['checkLabel']} {$lephareKeysCheck['errorMessage']} |
+
+HTML;
+ */
+
+$callItselfCheck = get_call_itself_check($URL, $USERNAME, $PASSWORD);
+$mainChecks .= <<
+ {$callItselfCheck['prerequis']} |
+ {$callItselfCheck['checkLabel']} {$callItselfCheck['errorMessage']} |
+
+HTML;
+
+$phpVersionCheck = get_php_version_check($PHP_VERSION);
+$mainChecks .= <<
+ {$phpVersionCheck['prerequis']} |
+ {$phpVersionCheck['checkLabel']} {$phpVersionCheck['errorMessage']} |
+
+HTML;
+
+$mainChecks .= <<<'HTML'
+
+
+HTML;
+
+$html .= $mainChecks;
+
+$binariesChecksTable = <<<'HTML'
+
+
+
+ Binaires |
+ OK ? |
+
+
+
+HTML;
+$binariesChecks = get_binaries_check();
+foreach ($binariesChecks as $binaryCheck) {
+ $binariesChecksTable .= <<
+ {$binaryCheck['prerequis']} |
+ {$binaryCheck['checkLabel']} |
+
+HTML;
+}
+$binariesChecksTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $binariesChecksTable;
+
+$html .= <<<'HTML'
+
Configuration PHP
+
Extensions #
+HTML;
+
+$symfonyExtensionsTable = <<<'HTML'
+
+
+
+ Pré-requis pour Symfony |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsSymfonyChecks = get_loaded_extensions_symfony_checks();
+foreach ($loadedExtensionsSymfonyChecks as $loadedExtensionsCheck) {
+ $symfonyExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$symfonyExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $symfonyExtensionsTable;
+
+$farosExtensionsTable = <<<'HTML'
+
+
+
+ Extensions supplémentaires pour nos applications |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsFarosChecks = get_loaded_extensions_faros_checks();
+foreach ($loadedExtensionsFarosChecks as $loadedExtensionsCheck) {
+ $farosExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$farosExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $farosExtensionsTable;
+
+$html .= <<<'HTML'
+
php.ini #
+HTML;
+
+$phpConfigurationCheckTable = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+HTML;
+$phpConfigurationChecks = get_php_configuration_checks();
+foreach ($phpConfigurationChecks as $check) {
+ $phpConfigurationCheckTable .= <<
+ {$check['prerequis']} |
+ {$check['checkLabel']} {$check['errorMessage']} |
+
+HTML;
+}
+$phpConfigurationCheckTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $phpConfigurationCheckTable;
+
+$html .= <<<'HTML'
+
Configuration Apache #
+HTML;
+
+$documentRootCheck = get_document_root_check();
+// $sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
+$apacheChecks = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+
+HTML;
+
+$apacheChecks .= <<
+ {$documentRootCheck['prerequis']} |
+ {$documentRootCheck['checkLabel']} {$documentRootCheck['errorMessage']} |
+
+HTML;
+
+/*
+
+ {$sslHttp2Check['prerequis']} |
+ {$sslHttp2Check['checkLabel']} {$sslHttp2Check['errorMessage']} |
+
+*/
+
+$apacheChecks .= <<<'HTML'
+
+HTML;
+
+$html .= $apacheChecks;
+
+$html .= <<<'HTML'
+
+
+
+
+
+
+HTML;
+
+echo $html;
diff --git a/docs/generated/versions_tests_scripts/check_10.1.php b/docs/generated/versions_tests_scripts/check_10.1.php
new file mode 100644
index 0000000..c33e314
--- /dev/null
+++ b/docs/generated/versions_tests_scripts/check_10.1.php
@@ -0,0 +1,505 @@
+","session.save_handler":"memcached","session.save_path":"localhost:11211","memcached.sess_lock_wait_min":"150","memcached.sess_lock_wait_max":"150","memcached.sess_lock_retries":"800","_comment2":"\n\n\t# Optimisation opcache -->","opcache.revalidate_freq":"0","opcache.validate_timestamps":"0","opcache.max_accelerated_files":"20000","opcache.memory_consumption":"<=256","opcache.interned_strings_buffer":"16","short_open_tag":"Off","memory_limit":"128M","opcache.enable":"1","_comment3":"\n\n\t# Realpath cache -->","realpath_cache_size":"4096K","realpath_cache_ttl":"60"},"symfony_requirements":["SimpleXML","ctype","iconv","json","pcre","session","tokenizer"],"URL":"https:\/\/acme.fr"}'); // injected by the generator php script, homemade php template manager
+// DEBUT ZONE A EDITER *************************************************************************************************
+if (null === $versionData) {
+ echo 'injected json read is null';
+ exit(84);
+}
+$FAROS_VERSION = $versionData->version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
+
+// htaccess
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
+
+// FIN DE ZONE A EDITER *******************************************************************************************
+
+$PHP_VERSION = $versionData->php_version;
+
+// TODO: KO
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
+
+// for OpCache
+function get_call_itself_check(string $url, ?string $username, ?string $password): array
+{
+ $check = false;
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+ ],
+ ]);
+
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
+ }
+
+ return [
+ 'prerequis' => 'Peut appeler '.$url,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
+ ];
+}
+
+function get_bs_class(bool $check): string
+{
+ return true === $check ? 'success' : 'danger';
+}
+
+function get_binaries_check(): array
+{
+ global $versionData;
+ $checks = [];
+ $binaries = $versionData->binaries;
+ foreach ($binaries as $binary) {
+ $check = is_executable($binary);
+ $checks[] = [
+ 'prerequis' => 'Binaire '.$binary,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
+
+function get_php_version_check(string $PHP_VERSION): array
+{
+ $check = version_compare(\PHP_VERSION, $PHP_VERSION, 'gt') && 0 === strpos(\PHP_VERSION, $PHP_VERSION[0]);
+
+ return [
+ 'prerequis' => 'PHP_VERSION',
+ 'check' => $check,
+ 'errorMessage' => $check ? '' : 'Valeur détectée: '.\PHP_VERSION.'. Valeur attendue: '.$PHP_VERSION,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function get_document_root_check(): array
+{
+ $check = false;
+ $documentRoot = realpath($_SERVER['DOCUMENT_ROOT']);
+ if (__DIR__ !== $documentRoot) {
+ $errorMessage = 'DocumentRoot:KO : Le serveur pointe sur '.__DIR__.' au lieu de '.$documentRoot;
+ } else {
+ $check = true;
+ }
+
+ return [
+ 'prerequis' => 'DocumentRoot',
+ 'check' => $check,
+ 'errorMessage' => $errorMessage ?? '',
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
+function get_php_configuration_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $settings = $versionData->settings;
+
+ foreach ($settings as $key => $expected) {
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
+ $checks[] = [
+ 'prerequis' => $key.' = '.$expected,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ 'errorMessage' => true === $check ? '' : $errMessage,
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_symfony_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $symfonyRequirements = $versionData->symfony_requirements;
+
+ foreach ($symfonyRequirements as $item) {
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_faros_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $farosRequirements = $versionData->faros_requirements;
+ foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+$html = <<
+
+
+
+
+ Test compatibilité faros {$FAROS_VERSION}
+
+
+
+
+
+
+
+
Test compatibilité Faros {$FAROS_VERSION}
+
+HTML;
+$mainChecks = <<<'HTML'
+
+
+
+
+ Prérequis |
+ OK ? |
+
+
+
+HTML;
+
+/*
+$lephareKeysCheck = getLephareKeysCheck();
+$mainChecks .= <<
+ {$lephareKeysCheck['prerequis']} |
+ {$lephareKeysCheck['checkLabel']} {$lephareKeysCheck['errorMessage']} |
+
+HTML;
+ */
+
+$callItselfCheck = get_call_itself_check($URL, $USERNAME, $PASSWORD);
+$mainChecks .= <<
+ {$callItselfCheck['prerequis']} |
+ {$callItselfCheck['checkLabel']} {$callItselfCheck['errorMessage']} |
+
+HTML;
+
+$phpVersionCheck = get_php_version_check($PHP_VERSION);
+$mainChecks .= <<
+ {$phpVersionCheck['prerequis']} |
+ {$phpVersionCheck['checkLabel']} {$phpVersionCheck['errorMessage']} |
+
+HTML;
+
+$mainChecks .= <<<'HTML'
+
+
+HTML;
+
+$html .= $mainChecks;
+
+$binariesChecksTable = <<<'HTML'
+
+
+
+ Binaires |
+ OK ? |
+
+
+
+HTML;
+$binariesChecks = get_binaries_check();
+foreach ($binariesChecks as $binaryCheck) {
+ $binariesChecksTable .= <<
+ {$binaryCheck['prerequis']} |
+ {$binaryCheck['checkLabel']} |
+
+HTML;
+}
+$binariesChecksTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $binariesChecksTable;
+
+$html .= <<<'HTML'
+
Configuration PHP
+
Extensions #
+HTML;
+
+$symfonyExtensionsTable = <<<'HTML'
+
+
+
+ Pré-requis pour Symfony |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsSymfonyChecks = get_loaded_extensions_symfony_checks();
+foreach ($loadedExtensionsSymfonyChecks as $loadedExtensionsCheck) {
+ $symfonyExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$symfonyExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $symfonyExtensionsTable;
+
+$farosExtensionsTable = <<<'HTML'
+
+
+
+ Extensions supplémentaires pour nos applications |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsFarosChecks = get_loaded_extensions_faros_checks();
+foreach ($loadedExtensionsFarosChecks as $loadedExtensionsCheck) {
+ $farosExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$farosExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $farosExtensionsTable;
+
+$html .= <<<'HTML'
+
php.ini #
+HTML;
+
+$phpConfigurationCheckTable = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+HTML;
+$phpConfigurationChecks = get_php_configuration_checks();
+foreach ($phpConfigurationChecks as $check) {
+ $phpConfigurationCheckTable .= <<
+ {$check['prerequis']} |
+ {$check['checkLabel']} {$check['errorMessage']} |
+
+HTML;
+}
+$phpConfigurationCheckTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $phpConfigurationCheckTable;
+
+$html .= <<<'HTML'
+
Configuration Apache #
+HTML;
+
+$documentRootCheck = get_document_root_check();
+// $sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
+$apacheChecks = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+
+HTML;
+
+$apacheChecks .= <<
+ {$documentRootCheck['prerequis']} |
+ {$documentRootCheck['checkLabel']} {$documentRootCheck['errorMessage']} |
+
+HTML;
+
+/*
+
+ {$sslHttp2Check['prerequis']} |
+ {$sslHttp2Check['checkLabel']} {$sslHttp2Check['errorMessage']} |
+
+*/
+
+$apacheChecks .= <<<'HTML'
+
+HTML;
+
+$html .= $apacheChecks;
+
+$html .= <<<'HTML'
+
+
+
+
+
+
+HTML;
+
+echo $html;
diff --git a/check_faros_version/check_2023_04.php b/docs/generated/versions_tests_scripts/check_2022.01.php
similarity index 52%
rename from check_faros_version/check_2023_04.php
rename to docs/generated/versions_tests_scripts/check_2022.01.php
index dce0aa4..7068478 100644
--- a/check_faros_version/check_2023_04.php
+++ b/docs/generated/versions_tests_scripts/check_2022.01.php
@@ -1,85 +1,93 @@
","session.save_handler":"memcached","session.save_path":"localhost:11211","memcached.sess_lock_wait_min":"150","memcached.sess_lock_wait_max":"150","memcached.sess_lock_retries":"800","_comment2":"\n\n\t# Optimisation opcache -->","opcache.revalidate_freq":"0","opcache.validate_timestamps":"0","opcache.max_accelerated_files":"20000","opcache.memory_consumption":"<=256","opcache.interned_strings_buffer":"16","short_open_tag":"Off","memory_limit":"128M","opcache.enable":"1","_comment3":"\n\n\t# Realpath cache -->","realpath_cache_size":"4096K","realpath_cache_ttl":"60"},"symfony_requirements":["SimpleXML","ctype","iconv","json","pcre","session","tokenizer"],"URL":"https:\/\/acme.fr"}'); // injected by the generator php script, homemade php template manager
// DEBUT ZONE A EDITER *************************************************************************************************
-
-$FAROS_VERSION = '2023.04';
-$URL = 'https://acme.fr';
+if (null === $versionData) {
+ echo 'injected json read is null';
+ exit(84);
+}
+$FAROS_VERSION = $versionData->version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
// htaccess
-$USERNAME = 'EDIT_ME';
-$PASSWORD = 'EDIT_ME';
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
// FIN DE ZONE A EDITER *******************************************************************************************
-$PHP_VERSION = '8.2';
+$PHP_VERSION = $versionData->php_version;
// TODO: KO
-function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
-{
- $check = false;
- $ch = curl_init();
- curl_setopt_array($ch, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
- ],
- \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
- ]);
- //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
- $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
- //var_dump(curl_getinfo($ch));
- curl_close($ch);
- if (200 === $httpCode) {
- $check = true;
- }
-
- return [
- 'prerequis' => 'SSL & HTTP/2',
- 'check' => $check,
- 'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
- ];
-}
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
// for OpCache
function get_call_itself_check(string $url, ?string $username, ?string $password): array
{
$check = false;
- $curl = curl_init();
-
- curl_setopt_array($curl, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
],
]);
- $response = curl_exec($curl);
-
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- $response = curl_exec($curl);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = true;
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
}
return [
'prerequis' => 'Peut appeler '.$url,
'check' => $check,
'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
];
}
@@ -90,8 +98,9 @@ function get_bs_class(bool $check): string
function get_binaries_check(): array
{
+ global $versionData;
$checks = [];
- $binaries = ['/usr/bin/git', '/usr/bin/curl'];
+ $binaries = $versionData->binaries;
foreach ($binaries as $binary) {
$check = is_executable($binary);
$checks[] = [
@@ -106,28 +115,28 @@ function get_binaries_check(): array
}
// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
-function get_lephare_keys_check(): array
-{
- $check = false;
- $curl = curl_init();
- curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
- curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, \CURLOPT_HEADER, false);
- $data = curl_exec($curl);
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
- }
-
- return [
- 'prerequis' => 'Authentification SSH',
- 'check' => $check,
- 'errorMessage' => true === $check ? '' : 'Contenus différents',
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
-}
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
function get_php_version_check(string $PHP_VERSION): array
{
@@ -161,44 +170,70 @@ function get_document_root_check(): array
];
}
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
function get_php_configuration_checks(): array
{
+ global $versionData;
$checks = [];
- $settings = [
- // 'short_open_tag' => 'off', PHP_INI_PERDIR https://www.php.net/manual/en/ini.core.php
- // 'magic_quotes_gpc' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- // 'register_globals' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- 'display_errors' => 'off',
- 'display_startup_errors' => 'off',
- 'session.auto_start' => 'off',
- 'date.timezone' => 'Europe/Paris',
- 'upload_max_filesize' => '32M',
- 'post_max_size' => '33M',
- 'sys_temp_dir' => '/var/tmp',
- 'upload_tmp_dir' => '/var/tmp',
- 'session.save_handler' => 'memcached',
- 'session.save_path' => 'localhost:11211',
- 'memcached.sess_lock_wait_min' => '150',
- 'memcached.sess_lock_wait_max' => '150',
- 'memcached.sess_lock_retries' => '800',
- 'opcache.revalidate_freq' => '0',
- 'opcache.validate_timestamps' => '0',
- 'opcache.max_accelerated_files' => '20000',
- 'opcache.memory_consumption' => '256',
- 'opcache.interned_strings_buffer' => '16',
- 'memory_limit' => '128M',
- 'opcache.enable' => '1',
- 'realpath_cache_size' => '4096K',
- 'realpath_cache_ttl' => '60',
- ];
+ $settings = $versionData->settings;
+
foreach ($settings as $key => $expected) {
- $check = strtolower($expected) === strtolower(ini_get($key));
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
$checks[] = [
'prerequis' => $key.' = '.$expected,
'check' => $check,
'bsClass' => true === $check ? 'success' : 'danger',
'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : ini_get($key),
+ 'errorMessage' => true === $check ? '' : $errMessage,
];
}
@@ -207,16 +242,9 @@ function get_php_configuration_checks(): array
function get_loaded_extensions_symfony_checks(): array
{
+ global $versionData;
$checks = [];
- $symfonyRequirements = [
- 'ctype',
- 'iconv',
- 'json',
- 'pcre',
- 'session',
- 'SimpleXML',
- 'tokenizer',
- ];
+ $symfonyRequirements = $versionData->symfony_requirements;
foreach ($symfonyRequirements as $item) {
$check = extension_loaded($item);
@@ -233,27 +261,13 @@ function get_loaded_extensions_symfony_checks(): array
function get_loaded_extensions_faros_checks(): array
{
+ global $versionData;
$checks = [];
- $farosRequirements = [
- 'curl',
- 'gd',
- 'intl',
- 'mbstring',
- 'pdo',
- 'pdo_pgsql',
- 'pgsql',
- 'posix',
- 'xml',
- //'opcache',
- 'memcached',
- 'imagick',
- 'apcu',
- // TODO: ne marche pas 'apcu_bc',
- 'exif',
- 'zip',
- 'soap',
- ];
+ $farosRequirements = $versionData->faros_requirements;
foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
$check = extension_loaded($item);
$checks[] = [
'prerequis' => $item,
@@ -283,7 +297,8 @@ function get_loaded_extensions_faros_checks(): array
Test compatibilité Faros {$FAROS_VERSION}
HTML;
-$mainChecks = <<
@@ -320,14 +335,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
-$mainChecks .= <<
HTML;
$html .= $mainChecks;
-$binariesChecksTable = <<
@@ -346,19 +361,19 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$binariesChecksTable .= <<
HTML;
$html .= $binariesChecksTable;
-$html .= <<Configuration PHP
Extensions #
HTML;
-$symfonyExtensionsTable = <<
@@ -377,14 +392,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$symfonyExtensionsTable .= <<
HTML;
$html .= $symfonyExtensionsTable;
-$farosExtensionsTable = <<
@@ -403,18 +418,18 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$farosExtensionsTable .= <<
HTML;
$html .= $farosExtensionsTable;
-$html .= <<php.ini #
HTML;
-$phpConfigurationCheckTable = <<
@@ -433,20 +448,20 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$phpConfigurationCheckTable .= <<
HTML;
$html .= $phpConfigurationCheckTable;
-$html .= <<Configuration Apache #
HTML;
$documentRootCheck = get_document_root_check();
-$sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
-$apacheChecks = <<
@@ -472,13 +487,13 @@ function get_loaded_extensions_faros_checks(): array
*/
-$apacheChecks .= <<
diff --git a/check_faros_version/check_2022_01.php b/docs/generated/versions_tests_scripts/check_2022.07.php
similarity index 52%
rename from check_faros_version/check_2022_01.php
rename to docs/generated/versions_tests_scripts/check_2022.07.php
index d8d356c..dc06256 100644
--- a/check_faros_version/check_2022_01.php
+++ b/docs/generated/versions_tests_scripts/check_2022.07.php
@@ -1,87 +1,93 @@
","session.save_handler":"memcached","session.save_path":"localhost:11211","memcached.sess_lock_wait_min":"150","memcached.sess_lock_wait_max":"150","memcached.sess_lock_retries":"800","_comment2":"\n\n\t# Optimisation opcache -->","opcache.revalidate_freq":"0","opcache.validate_timestamps":"0","opcache.max_accelerated_files":"20000","opcache.memory_consumption":"<=256","opcache.interned_strings_buffer":"16","short_open_tag":"Off","memory_limit":"128M","opcache.enable":"1","_comment3":"\n\n\t# Realpath cache -->","realpath_cache_size":"4096K","realpath_cache_ttl":"60"},"symfony_requirements":["SimpleXML","ctype","iconv","json","pcre","session","tokenizer"],"URL":"https:\/\/acme.fr"}'); // injected by the generator php script, homemade php template manager
// DEBUT ZONE A EDITER *************************************************************************************************
-
-$FAROS_VERSION = '2022.01';
-$URL = 'https://acme.fr';
+if (null === $versionData) {
+ echo 'injected json read is null';
+ exit(84);
+}
+$FAROS_VERSION = $versionData->version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
// htaccess
-$USERNAME = 'EDIT_ME';
-$PASSWORD = 'EDIT_ME';
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
// FIN DE ZONE A EDITER *******************************************************************************************
-$PHP_VERSION = '8.1'; // 10.1 requirement but in var to be flex
-
-// TODO: doc, un test par version de faros
+$PHP_VERSION = $versionData->php_version;
// TODO: KO
-function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
-{
- $check = false;
- $ch = curl_init();
- curl_setopt_array($ch, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
- ],
- \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
- ]);
- //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
- $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
- //var_dump(curl_getinfo($ch));
- curl_close($ch);
- if (200 === $httpCode) {
- $check = true;
- }
-
- return [
- 'prerequis' => 'SSL & HTTP/2',
- 'check' => $check,
- 'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
- ];
-}
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
// for OpCache
function get_call_itself_check(string $url, ?string $username, ?string $password): array
{
$check = false;
- $curl = curl_init();
-
- curl_setopt_array($curl, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
],
]);
- $response = curl_exec($curl);
-
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- $response = curl_exec($curl);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = true;
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
}
return [
'prerequis' => 'Peut appeler '.$url,
'check' => $check,
'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
];
}
@@ -92,8 +98,9 @@ function get_bs_class(bool $check): string
function get_binaries_check(): array
{
+ global $versionData;
$checks = [];
- $binaries = ['/usr/bin/git', '/usr/bin/curl'];
+ $binaries = $versionData->binaries;
foreach ($binaries as $binary) {
$check = is_executable($binary);
$checks[] = [
@@ -108,32 +115,32 @@ function get_binaries_check(): array
}
// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
-function get_lephare_keys_check(): array
-{
- $check = false;
- $curl = curl_init();
- curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
- curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, \CURLOPT_HEADER, false);
- $data = curl_exec($curl);
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
- }
-
- return [
- 'prerequis' => 'Authentification SSH',
- 'check' => $check,
- 'errorMessage' => true === $check ? '' : 'Contenus différents',
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
-}
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
function get_php_version_check(string $PHP_VERSION): array
{
- $check = version_compare(\PHP_VERSION, $PHP_VERSION, 'gt') && PHP_VERSION_ID < 80000;
+ $check = version_compare(\PHP_VERSION, $PHP_VERSION, 'gt') && 0 === strpos(\PHP_VERSION, $PHP_VERSION[0]);
return [
'prerequis' => 'PHP_VERSION',
@@ -163,41 +170,70 @@ function get_document_root_check(): array
];
}
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
function get_php_configuration_checks(): array
{
+ global $versionData;
$checks = [];
- $settings = [
- // 'short_open_tag' => 'off', PHP_INI_PERDIR https://www.php.net/manual/en/ini.core.php
- // 'magic_quotes_gpc' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- // 'register_globals' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- 'session.auto_start' => 'off',
- 'date.timezone' => 'Europe/Paris',
- 'upload_max_filesize' => '32M',
- 'post_max_size' => '33M',
- 'sys_temp_dir' => '/var/tmp',
- 'upload_tmp_dir' => '/var/tmp',
- 'session.save_handler' => 'memcached',
- 'session.save_path' => 'localhost:11211',
- 'memcached.sess_lock_wait_min' => '150',
- 'memcached.sess_lock_wait_max' => '150',
- 'memcached.sess_lock_retries' => '800',
- 'opcache.revalidate_freq' => '0',
- 'opcache.validate_timestamps' => '0',
- 'opcache.max_accelerated_files' => '7963',
- 'opcache.memory_consumption' => '192',
- 'opcache.interned_strings_buffer' => '16',
- // 'opcache.fast_shutdown' => '1', // removed in php 7.2
- 'memory_limit' => '128M',
- 'opcache.enable' => '1',
- ];
+ $settings = $versionData->settings;
+
foreach ($settings as $key => $expected) {
- $check = strtolower($expected) === strtolower(ini_get($key));
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
$checks[] = [
'prerequis' => $key.' = '.$expected,
'check' => $check,
'bsClass' => true === $check ? 'success' : 'danger',
'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : ini_get($key),
+ 'errorMessage' => true === $check ? '' : $errMessage,
];
}
@@ -206,16 +242,9 @@ function get_php_configuration_checks(): array
function get_loaded_extensions_symfony_checks(): array
{
+ global $versionData;
$checks = [];
- $symfonyRequirements = [
- 'ctype',
- 'iconv',
- 'json',
- 'pcre',
- 'session',
- 'SimpleXML',
- 'tokenizer',
- ];
+ $symfonyRequirements = $versionData->symfony_requirements;
foreach ($symfonyRequirements as $item) {
$check = extension_loaded($item);
@@ -232,27 +261,13 @@ function get_loaded_extensions_symfony_checks(): array
function get_loaded_extensions_faros_checks(): array
{
+ global $versionData;
$checks = [];
- $farosRequirements = [
- 'curl',
- 'gd',
- 'intl',
- 'mbstring',
- 'pdo',
- 'pdo_pgsql',
- 'pgsql',
- 'posix',
- 'xml',
- //'opcache',
- 'memcached',
- 'imagick',
- 'apcu',
- // TODO: ne marche pas 'apcu_bc',
- 'exif',
- 'zip',
- 'soap',
- ];
+ $farosRequirements = $versionData->faros_requirements;
foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
$check = extension_loaded($item);
$checks[] = [
'prerequis' => $item,
@@ -282,7 +297,8 @@ function get_loaded_extensions_faros_checks(): array
Test compatibilité Faros {$FAROS_VERSION}
HTML;
-$mainChecks = <<
@@ -319,14 +335,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
-$mainChecks .= <<
HTML;
$html .= $mainChecks;
-$binariesChecksTable = <<
@@ -345,19 +361,19 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$binariesChecksTable .= <<
HTML;
$html .= $binariesChecksTable;
-$html .= <<Configuration PHP
Extensions #
HTML;
-$symfonyExtensionsTable = <<
@@ -376,14 +392,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$symfonyExtensionsTable .= <<
HTML;
$html .= $symfonyExtensionsTable;
-$farosExtensionsTable = <<
@@ -402,18 +418,18 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$farosExtensionsTable .= <<
HTML;
$html .= $farosExtensionsTable;
-$html .= <<php.ini #
HTML;
-$phpConfigurationCheckTable = <<
@@ -432,20 +448,20 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$phpConfigurationCheckTable .= <<
HTML;
$html .= $phpConfigurationCheckTable;
-$html .= <<Configuration Apache #
HTML;
$documentRootCheck = get_document_root_check();
-$sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
-$apacheChecks = <<
@@ -471,13 +487,13 @@ function get_loaded_extensions_faros_checks(): array
*/
-$apacheChecks .= <<
diff --git a/docs/generated/versions_tests_scripts/check_2023.04.php b/docs/generated/versions_tests_scripts/check_2023.04.php
new file mode 100644
index 0000000..7b8838c
--- /dev/null
+++ b/docs/generated/versions_tests_scripts/check_2023.04.php
@@ -0,0 +1,505 @@
+","session.save_handler":"memcached","session.save_path":"localhost:11211","memcached.sess_lock_wait_min":"150","memcached.sess_lock_wait_max":"150","memcached.sess_lock_retries":"800","_comment2":"\n\n\t# Optimisation opcache -->","opcache.revalidate_freq":"0","opcache.validate_timestamps":"0","opcache.max_accelerated_files":"20000","opcache.memory_consumption":"<=256","opcache.interned_strings_buffer":"16","short_open_tag":"Off","memory_limit":"128M","opcache.enable":"1","_comment3":"\n\n\t# Realpath cache -->","realpath_cache_size":"4096K","realpath_cache_ttl":"60"},"symfony_requirements":["SimpleXML","ctype","iconv","json","pcre","session","tokenizer"],"URL":"https:\/\/acme.fr"}'); // injected by the generator php script, homemade php template manager
+// DEBUT ZONE A EDITER *************************************************************************************************
+if (null === $versionData) {
+ echo 'injected json read is null';
+ exit(84);
+}
+$FAROS_VERSION = $versionData->version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
+
+// htaccess
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
+
+// FIN DE ZONE A EDITER *******************************************************************************************
+
+$PHP_VERSION = $versionData->php_version;
+
+// TODO: KO
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
+
+// for OpCache
+function get_call_itself_check(string $url, ?string $username, ?string $password): array
+{
+ $check = false;
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+ ],
+ ]);
+
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
+ }
+
+ return [
+ 'prerequis' => 'Peut appeler '.$url,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
+ ];
+}
+
+function get_bs_class(bool $check): string
+{
+ return true === $check ? 'success' : 'danger';
+}
+
+function get_binaries_check(): array
+{
+ global $versionData;
+ $checks = [];
+ $binaries = $versionData->binaries;
+ foreach ($binaries as $binary) {
+ $check = is_executable($binary);
+ $checks[] = [
+ 'prerequis' => 'Binaire '.$binary,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
+
+function get_php_version_check(string $PHP_VERSION): array
+{
+ $check = version_compare(\PHP_VERSION, $PHP_VERSION, 'gt') && 0 === strpos(\PHP_VERSION, $PHP_VERSION[0]);
+
+ return [
+ 'prerequis' => 'PHP_VERSION',
+ 'check' => $check,
+ 'errorMessage' => $check ? '' : 'Valeur détectée: '.\PHP_VERSION.'. Valeur attendue: '.$PHP_VERSION,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function get_document_root_check(): array
+{
+ $check = false;
+ $documentRoot = realpath($_SERVER['DOCUMENT_ROOT']);
+ if (__DIR__ !== $documentRoot) {
+ $errorMessage = 'DocumentRoot:KO : Le serveur pointe sur '.__DIR__.' au lieu de '.$documentRoot;
+ } else {
+ $check = true;
+ }
+
+ return [
+ 'prerequis' => 'DocumentRoot',
+ 'check' => $check,
+ 'errorMessage' => $errorMessage ?? '',
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
+function get_php_configuration_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $settings = $versionData->settings;
+
+ foreach ($settings as $key => $expected) {
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
+ $checks[] = [
+ 'prerequis' => $key.' = '.$expected,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ 'errorMessage' => true === $check ? '' : $errMessage,
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_symfony_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $symfonyRequirements = $versionData->symfony_requirements;
+
+ foreach ($symfonyRequirements as $item) {
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_faros_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $farosRequirements = $versionData->faros_requirements;
+ foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+$html = <<
+
+
+
+
+ Test compatibilité faros {$FAROS_VERSION}
+
+
+
+
+
+
+
+
Test compatibilité Faros {$FAROS_VERSION}
+
+HTML;
+$mainChecks = <<<'HTML'
+
+
+
+
+ Prérequis |
+ OK ? |
+
+
+
+HTML;
+
+/*
+$lephareKeysCheck = getLephareKeysCheck();
+$mainChecks .= <<
+ {$lephareKeysCheck['prerequis']} |
+ {$lephareKeysCheck['checkLabel']} {$lephareKeysCheck['errorMessage']} |
+
+HTML;
+ */
+
+$callItselfCheck = get_call_itself_check($URL, $USERNAME, $PASSWORD);
+$mainChecks .= <<
+ {$callItselfCheck['prerequis']} |
+ {$callItselfCheck['checkLabel']} {$callItselfCheck['errorMessage']} |
+
+HTML;
+
+$phpVersionCheck = get_php_version_check($PHP_VERSION);
+$mainChecks .= <<
+ {$phpVersionCheck['prerequis']} |
+ {$phpVersionCheck['checkLabel']} {$phpVersionCheck['errorMessage']} |
+
+HTML;
+
+$mainChecks .= <<<'HTML'
+
+
+HTML;
+
+$html .= $mainChecks;
+
+$binariesChecksTable = <<<'HTML'
+
+
+
+ Binaires |
+ OK ? |
+
+
+
+HTML;
+$binariesChecks = get_binaries_check();
+foreach ($binariesChecks as $binaryCheck) {
+ $binariesChecksTable .= <<
+ {$binaryCheck['prerequis']} |
+ {$binaryCheck['checkLabel']} |
+
+HTML;
+}
+$binariesChecksTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $binariesChecksTable;
+
+$html .= <<<'HTML'
+
Configuration PHP
+
Extensions #
+HTML;
+
+$symfonyExtensionsTable = <<<'HTML'
+
+
+
+ Pré-requis pour Symfony |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsSymfonyChecks = get_loaded_extensions_symfony_checks();
+foreach ($loadedExtensionsSymfonyChecks as $loadedExtensionsCheck) {
+ $symfonyExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$symfonyExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $symfonyExtensionsTable;
+
+$farosExtensionsTable = <<<'HTML'
+
+
+
+ Extensions supplémentaires pour nos applications |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsFarosChecks = get_loaded_extensions_faros_checks();
+foreach ($loadedExtensionsFarosChecks as $loadedExtensionsCheck) {
+ $farosExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$farosExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $farosExtensionsTable;
+
+$html .= <<<'HTML'
+
php.ini #
+HTML;
+
+$phpConfigurationCheckTable = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+HTML;
+$phpConfigurationChecks = get_php_configuration_checks();
+foreach ($phpConfigurationChecks as $check) {
+ $phpConfigurationCheckTable .= <<
+ {$check['prerequis']} |
+ {$check['checkLabel']} {$check['errorMessage']} |
+
+HTML;
+}
+$phpConfigurationCheckTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $phpConfigurationCheckTable;
+
+$html .= <<<'HTML'
+
Configuration Apache #
+HTML;
+
+$documentRootCheck = get_document_root_check();
+// $sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
+$apacheChecks = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+
+HTML;
+
+$apacheChecks .= <<
+ {$documentRootCheck['prerequis']} |
+ {$documentRootCheck['checkLabel']} {$documentRootCheck['errorMessage']} |
+
+HTML;
+
+/*
+
+ {$sslHttp2Check['prerequis']} |
+ {$sslHttp2Check['checkLabel']} {$sslHttp2Check['errorMessage']} |
+
+*/
+
+$apacheChecks .= <<<'HTML'
+
+HTML;
+
+$html .= $apacheChecks;
+
+$html .= <<<'HTML'
+
+
+
+
+
+
+HTML;
+
+echo $html;
diff --git a/check_faros_version/check_2022_07.php b/docs/generated/versions_tests_scripts/check_2023.06.php
similarity index 52%
rename from check_faros_version/check_2022_07.php
rename to docs/generated/versions_tests_scripts/check_2023.06.php
index 47032c1..32c9981 100644
--- a/check_faros_version/check_2022_07.php
+++ b/docs/generated/versions_tests_scripts/check_2023.06.php
@@ -1,85 +1,93 @@
","session.save_handler":"memcached","session.save_path":"localhost:11211","memcached.sess_lock_wait_min":"150","memcached.sess_lock_wait_max":"150","memcached.sess_lock_retries":"800","_comment2":"\n\n\t# Optimisation opcache -->","opcache.revalidate_freq":"0","opcache.validate_timestamps":"0","opcache.max_accelerated_files":"20000","opcache.memory_consumption":"<=256","opcache.interned_strings_buffer":"16","short_open_tag":"Off","memory_limit":"128M","opcache.enable":"1","_comment3":"\n\n\t# Realpath cache -->","realpath_cache_size":"4096K","realpath_cache_ttl":"60"},"symfony_requirements":["SimpleXML","ctype","iconv","json","pcre","session","tokenizer"],"URL":"https:\/\/acme.fr"}'); // injected by the generator php script, homemade php template manager
// DEBUT ZONE A EDITER *************************************************************************************************
-
-$FAROS_VERSION = '2022.07';
-$URL = 'https://acme.fr';
+if (null === $versionData) {
+ echo 'injected json read is null';
+ exit(84);
+}
+$FAROS_VERSION = $versionData->version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
// htaccess
-$USERNAME = 'EDIT_ME';
-$PASSWORD = 'EDIT_ME';
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
// FIN DE ZONE A EDITER *******************************************************************************************
-$PHP_VERSION = '8.1';
+$PHP_VERSION = $versionData->php_version;
// TODO: KO
-function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
-{
- $check = false;
- $ch = curl_init();
- curl_setopt_array($ch, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
- ],
- \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
- ]);
- //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
- $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
- //var_dump(curl_getinfo($ch));
- curl_close($ch);
- if (200 === $httpCode) {
- $check = true;
- }
-
- return [
- 'prerequis' => 'SSL & HTTP/2',
- 'check' => $check,
- 'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
- ];
-}
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
// for OpCache
function get_call_itself_check(string $url, ?string $username, ?string $password): array
{
$check = false;
- $curl = curl_init();
-
- curl_setopt_array($curl, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
],
]);
- $response = curl_exec($curl);
-
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- $response = curl_exec($curl);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = true;
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
}
return [
'prerequis' => 'Peut appeler '.$url,
'check' => $check,
'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
];
}
@@ -90,8 +98,9 @@ function get_bs_class(bool $check): string
function get_binaries_check(): array
{
+ global $versionData;
$checks = [];
- $binaries = ['/usr/bin/git', '/usr/bin/curl'];
+ $binaries = $versionData->binaries;
foreach ($binaries as $binary) {
$check = is_executable($binary);
$checks[] = [
@@ -106,28 +115,28 @@ function get_binaries_check(): array
}
// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
-function get_lephare_keys_check(): array
-{
- $check = false;
- $curl = curl_init();
- curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
- curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, \CURLOPT_HEADER, false);
- $data = curl_exec($curl);
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
- }
-
- return [
- 'prerequis' => 'Authentification SSH',
- 'check' => $check,
- 'errorMessage' => true === $check ? '' : 'Contenus différents',
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
-}
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
function get_php_version_check(string $PHP_VERSION): array
{
@@ -161,44 +170,70 @@ function get_document_root_check(): array
];
}
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
function get_php_configuration_checks(): array
{
+ global $versionData;
$checks = [];
- $settings = [
- // 'short_open_tag' => 'off', PHP_INI_PERDIR https://www.php.net/manual/en/ini.core.php
- // 'magic_quotes_gpc' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- // 'register_globals' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- 'display_errors' => 'off',
- 'display_startup_errors' => 'off',
- 'session.auto_start' => 'off',
- 'date.timezone' => 'Europe/Paris',
- 'upload_max_filesize' => '32M',
- 'post_max_size' => '33M',
- 'sys_temp_dir' => '/var/tmp',
- 'upload_tmp_dir' => '/var/tmp',
- 'session.save_handler' => 'memcached',
- 'session.save_path' => 'localhost:11211',
- 'memcached.sess_lock_wait_min' => '150',
- 'memcached.sess_lock_wait_max' => '150',
- 'memcached.sess_lock_retries' => '800',
- 'opcache.revalidate_freq' => '0',
- 'opcache.validate_timestamps' => '0',
- 'opcache.max_accelerated_files' => '20000',
- 'opcache.memory_consumption' => '256',
- 'opcache.interned_strings_buffer' => '16',
- 'memory_limit' => '128M',
- 'opcache.enable' => '1',
- 'realpath_cache_size' => '4096K',
- 'realpath_cache_ttl' => '60',
- ];
+ $settings = $versionData->settings;
+
foreach ($settings as $key => $expected) {
- $check = strtolower($expected) === strtolower(ini_get($key));
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
$checks[] = [
'prerequis' => $key.' = '.$expected,
'check' => $check,
'bsClass' => true === $check ? 'success' : 'danger',
'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : ini_get($key),
+ 'errorMessage' => true === $check ? '' : $errMessage,
];
}
@@ -207,16 +242,9 @@ function get_php_configuration_checks(): array
function get_loaded_extensions_symfony_checks(): array
{
+ global $versionData;
$checks = [];
- $symfonyRequirements = [
- 'ctype',
- 'iconv',
- 'json',
- 'pcre',
- 'session',
- 'SimpleXML',
- 'tokenizer',
- ];
+ $symfonyRequirements = $versionData->symfony_requirements;
foreach ($symfonyRequirements as $item) {
$check = extension_loaded($item);
@@ -233,27 +261,13 @@ function get_loaded_extensions_symfony_checks(): array
function get_loaded_extensions_faros_checks(): array
{
+ global $versionData;
$checks = [];
- $farosRequirements = [
- 'curl',
- 'gd',
- 'intl',
- 'mbstring',
- 'pdo',
- 'pdo_pgsql',
- 'pgsql',
- 'posix',
- 'xml',
- //'opcache',
- 'memcached',
- 'imagick',
- 'apcu',
- // TODO: ne marche pas 'apcu_bc',
- 'exif',
- 'zip',
- 'soap',
- ];
+ $farosRequirements = $versionData->faros_requirements;
foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
$check = extension_loaded($item);
$checks[] = [
'prerequis' => $item,
@@ -283,7 +297,8 @@ function get_loaded_extensions_faros_checks(): array
Test compatibilité Faros {$FAROS_VERSION}
HTML;
-$mainChecks = <<
@@ -320,14 +335,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
-$mainChecks .= <<
HTML;
$html .= $mainChecks;
-$binariesChecksTable = <<
@@ -346,19 +361,19 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$binariesChecksTable .= <<
HTML;
$html .= $binariesChecksTable;
-$html .= <<Configuration PHP
Extensions #
HTML;
-$symfonyExtensionsTable = <<
@@ -377,14 +392,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$symfonyExtensionsTable .= <<
HTML;
$html .= $symfonyExtensionsTable;
-$farosExtensionsTable = <<
@@ -403,18 +418,18 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$farosExtensionsTable .= <<
HTML;
$html .= $farosExtensionsTable;
-$html .= <<php.ini #
HTML;
-$phpConfigurationCheckTable = <<
@@ -433,20 +448,20 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$phpConfigurationCheckTable .= <<
HTML;
$html .= $phpConfigurationCheckTable;
-$html .= <<Configuration Apache #
HTML;
$documentRootCheck = get_document_root_check();
-$sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
-$apacheChecks = <<
@@ -472,13 +487,13 @@ function get_loaded_extensions_faros_checks(): array
*/
-$apacheChecks .= <<
diff --git a/docs/generated/versions_tests_scripts/check_9.0.php b/docs/generated/versions_tests_scripts/check_9.0.php
new file mode 100644
index 0000000..8ebae70
--- /dev/null
+++ b/docs/generated/versions_tests_scripts/check_9.0.php
@@ -0,0 +1,505 @@
+","session.save_handler":"memcached","session.save_path":"localhost:11211","memcached.sess_lock_wait_min":"150","memcached.sess_lock_wait_max":"150","memcached.sess_lock_retries":"800","_comment2":"\n\n\t# Optimisation opcache -->","opcache.revalidate_freq":"0","opcache.validate_timestamps":"0","opcache.max_accelerated_files":"20000","opcache.memory_consumption":"<=256","opcache.interned_strings_buffer":"16","short_open_tag":"Off","memory_limit":"128M","opcache.enable":"1","_comment3":"\n\n\t# Realpath cache -->","realpath_cache_size":"4096K","realpath_cache_ttl":"60"},"symfony_requirements":["SimpleXML","ctype","iconv","json","pcre","session","tokenizer"],"URL":"https:\/\/acme.fr"}'); // injected by the generator php script, homemade php template manager
+// DEBUT ZONE A EDITER *************************************************************************************************
+if (null === $versionData) {
+ echo 'injected json read is null';
+ exit(84);
+}
+$FAROS_VERSION = $versionData->version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
+
+// htaccess
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
+
+// FIN DE ZONE A EDITER *******************************************************************************************
+
+$PHP_VERSION = $versionData->php_version;
+
+// TODO: KO
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
+
+// for OpCache
+function get_call_itself_check(string $url, ?string $username, ?string $password): array
+{
+ $check = false;
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+ ],
+ ]);
+
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
+ }
+
+ return [
+ 'prerequis' => 'Peut appeler '.$url,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
+ ];
+}
+
+function get_bs_class(bool $check): string
+{
+ return true === $check ? 'success' : 'danger';
+}
+
+function get_binaries_check(): array
+{
+ global $versionData;
+ $checks = [];
+ $binaries = $versionData->binaries;
+ foreach ($binaries as $binary) {
+ $check = is_executable($binary);
+ $checks[] = [
+ 'prerequis' => 'Binaire '.$binary,
+ 'check' => $check,
+ 'bsClass' => get_bs_class($check),
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
+
+function get_php_version_check(string $PHP_VERSION): array
+{
+ $check = version_compare(\PHP_VERSION, $PHP_VERSION, 'gt') && 0 === strpos(\PHP_VERSION, $PHP_VERSION[0]);
+
+ return [
+ 'prerequis' => 'PHP_VERSION',
+ 'check' => $check,
+ 'errorMessage' => $check ? '' : 'Valeur détectée: '.\PHP_VERSION.'. Valeur attendue: '.$PHP_VERSION,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function get_document_root_check(): array
+{
+ $check = false;
+ $documentRoot = realpath($_SERVER['DOCUMENT_ROOT']);
+ if (__DIR__ !== $documentRoot) {
+ $errorMessage = 'DocumentRoot:KO : Le serveur pointe sur '.__DIR__.' au lieu de '.$documentRoot;
+ } else {
+ $check = true;
+ }
+
+ return [
+ 'prerequis' => 'DocumentRoot',
+ 'check' => $check,
+ 'errorMessage' => $errorMessage ?? '',
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+}
+
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
+function get_php_configuration_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $settings = $versionData->settings;
+
+ foreach ($settings as $key => $expected) {
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
+ $checks[] = [
+ 'prerequis' => $key.' = '.$expected,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ 'errorMessage' => true === $check ? '' : $errMessage,
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_symfony_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $symfonyRequirements = $versionData->symfony_requirements;
+
+ foreach ($symfonyRequirements as $item) {
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+function get_loaded_extensions_faros_checks(): array
+{
+ global $versionData;
+ $checks = [];
+ $farosRequirements = $versionData->faros_requirements;
+ foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
+ $check = extension_loaded($item);
+ $checks[] = [
+ 'prerequis' => $item,
+ 'check' => $check,
+ 'bsClass' => true === $check ? 'success' : 'danger',
+ 'checkLabel' => true === $check ? 'OK' : 'KO',
+ ];
+ }
+
+ return $checks;
+}
+
+$html = <<
+
+
+
+
+ Test compatibilité faros {$FAROS_VERSION}
+
+
+
+
+
+
+
+
Test compatibilité Faros {$FAROS_VERSION}
+
+HTML;
+$mainChecks = <<<'HTML'
+
+
+
+
+ Prérequis |
+ OK ? |
+
+
+
+HTML;
+
+/*
+$lephareKeysCheck = getLephareKeysCheck();
+$mainChecks .= <<
+ {$lephareKeysCheck['prerequis']} |
+ {$lephareKeysCheck['checkLabel']} {$lephareKeysCheck['errorMessage']} |
+
+HTML;
+ */
+
+$callItselfCheck = get_call_itself_check($URL, $USERNAME, $PASSWORD);
+$mainChecks .= <<
+ {$callItselfCheck['prerequis']} |
+ {$callItselfCheck['checkLabel']} {$callItselfCheck['errorMessage']} |
+
+HTML;
+
+$phpVersionCheck = get_php_version_check($PHP_VERSION);
+$mainChecks .= <<
+ {$phpVersionCheck['prerequis']} |
+ {$phpVersionCheck['checkLabel']} {$phpVersionCheck['errorMessage']} |
+
+HTML;
+
+$mainChecks .= <<<'HTML'
+
+
+HTML;
+
+$html .= $mainChecks;
+
+$binariesChecksTable = <<<'HTML'
+
+
+
+ Binaires |
+ OK ? |
+
+
+
+HTML;
+$binariesChecks = get_binaries_check();
+foreach ($binariesChecks as $binaryCheck) {
+ $binariesChecksTable .= <<
+ {$binaryCheck['prerequis']} |
+ {$binaryCheck['checkLabel']} |
+
+HTML;
+}
+$binariesChecksTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $binariesChecksTable;
+
+$html .= <<<'HTML'
+
Configuration PHP
+
Extensions #
+HTML;
+
+$symfonyExtensionsTable = <<<'HTML'
+
+
+
+ Pré-requis pour Symfony |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsSymfonyChecks = get_loaded_extensions_symfony_checks();
+foreach ($loadedExtensionsSymfonyChecks as $loadedExtensionsCheck) {
+ $symfonyExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$symfonyExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $symfonyExtensionsTable;
+
+$farosExtensionsTable = <<<'HTML'
+
+
+
+ Extensions supplémentaires pour nos applications |
+ OK ? |
+
+
+
+HTML;
+$loadedExtensionsFarosChecks = get_loaded_extensions_faros_checks();
+foreach ($loadedExtensionsFarosChecks as $loadedExtensionsCheck) {
+ $farosExtensionsTable .= <<
+ {$loadedExtensionsCheck['prerequis']} |
+ {$loadedExtensionsCheck['checkLabel']} |
+
+HTML;
+}
+$farosExtensionsTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $farosExtensionsTable;
+
+$html .= <<<'HTML'
+
php.ini #
+HTML;
+
+$phpConfigurationCheckTable = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+HTML;
+$phpConfigurationChecks = get_php_configuration_checks();
+foreach ($phpConfigurationChecks as $check) {
+ $phpConfigurationCheckTable .= <<
+ {$check['prerequis']} |
+ {$check['checkLabel']} {$check['errorMessage']} |
+
+HTML;
+}
+$phpConfigurationCheckTable .= <<<'HTML'
+
+
+HTML;
+
+$html .= $phpConfigurationCheckTable;
+
+$html .= <<<'HTML'
+
Configuration Apache #
+HTML;
+
+$documentRootCheck = get_document_root_check();
+// $sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
+$apacheChecks = <<<'HTML'
+
+
+
+ Setting |
+ OK ? |
+
+
+
+
+HTML;
+
+$apacheChecks .= <<
+ {$documentRootCheck['prerequis']} |
+ {$documentRootCheck['checkLabel']} {$documentRootCheck['errorMessage']} |
+
+HTML;
+
+/*
+
+ {$sslHttp2Check['prerequis']} |
+ {$sslHttp2Check['checkLabel']} {$sslHttp2Check['errorMessage']} |
+
+*/
+
+$apacheChecks .= <<<'HTML'
+
+HTML;
+
+$html .= $apacheChecks;
+
+$html .= <<<'HTML'
+
+
+
+
+
+
+HTML;
+
+echo $html;
diff --git a/docs/config/aws.md b/docs/static/configuration/aws.md
similarity index 91%
rename from docs/config/aws.md
rename to docs/static/configuration/aws.md
index c39b16f..d3a49a5 100644
--- a/docs/config/aws.md
+++ b/docs/static/configuration/aws.md
@@ -3,6 +3,7 @@ layout: default
title: AWS
parent: Configuration
nav_order: 2
+permalink: /docs/config/aws.html
---
# AWS
diff --git a/docs/static/configuration/config.md b/docs/static/configuration/config.md
new file mode 100644
index 0000000..3902525
--- /dev/null
+++ b/docs/static/configuration/config.md
@@ -0,0 +1,7 @@
+---
+layout: default
+title: Configuration
+nav_order: 2
+permalink: /configuration
+has_children: true
+---
\ No newline at end of file
diff --git a/docs/config/network.md b/docs/static/configuration/network.md
similarity index 95%
rename from docs/config/network.md
rename to docs/static/configuration/network.md
index 7d556dd..1d93459 100644
--- a/docs/config/network.md
+++ b/docs/static/configuration/network.md
@@ -3,6 +3,7 @@ layout: default
title: Flux réseaux
nav_order: 5
parent: Configuration
+permalink: /docs/config/network.html
---
# Flux réseaux
diff --git a/index.md b/docs/static/index.md
similarity index 90%
rename from index.md
rename to docs/static/index.md
index 718959f..e7d75d2 100644
--- a/index.md
+++ b/docs/static/index.md
@@ -22,8 +22,8 @@ Ce site présente les configurations nécessaires à l'hébergement des projets
### 2023-10-06
-* suppression flux `gitlab.lephare.io` des [flux réseaux](./docs/config/network.md).
-* ajout flux `api.pwnedpasswords.com` des [flux réseaux](./docs/config/network.md).
+* suppression flux `gitlab.lephare.io` des [flux réseaux](/docs/config/network.html).
+* ajout flux `api.pwnedpasswords.com` des [flux réseaux](/docs/config/network.html).
### 2023-10-02
diff --git a/docs/update-symfony.md b/docs/static/update-symfony.md
similarity index 100%
rename from docs/update-symfony.md
rename to docs/static/update-symfony.md
diff --git a/docs/static/versions.md b/docs/static/versions.md
new file mode 100644
index 0000000..616f63c
--- /dev/null
+++ b/docs/static/versions.md
@@ -0,0 +1,7 @@
+---
+layout: default
+title: Versions
+nav_order: 3
+has_children: true
+permalink: /versions
+---
\ No newline at end of file
diff --git a/docs/versions/10.0.md b/docs/versions/10.0.md
deleted file mode 100644
index c532b43..0000000
--- a/docs/versions/10.0.md
+++ /dev/null
@@ -1,13 +0,0 @@
----
-layout: default
-title: 10.0 (2019.10)
-nav_order: 6
-parent: Versions
----
-
-# 10.0
-
-- Debian 10
-- PHP 7.3
-- Apache 2.4
-- PostgreSQL 11
diff --git a/docs/versions/10.1.md b/docs/versions/10.1.md
deleted file mode 100644
index e1fda7f..0000000
--- a/docs/versions/10.1.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-layout: default
-title: 10.1 (2021.03)
-nav_order: 5
-parent: Versions
----
-
-# 10.1
-
-- Debian 10
-- PHP 7.4
-- Apache 2.4
-- PostgreSQL 11
-
-## Check
-
-Le script [check_10_1.php](https://faros.lephare.com/check_faros_version/check_10_1.php) est à disposition pour check une bonne partie des prérequis.
-Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
diff --git a/docs/versions/2022.01.md b/docs/versions/2022.01.md
deleted file mode 100644
index b2183b5..0000000
--- a/docs/versions/2022.01.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-layout: default
-title: 2022.01
-nav_order: 4
-parent: Versions
----
-
-# 2022.01
-
-- Debian 11.2
-- PHP 8.1
-- Apache 2.4
-- PostgreSQL 13
-
-## Check
-
-Le script [check_2022_01.php](https://faros.lephare.com/check_faros_version/check_2022_01.php) est à disposition pour check une bonne partie des prérequis.
-Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
diff --git a/docs/versions/2022.07.md b/docs/versions/2022.07.md
deleted file mode 100644
index bf8550d..0000000
--- a/docs/versions/2022.07.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-layout: default
-title: 2022.07
-nav_order: 3
-parent: Versions
----
-
-# 2022.07
-
-- Debian 11.3
-- PHP 8.1
-- Apache 2.4
-- PostgreSQL 13
-
-## Check
-
-Le script [check_2022_07.php](https://faros.lephare.com/check_faros_version/check_2022_07.php) est à disposition pour check une bonne partie des prérequis.
-Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
diff --git a/docs/versions/2023.04.md b/docs/versions/2023.04.md
deleted file mode 100644
index 1b58532..0000000
--- a/docs/versions/2023.04.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-layout: default
-title: 2023.04
-nav_order: 2
-parent: Versions
----
-
-# 2023.04
-
-- Debian 11.6
-- PHP 8.2
-- Apache 2.4
-- PostgreSQL 14
-
-## Check
-
-Le script [check_2023_04.php](https://faros.lephare.com/check_faros_version/check_2023_04.php) est à disposition pour check une bonne partie des prérequis.
-Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
diff --git a/docs/versions/2023.06.md b/docs/versions/2023.06.md
deleted file mode 100644
index d7d814c..0000000
--- a/docs/versions/2023.06.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-layout: default
-title: 2023.06
-nav_order: 1
-parent: Versions
----
-
-# 2023.06
-
-- Debian 12
-- PHP 8.2
-- Apache 2.4
-- PostgreSQL 15
-
-## Check
-
-Le script [check_2023_06.php](https://faros.lephare.com/check_faros_version/check_2023_06.php) est à disposition pour vérifier une bonne partie des prérequis.
-Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
diff --git a/docs/versions/9.0.md b/docs/versions/9.0.md
deleted file mode 100644
index 7e54d32..0000000
--- a/docs/versions/9.0.md
+++ /dev/null
@@ -1,13 +0,0 @@
----
-layout: default
-title: 9.0 (2019.03)
-nav_order: 7
-parent: Versions
----
-
-# 9.0
-
-- Debian 9
-- PHP 7.3
-- Apache 2.4
-- PostgreSQL 9.6
diff --git a/docs/versions/version.md b/docs/versions/version.md
deleted file mode 100644
index 12d3e98..0000000
--- a/docs/versions/version.md
+++ /dev/null
@@ -1,11 +0,0 @@
----
-layout: default
-title: Versions
-nav_order: 3
-has_children: true
-permalink: /versions
----
-
-# Liste des versions
-
-Toutes nos versions utilisent la [Configuration de base](/configuration).
\ No newline at end of file
diff --git a/goss_faros.yml b/goss_faros.yml
deleted file mode 100644
index 526ae97..0000000
--- a/goss_faros.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-# Binaries
-package:
- git:
- installed: true
- curl:
- installed: true
- apache2:
- installed: true
-
-http:
- # Apache PHP configuration
- {{ .Vars.web_url }}:
- status: 200
- timeout: 5000
- username: {{ .Vars.lephare_http_basic_user }}
- password: {{ .Vars.lephare_http_basic_password }}
- skip: false
- body:
- - DocumentRoot:OK
- # Pré-requis Symfony
- - ctype
- - iconv
- - json
- - pcre
- - session
- - SimpleXML
- - tokenizer
- # Extensions supplémentaires pour nos applications
- - curl
- - gd
- - intl
- - mbstring
- - pdo
- - pdo-pgsql
- - pgsql
- - posix
- - xml
- - opcache
- - memcached
- - imagick
- - apcu
- - exif
- - zip
- - soap
- - short_open_tag=off
- - magic_quotes_gpc=off
- - register_globals=off
- - session.autostart=off
- - date.timezone=Europe/Paris
- - upload_max_filesize=ok
- - post_max_size=ok
- - session.save_handler=memcached
- - session.save_path=localhost:11211
- - memcached.sess_lock_wait_min=ok
- - memcached.sess_lock_wait_max=ok
- - memcached.sess_lock_retries=ok
- - opcache.revalidate_freq=0
- - opcache.validate_timestamps=0
- - opcache.max_accelerated_files=ok
- - opcache.memory_consumption=ok
- - opcache.interned_strings_buffer=16
- - opcache.fast_shutdown=1
-
-file:
- # Authentification SSH
- # TODO: comparer directement avec curl https://faros.lephare.com/lephare.keys
- ~/.ssh/authorized_keys:
- exists: true
- mode: "0600"
- contains:
- - "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEApgU4AVX7w0DphqWhOS2/NZtDlfgjvfwdHH0K+Rr2MjSVLFrTot6xn7ww5Q4AmXGp5Q78ddirPxM1MQK8Uyd6REAawLEKLu1g4ItRo4rEer2lj5eo+UTc8IaYGiYvON/vrB1tV/gBv5zCwrQmDpEZ8aIDa7bh3d/tBlfe2MhoNomlcwrUBrnxRg6B46P8CsNTOWI0gXAmcdTeuRVV0wjxCgotV5dCIJfIa00bHVzCm0nzdJIZijdezdfMB/cLSExoIn0lxJL4014EciadsGYbksENwdvL5u4rC0jXrM9rZri97fYofX4ZiaSndPUjvqhQdVjFKGaDzjx7k03H/dNuqw== nicolas.laurent@lephare.com"
diff --git a/test_faros.php b/test_faros.php
deleted file mode 100644
index 55c3c46..0000000
--- a/test_faros.php
+++ /dev/null
@@ -1,159 +0,0 @@
-= $min ? 'ok' : 'ko').' ('.ini_get($setting).'>= '.$min.')'.PHP_EOL;
-}
-function lesserThan($setting, $max)
-{
- return $setting.'='.(ini_get($setting) <= $max ? 'ok' : 'ko').' ('.ini_get($setting).'<= '.$max.')'.PHP_EOL;
-}
-
-function printStringSizeSettings()
-{
- $scalarSettings = [
- 'min' => [
- ],
- 'max' => [
- 'upload_max_filesize' => '32M',
- 'post_max_size' => '33M',
- ],
- ];
- $extractMegabytes = function ($string) {
- if (preg_match('/.*M/i', $string)) {
- return (int) str_replace('M', '', $string);
- }
- if (preg_match('/.*G/i', $string)) {
- return (int) str_replace('G', '', $string) / 10;
- }
- return 0;
- };
- foreach ($scalarSettings['min'] as $setting => $min) {
- echo greaterThan($setting, $extractMegabytes($min));
- }
- foreach ($scalarSettings['max'] as $setting => $max) {
- echo lesserThan($setting, $extractMegabytes($max));
- }
-}
-function printScalarSettings()
-{
- $scalarSettings = [
- 'min' => [
- 'memcached.sess_lock_wait_min' => 150,
- ],
- 'max' => [
- 'upload_max_filesize' => '32M',
- 'post_max_size' => '33M',
- 'memcached.sess_lock_wait_max' => 150,
- 'memcached.sess_lock_retries' => 800,
- 'opcache.revalidate_freq' => 0,
- 'opcache.max_accelerated_files' => 7963,
- 'opcache.memory_consumption' => 192,
- 'opcache.interned_strings_buffer' => 16,
- ],
- ];
- foreach ($scalarSettings['min'] as $setting => $min) {
- echo greaterThan($setting, $min);
- }
- foreach ($scalarSettings['max'] as $setting => $max) {
- echo lesserThan($setting, $max);
- }
-}
-
-function printOnOffSetting($setting)
-{
- echo onOff($setting).PHP_EOL;
-}
-
-function printSetting($setting)
-{
- echo "${setting}=".ini_get($setting).PHP_EOL;
-}
-
-function printPhpConfiguration()
-{
- $onOffSettings = [
- 'short_open_tag',
- 'magic_quotes_gpc',
- 'register_globals',
- 'session.autostart',
- ];
- $settings = [
- 'date.timezone',
- 'session.save_handler',
- 'session.save_path',
- 'opcache.validate_timestamps',
- 'opcache.fast_shutdown',
- ];
- foreach ($onOffSettings as $setting) {
- printOnOffSetting($setting);
- }
- foreach ($settings as $setting) {
- printSetting($setting);
- }
- printScalarSettings();
- printStringSizeSettings();
-}
-
-function printLoadedExtensions()
-{
- $required = [
- 'ctype',
- 'iconv',
- 'json',
- 'pcre',
- 'session',
- 'SimpleXML',
- 'tokenizer',
- 'curl',
- 'gd',
- 'intl',
- 'mbstring',
- 'pdo',
- 'pdo-pgsql',
- 'pgsql',
- 'posix',
- 'xml',
- 'opcache',
- 'memcached',
- 'imagick',
- 'apcu',
- 'exif',
- 'zip',
- 'soap',
- ];
- foreach ($required as $item) {
- if (extension_loaded($item)) {
- echo $item.PHP_EOL;
- }
- }
-}
-
-echo '';
-testDocumentRoot();
-echo 'PHP extensions:'.PHP_EOL;
-
-echo 'PHP configuration'.PHP_EOL;
-printPhpConfiguration();
-echo 'Apache modules:'.PHP_EOL;
-echo 'PHP version:'.phpversion().PHP_EOL;
-echo 'Extensions:'.PHP_EOL;
-printLoadedExtensions();
-
-echo '
';
diff --git a/tools/generator_versions_docs.php b/tools/generator_versions_docs.php
new file mode 100644
index 0000000..b0fb4a7
--- /dev/null
+++ b/tools/generator_versions_docs.php
@@ -0,0 +1,126 @@
+ $json
+ */
+function templateManage(string $templateContent, array $json): string
+{
+ $search = [];
+ $fill = [];
+
+ foreach ($json as $key => $value) {
+ $search[] = '{{'.$key.'}}';
+ $fill[] = $value;
+ }
+
+ return str_replace($search, $fill, $templateContent);
+}
+
+/**
+ * @return array
+ */
+function getDataFromVersionfile(string $filePath, bool $directPath): array
+{
+ if (!$directPath) {
+ $filePath = FOLDER_VERSIONS_PATH.$filePath;
+ }
+ $fileContent = file_get_contents($filePath);
+ if (!$fileContent) {
+ exit(84);
+ }
+
+ return json_decode($fileContent, true);
+}
+
+/**
+ * @param array $versionJson
+ */
+function handleVersionfileJson(array $versionJson): void
+{
+ $fullJson = array_merge_recursive(getDataFromVersionfile('shared.json', false), $versionJson);
+
+ generateNewVersionsFiles($fullJson);
+}
+
+/**
+ * @param array $json
+ */
+function generateMarkdownFile(array $json, string $newfilePath): void
+{
+ echo ' * Generating markdown file : '.$newfilePath."\n";
+ $versionData = (object) $json;
+ ob_start();
+ require './templates/template.md.php';
+ $content = ob_get_clean();
+ file_put_contents($newfilePath, $content);
+}
+
+/**
+ * @param array $json
+ */
+function generatePhpcheckFile(array $json, string $newfilePath): void
+{
+ echo ' * Generating php check script : '.$newfilePath."\n";
+ $template = file_get_contents(TEMPLATES_FOLDER.'check_version_script_template.php');
+ if (false === $template) {
+ return;
+ }
+ $filledContent = templateManage($template, ['jsontoinject' => json_encode($json)]);
+ file_put_contents($newfilePath, $filledContent);
+}
+
+/**
+ * @param array $fullJson
+ */
+function generateNewVersionsFiles(mixed $fullJson): void // .md & php
+{
+ $phpscriptFilepath = VERSIONS_SCRIPTS_FOLDER.'check_'.$fullJson['version'].'.php';
+ $markdownFilepath = VERSIONS_PAGES_SITE_FOLDER.$fullJson['version'].'.md';
+
+ echo "\033[92mFAROS VERSION ".$fullJson['version']." --> Generating files....\033[0m\n";
+ generateMarkdownFile($fullJson, $markdownFilepath);
+ generatePhpcheckFile($fullJson, $phpscriptFilepath);
+ echo "\n";
+}
+
+function generateAllVersions(): void
+{
+ $folder = opendir(FOLDER_VERSIONS_PATH);
+
+ if ($folder) {
+ while (false !== ($entry = readdir($folder))) {
+ if ('.' != $entry && '..' != $entry) {
+ if ('shared.json' == $entry) {
+ continue;
+ }
+ $json = getDataFromVersionfile($entry, false);
+ handleVersionfileJson($json);
+ }
+ }
+ closedir($folder);
+ }
+}
+
+function generateOneVersion(string $filePath): void
+{
+ $json = getDataFromVersionfile($filePath, true);
+ handleVersionfileJson($json);
+}
+
+function main(): void
+{
+ global $argv;
+
+ if (2 == count($argv)) {
+ generateOneVersion($argv[1]);
+ } else {
+ generateAllVersions();
+ }
+}
+
+main();
diff --git a/tools/managed_context/metadata.json b/tools/managed_context/metadata.json
new file mode 100644
index 0000000..2e0910c
--- /dev/null
+++ b/tools/managed_context/metadata.json
@@ -0,0 +1 @@
+{"current_schema_version":"0.0.1"}
\ No newline at end of file
diff --git a/tools/readme.md b/tools/readme.md
new file mode 100644
index 0000000..0262990
--- /dev/null
+++ b/tools/readme.md
@@ -0,0 +1,25 @@
+# Générateur de documentation & scripts FAROS VERSION help
+
+### Les fichiers
+* **tools/generator_versions_docs.php** --> le script php à déclencher, qui se base sur les fichiers json basé dans le dossier /versions_data et les templates /templates
+* **tools/templates/check_version_script_template.php** --> le template du script PHP offert aux hébergeurs afin de tester leur machine, celui-ci se base sur un json injecté au début du fichier par le générateur.
+* **tools/templates/template.md.php** --> template d'une page de documentation pour une version Faros en php (avec du markdown).
+* **versions_datas/x.json** --> shared.json stocke toutes les informations communes à toutes les versions de faros, chaque fichier *version*.json représente une version individuelle. Voir JSON.
+* Le dossier et ses sous-dossiers **docs/generated/** --> contient tous les fichiers générés par le générateur (documentation Markdown & fichiers de tests scripts php).
+
+### le JSON / templates
+* Dans le **template markdown** : vous pouvez utiliser du php pour accéder à $versionData.
+* Dans le **template php**, pour accéder à une variable du json, accéder à $versionData.
+* Dans les **JSON**
+ * **pour les requirements**, si l'on souhaite l'afficher mais ne pas le tester, commencer par _.
+ * **Pour les settings** (php.ini), possibilité d'ajouter des opérateurs : <= < > >= pour les valeurs chiffrées attendues. Si l'on souhaite faire un commentaire, une ligne simple à afficher directement sur le markdown, et non testée dans la vérification des settings php, donner une clé préfixée par un underscore du type : "_stringunique".
+
+### Ajouter une nouvelle version
+* Créer un nouveau fichier json, la version de faros est stockée dans la clé "version", n'hésitez pas à vous baser sur les json existants.
+* Penser à modifier l'url dans index.md de la dernière version !
+### Modifier une version
+* Ouvrez le json et modifiez comme vous le souhaitez les informations. Pour ajouter de nouvelles valeurs et les utiliser voir ci-dessus. En fonction de la complexité des changements il est possible qu'il soit nécessaire de toucher aux templates markdown, php voire même le générateur. Une fois des modifications apportées lancer le générateur (voir ci-dessous) pour actualiser la documentation.
+
+
+### Execution
+`php generator_versions_docs.php [?lienFichierjsonSpécifique]`
diff --git a/check_faros_version/check_2023_06.php b/tools/templates/check_version_script_template.php
similarity index 59%
rename from check_faros_version/check_2023_06.php
rename to tools/templates/check_version_script_template.php
index fcf561f..a9d9ab6 100644
--- a/check_faros_version/check_2023_06.php
+++ b/tools/templates/check_version_script_template.php
@@ -1,85 +1,93 @@
version; // 0.6 // @phpstan-ignore-line
+$URL = $versionData->URL;
// htaccess
-$USERNAME = 'EDIT_ME';
-$PASSWORD = 'EDIT_ME';
+$USERNAME = $versionData->ht_access_username;
+$PASSWORD = $versionData->ht_access_password;
// FIN DE ZONE A EDITER *******************************************************************************************
-$PHP_VERSION = '8.2';
+$PHP_VERSION = $versionData->php_version;
// TODO: KO
-function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
-{
- $check = false;
- $ch = curl_init();
- curl_setopt_array($ch, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
- ],
- \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
- ]);
- //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
- $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
- //var_dump(curl_getinfo($ch));
- curl_close($ch);
- if (200 === $httpCode) {
- $check = true;
- }
-
- return [
- 'prerequis' => 'SSL & HTTP/2',
- 'check' => $check,
- 'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
- ];
-}
+// function get_ssl_http2_check(string $url, ?string $username, ?string $password): array
+// {
+// $check = false;
+// $ch = curl_init();
+// curl_setopt_array($ch, [
+// \CURLOPT_URL => $url,
+// \CURLOPT_RETURNTRANSFER => true,
+// \CURLOPT_MAXREDIRS => 10,
+// \CURLOPT_FOLLOWLOCATION => true,
+// \CURLOPT_CUSTOMREQUEST => 'HEAD',
+// \CURLOPT_TIMEOUT => 0,
+// \CURLOPT_HTTPHEADER => [
+// 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+// ],
+// \CURLOPT_HTTP_VERSION => 3, // https://stackoverflow.com/a/34609756
+// ]);
+// //curl_setopt($ch, \CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_2TLS);
+// $httpCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
+// //var_dump(curl_getinfo($ch));
+// curl_close($ch);
+// if (200 === $httpCode) {
+// $check = true;
+// }
+
+// return [
+// 'prerequis' => 'SSL & HTTP/2',
+// 'check' => $check,
+// 'bsClass' => get_bs_class($check),
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// 'errorMessage' => true === $check ? '' : $httpCode,
+// ];
+// }
// for OpCache
function get_call_itself_check(string $url, ?string $username, ?string $password): array
{
$check = false;
- $curl = curl_init();
-
- curl_setopt_array($curl, [
- \CURLOPT_URL => $url,
- \CURLOPT_RETURNTRANSFER => true,
- \CURLOPT_MAXREDIRS => 10,
- \CURLOPT_FOLLOWLOCATION => true,
- \CURLOPT_CUSTOMREQUEST => 'HEAD',
- \CURLOPT_TIMEOUT => 0,
- \CURLOPT_HTTPHEADER => [
- 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
+
+ $context = stream_context_create([
+ 'http' => [
+ 'method' => 'HEAD',
+ 'header' => 'Authorization: Basic '.base64_encode(sprintf('%s:%s', $username, $password)),
],
]);
- $response = curl_exec($curl);
-
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- $response = curl_exec($curl);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = true;
+ $response = @file_get_contents($url, false, $context);
+ $httpCode = 0;
+ if (false !== $response) {
+ // Successfully retrieved the resource
+ $http_response_header = $http_response_header ?? [];
+
+ foreach ($http_response_header as $header) {
+ if (0 === strpos($header, 'HTTP/')) {
+ $parts = explode(' ', $header);
+ $httpCode = (int) $parts[1];
+ break;
+ }
+ }
+
+ if (200 === $httpCode) {
+ $check = true;
+ }
}
return [
'prerequis' => 'Peut appeler '.$url,
'check' => $check,
'bsClass' => get_bs_class($check),
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : $httpCode,
+ 'checkLabel' => $check ? 'OK' : 'KO',
+ 'errorMessage' => $check ? '' : $httpCode,
];
}
@@ -90,8 +98,9 @@ function get_bs_class(bool $check): string
function get_binaries_check(): array
{
+ global $versionData;
$checks = [];
- $binaries = ['/usr/bin/git', '/usr/bin/curl'];
+ $binaries = $versionData->binaries;
foreach ($binaries as $binary) {
$check = is_executable($binary);
$checks[] = [
@@ -106,28 +115,28 @@ function get_binaries_check(): array
}
// TODO: KO car le user du script n'a pas les droits de lecture sur le fichier
-function get_lephare_keys_check(): array
-{
- $check = false;
- $curl = curl_init();
- curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
- curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, \CURLOPT_HEADER, false);
- $data = curl_exec($curl);
- $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
- curl_close($curl);
- if (200 === $httpCode) {
- $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
- }
-
- return [
- 'prerequis' => 'Authentification SSH',
- 'check' => $check,
- 'errorMessage' => true === $check ? '' : 'Contenus différents',
- 'bsClass' => true === $check ? 'success' : 'danger',
- 'checkLabel' => true === $check ? 'OK' : 'KO',
- ];
-}
+// function get_lephare_keys_check(): array
+// {
+// $check = false;
+// $curl = curl_init();
+// curl_setopt($curl, \CURLOPT_URL, 'https://faros.lephare.com/lephare.keys');
+// curl_setopt($curl, \CURLOPT_RETURNTRANSFER, true);
+// curl_setopt($curl, \CURLOPT_HEADER, false);
+// $data = curl_exec($curl);
+// $httpCode = curl_getinfo($curl, \CURLINFO_HTTP_CODE);
+// curl_close($curl);
+// if (200 === $httpCode) {
+// $check = $data === file_get_contents('/home/acme/.ssh/authorized_keys');
+// }
+
+// return [
+// 'prerequis' => 'Authentification SSH',
+// 'check' => $check,
+// 'errorMessage' => true === $check ? '' : 'Contenus différents',
+// 'bsClass' => true === $check ? 'success' : 'danger',
+// 'checkLabel' => true === $check ? 'OK' : 'KO',
+// ];
+// }
function get_php_version_check(string $PHP_VERSION): array
{
@@ -161,44 +170,70 @@ function get_document_root_check(): array
];
}
+function check_comparator_int_phpini($keyValue, $expected): bool
+{
+ $check = false;
+ $biggerAuthorized = ('>' == $expected[0]); // so if false it authorizes under.
+ $equalAuthorized = ('=' == $expected[1]);
+ $integerPartExpected = $equalAuthorized ? substr($expected, 2) : substr($expected, 1);
+ $extractedIntegerExpected = intval($integerPartExpected);
+ $extractedIntegerKeyValue = intval($keyValue);
+
+ if ($biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue >= $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && $equalAuthorized) {
+ $check = ($extractedIntegerKeyValue <= $extractedIntegerExpected);
+ } elseif ($biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue > $extractedIntegerExpected);
+ } elseif (!$biggerAuthorized && !$equalAuthorized) {
+ $check = ($extractedIntegerKeyValue < $extractedIntegerExpected);
+ }
+
+ return $check;
+}
+
+function check_value_phpini(string $keyValue, string $expected): bool
+{
+ $check = false;
+
+ if ('off' == strtolower($expected)) {
+ $check = ('' == $keyValue or '0' == $keyValue or 'off' == $keyValue or 'Off' == $keyValue);
+ } elseif ('on' == strtolower($expected)) {
+ $check = ('1' == $keyValue or 'on' == $keyValue or 'On' == $keyValue);
+ } elseif ('<' == $expected[0] or '>' == $expected[0]) {
+ $check = check_comparator_int_phpini($keyValue, $expected);
+ } else {
+ $check = strtolower($expected) === strtolower($keyValue);
+ }
+
+ return $check;
+}
+
function get_php_configuration_checks(): array
{
+ global $versionData;
$checks = [];
- $settings = [
- // 'short_open_tag' => 'off', PHP_INI_PERDIR https://www.php.net/manual/en/ini.core.php
- // 'magic_quotes_gpc' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- // 'register_globals' => 'off', removed in PHP 5.4 https://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime
- 'display_errors' => 'off',
- 'display_startup_errors' => 'off',
- 'session.auto_start' => 'off',
- 'date.timezone' => 'Europe/Paris',
- 'upload_max_filesize' => '32M',
- 'post_max_size' => '33M',
- 'sys_temp_dir' => '/var/tmp',
- 'upload_tmp_dir' => '/var/tmp',
- 'session.save_handler' => 'memcached',
- 'session.save_path' => 'localhost:11211',
- 'memcached.sess_lock_wait_min' => '150',
- 'memcached.sess_lock_wait_max' => '150',
- 'memcached.sess_lock_retries' => '800',
- 'opcache.revalidate_freq' => '0',
- 'opcache.validate_timestamps' => '0',
- 'opcache.max_accelerated_files' => '20000',
- 'opcache.memory_consumption' => '256',
- 'opcache.interned_strings_buffer' => '16',
- 'memory_limit' => '128M',
- 'opcache.enable' => '1',
- 'realpath_cache_size' => '4096K',
- 'realpath_cache_ttl' => '60',
- ];
+ $settings = $versionData->settings;
+
foreach ($settings as $key => $expected) {
- $check = strtolower($expected) === strtolower(ini_get($key));
+ $keyValue = ini_get($key);
+ if ('_' == substr($key, 0, 1)) {
+ continue;
+ }
+ $check = check_value_phpini($keyValue, $expected);
+ $errMessage = $keyValue;
+ if ('' == $keyValue) {
+ $errMessage = 'Value is null.';
+ }
+ if (false === $keyValue) {
+ $errMessage = 'Option do not exist.';
+ }
$checks[] = [
'prerequis' => $key.' = '.$expected,
'check' => $check,
'bsClass' => true === $check ? 'success' : 'danger',
'checkLabel' => true === $check ? 'OK' : 'KO',
- 'errorMessage' => true === $check ? '' : ini_get($key),
+ 'errorMessage' => true === $check ? '' : $errMessage,
];
}
@@ -207,16 +242,9 @@ function get_php_configuration_checks(): array
function get_loaded_extensions_symfony_checks(): array
{
+ global $versionData;
$checks = [];
- $symfonyRequirements = [
- 'ctype',
- 'iconv',
- 'json',
- 'pcre',
- 'session',
- 'SimpleXML',
- 'tokenizer',
- ];
+ $symfonyRequirements = $versionData->symfony_requirements;
foreach ($symfonyRequirements as $item) {
$check = extension_loaded($item);
@@ -233,27 +261,13 @@ function get_loaded_extensions_symfony_checks(): array
function get_loaded_extensions_faros_checks(): array
{
+ global $versionData;
$checks = [];
- $farosRequirements = [
- 'curl',
- 'gd',
- 'intl',
- 'mbstring',
- 'pdo',
- 'pdo_pgsql',
- 'pgsql',
- 'posix',
- 'xml',
- //'opcache',
- 'memcached',
- 'imagick',
- 'apcu',
- // TODO: ne marche pas 'apcu_bc',
- 'exif',
- 'zip',
- 'soap',
- ];
+ $farosRequirements = $versionData->faros_requirements;
foreach ($farosRequirements as $item) {
+ if ('_' === substr($item, 0, 1)) {
+ continue;
+ } // if begin by _, then we don't want it to be tested.
$check = extension_loaded($item);
$checks[] = [
'prerequis' => $item,
@@ -283,7 +297,8 @@ function get_loaded_extensions_faros_checks(): array
Test compatibilité Faros {$FAROS_VERSION}
HTML;
-$mainChecks = <<
@@ -320,14 +335,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
-$mainChecks .= <<
HTML;
$html .= $mainChecks;
-$binariesChecksTable = <<
@@ -346,19 +361,19 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$binariesChecksTable .= <<
HTML;
$html .= $binariesChecksTable;
-$html .= <<Configuration PHP
Extensions #
HTML;
-$symfonyExtensionsTable = <<
@@ -377,14 +392,14 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$symfonyExtensionsTable .= <<
HTML;
$html .= $symfonyExtensionsTable;
-$farosExtensionsTable = <<
@@ -403,18 +418,18 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$farosExtensionsTable .= <<
HTML;
$html .= $farosExtensionsTable;
-$html .= <<php.ini #
HTML;
-$phpConfigurationCheckTable = <<
@@ -433,20 +448,20 @@ function get_loaded_extensions_faros_checks(): array
HTML;
}
-$phpConfigurationCheckTable .= <<
HTML;
$html .= $phpConfigurationCheckTable;
-$html .= <<Configuration Apache #
HTML;
$documentRootCheck = get_document_root_check();
-$sslHttp2Check = get_ssl_http2_check($URL, $USERNAME, $PASSWORD);
-$apacheChecks = <<
@@ -472,13 +487,13 @@ function get_loaded_extensions_faros_checks(): array
*/
-$apacheChecks .= <<
diff --git a/tools/templates/template.md.php b/tools/templates/template.md.php
new file mode 100644
index 0000000..bab318b
--- /dev/null
+++ b/tools/templates/template.md.php
@@ -0,0 +1,155 @@
+
+---
+layout: default
+title: fullVersionName; ?>
+
+nav_order: order_in_list; ?>
+
+parent: Versions
+permalink: docs/versions/version; ?>.html
+
+---
+
+Pour être sûr que la machine est bien configurée --> tout doit être en vert sur le script PHP, toutes les checkbox sur ce document cochées.
+
+
+# version; ?>
+
+
+1. TOC
+{:toc}
+
+## Check
+
+ Le script [check_version; ?>.php](../versions_tests_scripts/check_version; ?>.php) est à disposition pour check une bonne partie des prérequis.
+Tous les voyants devraient être verts, attention cependant il est possible d'avoir de faux négatifs (par exemple si la mémoire configurée est supérieure à celle requise).
+
+## La stack de base
+- Debian debian_version; ?>
+
+- PHP php_version; ?>
+
+- Apache apache_version; ?>
+
+- PostgreSQL pgsql_version; ?>
+
+
+## Dimensionnement machine
+
+Nous exigeons au minimum :
+ * expected_vcpus; ?> vCPU
+ * expected_ram_go; ?> Go RAM
+
+## Authentification SSH
+
+ La liste des clés publiques des utilisateurs du Phare est disponible à l'adresse suivante : [https://faros.lephare.com/lephare.keys].
+
+ curl -sL https://faros.lephare.com/lephare.keys >> ~/.ssh/authorized_keys
+ chmod 0600 ~/.ssh/authorized_keys
+
+ La liste des adresses ips à autoriser :
+ip_to_authorize as $ip) {
+ echo '* '.$ip." \n";
+ }
+?>
+
+
+## Binaires
+binaries_to_display as $bin) {
+ echo '* '.$bin." \n";
+ }
+?>
+
+
+## Droits
+
+### Logs
+
+Créer un user séparé qui a uniquement accès en lecture aux fichiers de logs suivants :
+
+- Apache access.log
+- Apache error.log
+- PHP-FPM log
+
+## Configuration PHP
+
+### Extensions
+
+Pré-requis pour Symfony 6.x
+
+symfony_requirements as $requirement) {
+ if ('_' == $requirement[0]) {
+ $requirement = substr($requirement, 1);
+ }
+ echo '* '.$requirement." \n";
+ }
+?>
+
+Extensions supplémentaires pour nos applications
+faros_requirements as $requirement) {
+ if ('_' == $requirement[0]) {
+ $requirement = substr($requirement, 1);
+ }
+ echo '* '.$requirement." \n";
+ }
+?>
+
+### php.ini
+settings as $key => $value) {
+ if ('_' != substr($key, 0, 1)) {
+ if ('<' == $value[0] or '>' == $value[0]) {
+ if ('=' == $value[1]) {
+ $value = substr($value, 2);
+ } else {
+ $value = substr($value, 1);
+ }
+ }
+ echo "\t".$key.' = '.$value."\n";
+ } else {
+ echo "\t".$value."\n";
+ }
+ }
+?>
+
+## Configuration Apache
+
+### SSL & HTTP/2
+
+Chaque vhost doit être accessible en HTTPS et HTTP/2.
+
+### Configuration vhost
+
+ DocumentRoot /current/public/
+ Options FollowSymLinks
+ Protocols h2 http/1.1
+
+### Modules
+
+- mod_rewrite On
+- mod_headers On
+- mod_expires On
+- mod_deflate On
+
+
+
\ No newline at end of file
diff --git a/tools/test_suite_analysis/metadata.json b/tools/test_suite_analysis/metadata.json
new file mode 100644
index 0000000..2e0910c
--- /dev/null
+++ b/tools/test_suite_analysis/metadata.json
@@ -0,0 +1 @@
+{"current_schema_version":"0.0.1"}
\ No newline at end of file
diff --git a/versions_data/10.0(2019.10).json b/versions_data/10.0(2019.10).json
new file mode 100644
index 0000000..7480d9d
--- /dev/null
+++ b/versions_data/10.0(2019.10).json
@@ -0,0 +1,68 @@
+{
+ "version": "10.0",
+ "fullVersionName": "10.0 (2019.10)",
+ "apache_version": 2.4,
+ "debian_version": 10,
+ "faros_requirements": [
+ "_opcache - not tested by check_script",
+ "_pcntl - not tested by check_script",
+ "apcu",
+ "curl",
+ "exif",
+ "gd",
+ "imagick",
+ "intl",
+ "mbstring",
+ "memcached",
+ "pdo",
+ "pdo_pgsql",
+ "pgsql",
+ "posix",
+ "soap",
+ "xml",
+ "zip"
+ ],
+ "ht_access_password": "EDIT_ME",
+ "ht_access_username": "EDIT_ME",
+ "order_in_list": 6,
+ "pgsql_version": 11,
+ "php_version": 7.3,
+ "settings": {
+ "display_errors": "Off",
+ "display_startup_errors": "Off",
+ "session.auto_start": "off",
+ "date.timezone": "Europe/Paris",
+ "upload_max_filesize": "32M",
+ "post_max_size": "33M",
+ "sys_temp_dir": "/var/tmp",
+ "upload_tmp_dir": "/var/tmp",
+ "_comment1" : "\n\n\t# Les sessions sont stockées dans memcached -->",
+ "session.save_handler": "memcached",
+ "session.save_path": "localhost:11211",
+ "memcached.sess_lock_wait_min": "150",
+ "memcached.sess_lock_wait_max": "150",
+ "memcached.sess_lock_retries": "800",
+ "_comment2" : "\n\n\t# Optimisation opcache -->",
+ "opcache.revalidate_freq": "0",
+ "opcache.validate_timestamps": "0",
+ "opcache.max_accelerated_files": "20000",
+ "opcache.memory_consumption": "<=256",
+ "opcache.interned_strings_buffer": "16",
+ "short_open_tag": "Off",
+ "memory_limit": "128M",
+ "opcache.enable": "1",
+ "_comment3" : "\n\n\t# Realpath cache -->",
+ "realpath_cache_size": "4096K",
+ "realpath_cache_ttl": "60"
+ },
+ "symfony_requirements": [
+ "SimpleXML",
+ "ctype",
+ "iconv",
+ "json",
+ "pcre",
+ "session",
+ "tokenizer"
+ ],
+ "URL": "https://acme.fr"
+}
diff --git a/versions_data/10.1(2021.03).json b/versions_data/10.1(2021.03).json
new file mode 100644
index 0000000..558484d
--- /dev/null
+++ b/versions_data/10.1(2021.03).json
@@ -0,0 +1,68 @@
+{
+ "version": "10.1",
+ "fullVersionName": "10.1 (2021.03)",
+ "apache_version": 2.4,
+ "debian_version": 10,
+ "faros_requirements": [
+ "_opcache - not tested by check_script",
+ "_pcntl - not tested by check_script",
+ "apcu",
+ "curl",
+ "exif",
+ "gd",
+ "imagick",
+ "intl",
+ "mbstring",
+ "memcached",
+ "pdo",
+ "pdo_pgsql",
+ "pgsql",
+ "posix",
+ "soap",
+ "xml",
+ "zip"
+ ],
+ "ht_access_password": "EDIT_ME",
+ "ht_access_username": "EDIT_ME",
+ "order_in_list": 5,
+ "pgsql_version": 11,
+ "php_version": 7.4,
+ "settings": {
+ "display_errors": "Off",
+ "display_startup_errors": "Off",
+ "session.auto_start": "off",
+ "date.timezone": "Europe/Paris",
+ "upload_max_filesize": "32M",
+ "post_max_size": "33M",
+ "sys_temp_dir": "/var/tmp",
+ "upload_tmp_dir": "/var/tmp",
+ "_comment1" : "\n\n\t# Les sessions sont stockées dans memcached -->",
+ "session.save_handler": "memcached",
+ "session.save_path": "localhost:11211",
+ "memcached.sess_lock_wait_min": "150",
+ "memcached.sess_lock_wait_max": "150",
+ "memcached.sess_lock_retries": "800",
+ "_comment2" : "\n\n\t# Optimisation opcache -->",
+ "opcache.revalidate_freq": "0",
+ "opcache.validate_timestamps": "0",
+ "opcache.max_accelerated_files": "20000",
+ "opcache.memory_consumption": "<=256",
+ "opcache.interned_strings_buffer": "16",
+ "short_open_tag": "Off",
+ "memory_limit": "128M",
+ "opcache.enable": "1",
+ "_comment3" : "\n\n\t# Realpath cache -->",
+ "realpath_cache_size": "4096K",
+ "realpath_cache_ttl": "60"
+ },
+ "symfony_requirements": [
+ "SimpleXML",
+ "ctype",
+ "iconv",
+ "json",
+ "pcre",
+ "session",
+ "tokenizer"
+ ],
+ "URL": "https://acme.fr"
+}
diff --git a/versions_data/2022.01.json b/versions_data/2022.01.json
new file mode 100644
index 0000000..41c6486
--- /dev/null
+++ b/versions_data/2022.01.json
@@ -0,0 +1,68 @@
+{
+ "version": "2022.01",
+ "fullVersionName": "2022.01",
+ "apache_version": 2.4,
+ "debian_version": 11.2,
+ "faros_requirements": [
+ "_opcache - not tested by check_script",
+ "_pcntl - not tested by check_script",
+ "apcu",
+ "curl",
+ "exif",
+ "gd",
+ "imagick",
+ "intl",
+ "mbstring",
+ "memcached",
+ "pdo",
+ "pdo_pgsql",
+ "pgsql",
+ "posix",
+ "soap",
+ "xml",
+ "zip"
+ ],
+ "ht_access_password": "EDIT_ME",
+ "ht_access_username": "EDIT_ME",
+ "order_in_list": 4,
+ "pgsql_version": 13,
+ "php_version": 8.1,
+ "settings": {
+ "display_errors": "Off",
+ "display_startup_errors": "Off",
+ "session.auto_start": "off",
+ "date.timezone": "Europe/Paris",
+ "upload_max_filesize": "32M",
+ "post_max_size": "33M",
+ "sys_temp_dir": "/var/tmp",
+ "upload_tmp_dir": "/var/tmp",
+ "_comment1" : "\n\n\t# Les sessions sont stockées dans memcached -->",
+ "session.save_handler": "memcached",
+ "session.save_path": "localhost:11211",
+ "memcached.sess_lock_wait_min": "150",
+ "memcached.sess_lock_wait_max": "150",
+ "memcached.sess_lock_retries": "800",
+ "_comment2" : "\n\n\t# Optimisation opcache -->",
+ "opcache.revalidate_freq": "0",
+ "opcache.validate_timestamps": "0",
+ "opcache.max_accelerated_files": "20000",
+ "opcache.memory_consumption": "<=256",
+ "opcache.interned_strings_buffer": "16",
+ "short_open_tag": "Off",
+ "memory_limit": "128M",
+ "opcache.enable": "1",
+ "_comment3" : "\n\n\t# Realpath cache -->",
+ "realpath_cache_size": "4096K",
+ "realpath_cache_ttl": "60"
+ },
+ "symfony_requirements": [
+ "SimpleXML",
+ "ctype",
+ "iconv",
+ "json",
+ "pcre",
+ "session",
+ "tokenizer"
+ ],
+ "URL": "https://acme.fr"
+}
diff --git a/versions_data/2022.07.json b/versions_data/2022.07.json
new file mode 100644
index 0000000..c3efcef
--- /dev/null
+++ b/versions_data/2022.07.json
@@ -0,0 +1,68 @@
+{
+ "version": "2022.07",
+ "fullVersionName": "2022.07",
+ "apache_version": 2.4,
+ "debian_version": 11.3,
+ "faros_requirements": [
+ "_opcache - not tested by check_script",
+ "_pcntl - not tested by check_script",
+ "apcu",
+ "curl",
+ "exif",
+ "gd",
+ "imagick",
+ "intl",
+ "mbstring",
+ "memcached",
+ "pdo",
+ "pdo_pgsql",
+ "pgsql",
+ "posix",
+ "soap",
+ "xml",
+ "zip"
+ ],
+ "ht_access_password": "EDIT_ME",
+ "ht_access_username": "EDIT_ME",
+ "order_in_list": 3,
+ "pgsql_version": 13,
+ "php_version": 8.1,
+ "settings": {
+ "display_errors": "Off",
+ "display_startup_errors": "Off",
+ "session.auto_start": "off",
+ "date.timezone": "Europe/Paris",
+ "upload_max_filesize": "32M",
+ "post_max_size": "33M",
+ "sys_temp_dir": "/var/tmp",
+ "upload_tmp_dir": "/var/tmp",
+ "_comment1" : "\n\n\t# Les sessions sont stockées dans memcached -->",
+ "session.save_handler": "memcached",
+ "session.save_path": "localhost:11211",
+ "memcached.sess_lock_wait_min": "150",
+ "memcached.sess_lock_wait_max": "150",
+ "memcached.sess_lock_retries": "800",
+ "_comment2" : "\n\n\t# Optimisation opcache -->",
+ "opcache.revalidate_freq": "0",
+ "opcache.validate_timestamps": "0",
+ "opcache.max_accelerated_files": "20000",
+ "opcache.memory_consumption": "<=256",
+ "opcache.interned_strings_buffer": "16",
+ "short_open_tag": "Off",
+ "memory_limit": "128M",
+ "opcache.enable": "1",
+ "_comment3" : "\n\n\t# Realpath cache -->",
+ "realpath_cache_size": "4096K",
+ "realpath_cache_ttl": "60"
+ },
+ "symfony_requirements": [
+ "SimpleXML",
+ "ctype",
+ "iconv",
+ "json",
+ "pcre",
+ "session",
+ "tokenizer"
+ ],
+ "URL": "https://acme.fr"
+}
diff --git a/versions_data/2023.04.json b/versions_data/2023.04.json
new file mode 100644
index 0000000..93af51c
--- /dev/null
+++ b/versions_data/2023.04.json
@@ -0,0 +1,68 @@
+{
+ "version": "2023.04",
+ "fullVersionName": "2023.04",
+ "apache_version": 2.4,
+ "debian_version": 11.6,
+ "faros_requirements": [
+ "_opcache - not tested by check_script",
+ "_pcntl - not tested by check_script",
+ "apcu",
+ "curl",
+ "exif",
+ "gd",
+ "imagick",
+ "intl",
+ "mbstring",
+ "memcached",
+ "pdo",
+ "pdo_pgsql",
+ "pgsql",
+ "posix",
+ "soap",
+ "xml",
+ "zip"
+ ],
+ "ht_access_password": "EDIT_ME",
+ "ht_access_username": "EDIT_ME",
+ "order_in_list": 2,
+ "pgsql_version": 14,
+ "php_version": 8.2,
+ "settings": {
+ "display_errors": "Off",
+ "display_startup_errors": "Off",
+ "session.auto_start": "off",
+ "date.timezone": "Europe/Paris",
+ "upload_max_filesize": "32M",
+ "post_max_size": "33M",
+ "sys_temp_dir": "/var/tmp",
+ "upload_tmp_dir": "/var/tmp",
+ "_comment1" : "\n\n\t# Les sessions sont stockées dans memcached -->",
+ "session.save_handler": "memcached",
+ "session.save_path": "localhost:11211",
+ "memcached.sess_lock_wait_min": "150",
+ "memcached.sess_lock_wait_max": "150",
+ "memcached.sess_lock_retries": "800",
+ "_comment2" : "\n\n\t# Optimisation opcache -->",
+ "opcache.revalidate_freq": "0",
+ "opcache.validate_timestamps": "0",
+ "opcache.max_accelerated_files": "20000",
+ "opcache.memory_consumption": "<=256",
+ "opcache.interned_strings_buffer": "16",
+ "short_open_tag": "Off",
+ "memory_limit": "128M",
+ "opcache.enable": "1",
+ "_comment3" : "\n\n\t# Realpath cache -->",
+ "realpath_cache_size": "4096K",
+ "realpath_cache_ttl": "60"
+ },
+ "symfony_requirements": [
+ "SimpleXML",
+ "ctype",
+ "iconv",
+ "json",
+ "pcre",
+ "session",
+ "tokenizer"
+ ],
+ "URL": "https://acme.fr"
+}
diff --git a/versions_data/2023.06.json b/versions_data/2023.06.json
new file mode 100644
index 0000000..ff11440
--- /dev/null
+++ b/versions_data/2023.06.json
@@ -0,0 +1,68 @@
+{
+ "version": "2023.06",
+ "fullVersionName": "2023.06",
+ "apache_version": 2.4,
+ "debian_version": 12,
+ "faros_requirements": [
+ "_opcache - not tested by check_script",
+ "_pcntl - not tested by check_script",
+ "apcu",
+ "curl",
+ "exif",
+ "gd",
+ "imagick",
+ "intl",
+ "mbstring",
+ "memcached",
+ "pdo",
+ "pdo_pgsql",
+ "pgsql",
+ "posix",
+ "soap",
+ "xml",
+ "zip"
+ ],
+ "ht_access_password": "EDIT_ME",
+ "ht_access_username": "EDIT_ME",
+ "order_in_list": 1,
+ "pgsql_version": 15,
+ "php_version": 8.2,
+ "settings": {
+ "display_errors": "Off",
+ "display_startup_errors": "Off",
+ "session.auto_start": "off",
+ "date.timezone": "Europe/Paris",
+ "upload_max_filesize": "32M",
+ "post_max_size": "33M",
+ "sys_temp_dir": "/var/tmp",
+ "upload_tmp_dir": "/var/tmp",
+ "_comment1" : "\n\n\t# Les sessions sont stockées dans memcached -->",
+ "session.save_handler": "memcached",
+ "session.save_path": "localhost:11211",
+ "memcached.sess_lock_wait_min": "150",
+ "memcached.sess_lock_wait_max": "150",
+ "memcached.sess_lock_retries": "800",
+ "_comment2" : "\n\n\t# Optimisation opcache -->",
+ "opcache.revalidate_freq": "0",
+ "opcache.validate_timestamps": "0",
+ "opcache.max_accelerated_files": "20000",
+ "opcache.memory_consumption": "<=256",
+ "opcache.interned_strings_buffer": "16",
+ "short_open_tag": "Off",
+ "memory_limit": "128M",
+ "opcache.enable": "1",
+ "_comment3" : "\n\n\t# Realpath cache -->",
+ "realpath_cache_size": "4096K",
+ "realpath_cache_ttl": "60"
+ },
+ "symfony_requirements": [
+ "SimpleXML",
+ "ctype",
+ "iconv",
+ "json",
+ "pcre",
+ "session",
+ "tokenizer"
+ ],
+ "URL": "https://acme.fr"
+}
diff --git a/versions_data/9.0(2019.03).json b/versions_data/9.0(2019.03).json
new file mode 100644
index 0000000..d0a2b70
--- /dev/null
+++ b/versions_data/9.0(2019.03).json
@@ -0,0 +1,68 @@
+{
+ "version": "9.0",
+ "fullVersionName": "9.0 (2019.03)",
+ "apache_version": 2.4,
+ "debian_version": 9,
+ "faros_requirements": [
+ "_opcache - not tested by check_script",
+ "_pcntl - not tested by check_script",
+ "apcu",
+ "curl",
+ "exif",
+ "gd",
+ "imagick",
+ "intl",
+ "mbstring",
+ "memcached",
+ "pdo",
+ "pdo_pgsql",
+ "pgsql",
+ "posix",
+ "soap",
+ "xml",
+ "zip"
+ ],
+ "ht_access_password": "EDIT_ME",
+ "ht_access_username": "EDIT_ME",
+ "order_in_list": 7,
+ "pgsql_version": 9.6,
+ "php_version": 7.3,
+ "settings": {
+ "display_errors": "Off",
+ "display_startup_errors": "Off",
+ "session.auto_start": "off",
+ "date.timezone": "Europe/Paris",
+ "upload_max_filesize": "32M",
+ "post_max_size": "33M",
+ "sys_temp_dir": "/var/tmp",
+ "upload_tmp_dir": "/var/tmp",
+ "_comment1" : "\n\n\t# Les sessions sont stockées dans memcached -->",
+ "session.save_handler": "memcached",
+ "session.save_path": "localhost:11211",
+ "memcached.sess_lock_wait_min": "150",
+ "memcached.sess_lock_wait_max": "150",
+ "memcached.sess_lock_retries": "800",
+ "_comment2" : "\n\n\t# Optimisation opcache -->",
+ "opcache.revalidate_freq": "0",
+ "opcache.validate_timestamps": "0",
+ "opcache.max_accelerated_files": "20000",
+ "opcache.memory_consumption": "<=256",
+ "opcache.interned_strings_buffer": "16",
+ "short_open_tag": "Off",
+ "memory_limit": "128M",
+ "opcache.enable": "1",
+ "_comment3" : "\n\n\t# Realpath cache -->",
+ "realpath_cache_size": "4096K",
+ "realpath_cache_ttl": "60"
+ },
+ "symfony_requirements": [
+ "SimpleXML",
+ "ctype",
+ "iconv",
+ "json",
+ "pcre",
+ "session",
+ "tokenizer"
+ ],
+ "URL": "https://acme.fr"
+}
diff --git a/versions_data/shared.json b/versions_data/shared.json
new file mode 100644
index 0000000..2fd70e5
--- /dev/null
+++ b/versions_data/shared.json
@@ -0,0 +1,22 @@
+{
+ "commonConfigLoaded": true,
+ "expected_vcpus" : 2,
+ "expected_ram_go": 4,
+ "ip_to_authorize": [
+ "37.59.114.65",
+ "193.39.2.4",
+ "80.15.143.1"
+ ],
+ "binaries": [
+ "/usr/bin/curl",
+ "/usr/bin/git"
+ ],
+ "binaries_to_display": [
+ "Python 3.5 - 3.11, pré-requis pour [managed node Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#managed-node-requirements)",
+ "curl",
+ "git",
+ "git-lfs",
+ "pg_dump (utilisé par lephare/ansible-deploy)",
+ "rsync"
+ ]
+}
\ No newline at end of file