Initialise CI with PHPStan level 0
This commit is contained in:
parent
e76ea90d89
commit
293ea73b6b
9 changed files with 58 additions and 16 deletions
22
.Jenkinsfile
Normal file
22
.Jenkinsfile
Normal file
|
@ -0,0 +1,22 @@
|
|||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'php:8.2-cli'
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('PHPStan (static analysis)') {
|
||||
steps {
|
||||
script {
|
||||
sh 'curl -fsSL https://github.com/phpstan/phpstan/releases/download/1.10.41/phpstan.phar -o phpstan.phar'
|
||||
sh 'php ./phpstan.phar analyse --configuration=phpstan.neon --memory-limit=512M --error-format=junit > phpstan-results.junit.xml'
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
junit 'phpstan-results.junit.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -263,6 +263,8 @@ class FormField {
|
|||
protected $read_only = null;
|
||||
protected $disabled = null;
|
||||
private $storage = NULL;
|
||||
protected $mandatory = null;
|
||||
protected $hidden = null;
|
||||
|
||||
protected function __construct($label) {
|
||||
$this->storage = & $_SESSION;
|
||||
|
@ -638,7 +640,7 @@ class EmailInputFormField extends TextInputFormField {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if(!empty($this->value) && !eregi('^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$',$this->value)){
|
||||
if(!empty($this->value) && !preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i', $this->value)){
|
||||
if($set_error) $this->error = 'Adresse email invalide';
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -794,7 +796,7 @@ class MultipleCheckBoxInputFormField extends FormField {
|
|||
protected $mandatory = NULL;
|
||||
protected $list = array();
|
||||
|
||||
public function __construct($label, $mandatory=TRUE, $list) {
|
||||
public function __construct($label, $list, $mandatory=TRUE) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->list = $list;
|
||||
|
@ -877,7 +879,7 @@ class SelectFormField extends FormField {
|
|||
protected $mandatory = NULL;
|
||||
protected $list = array();
|
||||
|
||||
public function __construct($label, $mandatory=TRUE, $list) {
|
||||
public function __construct($label, $list, $mandatory=TRUE) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->list = $list;
|
||||
|
@ -933,7 +935,7 @@ class RadioFormField extends FormField {
|
|||
protected $mandatory = NULL;
|
||||
protected $list = array();
|
||||
|
||||
public function __construct($label, $mandatory=TRUE, $list, $default = null) {
|
||||
public function __construct($label, $list, $mandatory=TRUE, $default = null) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->list = $list;
|
||||
|
@ -995,7 +997,7 @@ class ButtonInputFormField extends FormField {
|
|||
protected $event = NULL;
|
||||
protected $action = NULL;
|
||||
|
||||
public function __construct($label,$mandatory=FALSE, $event, $action) {
|
||||
public function __construct($label, $event, $action, $mandatory=FALSE) {
|
||||
parent::__construct($label);
|
||||
$this->mandatory = $mandatory;
|
||||
$this->event = $event;
|
||||
|
|
|
@ -74,8 +74,8 @@ function web_add($form, $admin_mail) {
|
|||
foreach ( $domain_alias as $domain ) {
|
||||
$exec_cmd = 'web-add.sh add-alias '.escapeshellarg($form->getField('username')->getValue()).' ';
|
||||
$domain = trim($domain);
|
||||
$exec_cmd .= $domain.' '. $server_list;
|
||||
sudoexec($exec_cmd, $exec_output, $exec_return);
|
||||
$exec_cmd .= $domain;
|
||||
sudoexec($exec_cmd, $exec_output2, $exec_return2);
|
||||
}
|
||||
$exec_return |= $exec_return2; // $exec_return == 0 if $exec_return == 0 && $exec_return2 == 0
|
||||
array_push($exec_output, $exec_output2);
|
||||
|
@ -254,19 +254,19 @@ $form->addField('username', new AlphaNumericalTextInputFormField("Nom d'utilisat
|
|||
$form->addField('domain', new DomainInputFormField("Nom de domaine", TRUE));
|
||||
$form->addField('domain_alias', new DomainListInputFormField("Alias (séparés par une virgule, sans espaces)", FALSE));
|
||||
$form->addField('password_random',
|
||||
new CheckboxInputFormField("Mot de passe aléatoire ?", FALSE));
|
||||
new CheckBoxInputFormField("Mot de passe aléatoire ?", FALSE));
|
||||
$form->getField('password_random')->setValue(TRUE);
|
||||
$form->addField('password', new PasswordInputFormField('Mot de passe', FALSE));
|
||||
$form->getField('password')->setDisabled();
|
||||
$form->addField('mysql_db',
|
||||
new CheckboxInputFormField("Créer une base de données MySQL ?",
|
||||
new CheckBoxInputFormField("Créer une base de données MySQL ?",
|
||||
FALSE));
|
||||
$form->getField('mysql_db')->setValue(TRUE);
|
||||
$form->addField('mysql_dbname',
|
||||
new AlphaNumericalTextInputFormField("Nom de la base MySQL", FALSE, array(20,16)));
|
||||
|
||||
$form->addField('mysql_password_random',
|
||||
new CheckboxInputFormField("Mot de passe MySQL aléatoire ?",
|
||||
new CheckBoxInputFormField("Mot de passe MySQL aléatoire ?",
|
||||
FALSE));
|
||||
$form->getField('mysql_password_random')->setValue(TRUE);
|
||||
|
||||
|
@ -344,7 +344,7 @@ if ($conf['cluster']) {
|
|||
|
||||
if ($conf['bindadmin']) {
|
||||
/* Quai13 specific: allow to switch between Gmail MX/Quai13 MX */
|
||||
$form->addField('use_gmail_mxs', new CheckboxInputFormField("Utilisation des serveurs Gmail en MX ?", FALSE));
|
||||
$form->addField('use_gmail_mxs', new CheckBoxInputFormField("Utilisation des serveurs Gmail en MX ?", FALSE));
|
||||
}
|
||||
|
||||
if (array_key_exists('php_versions', $conf) && is_array($conf['php_versions'])) {
|
||||
|
|
|
@ -81,6 +81,7 @@ function is_mcluster_mode() {
|
|||
function load_config_cluster($cluster) {
|
||||
global $conf;
|
||||
$configfile = '../conf/config.'.$cluster.'.php';
|
||||
$clusterconf = array(); // Fix static analysis. It's fully defined by config file.
|
||||
test_exist($configfile);
|
||||
require_once($configfile);
|
||||
$conf = array_merge($conf, $clusterconf);
|
||||
|
|
6
phpstan-baseline.neon
Normal file
6
phpstan-baseline.neon
Normal file
|
@ -0,0 +1,6 @@
|
|||
parameters:
|
||||
ignoreErrors:
|
||||
-
|
||||
message: "#^Undefined variable\\: \\$error$#"
|
||||
count: 3
|
||||
path: lib/bdd.php
|
13
phpstan.neon
Normal file
13
phpstan.neon
Normal file
|
@ -0,0 +1,13 @@
|
|||
includes:
|
||||
- phpstan-baseline.neon
|
||||
|
||||
parameters:
|
||||
level: 0
|
||||
paths:
|
||||
- htdocs
|
||||
- lib
|
||||
- evolibs
|
||||
- inc
|
||||
- tpl
|
||||
- conf
|
||||
- bin
|
|
@ -30,6 +30,4 @@ puis utilisez le menu ci-dessus pour administrer votre compte.</p>';
|
|||
else {
|
||||
echo '<p>Bienvenue, utilisez le menu ci-dessus pour administrer votre compte.</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
?>
|
|
@ -39,7 +39,7 @@
|
|||
for ( $i=0; $i < count($alias_list); ++$i ) {
|
||||
print '<tr>';
|
||||
printf('<td>%s</td>',
|
||||
$alias_list[$i]['alias'], $alias_list[$i]['alias']);
|
||||
$alias_list[$i]['alias']);
|
||||
if (is_superadmin())
|
||||
printf('<td><a href="/webadmin/%s/alias/delete/%s/">Supprimer</a></td>',
|
||||
$domain, $alias_list[$i]['alias']);
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
printf('<td>%s</td>', $vhost_info['owner']);
|
||||
}
|
||||
printf('<td>%s</td>',
|
||||
$vhost_info['server_name'], $vhost_info['server_name']);
|
||||
$vhost_info['server_name']);
|
||||
|
||||
if ($conf['cluster']) {
|
||||
if (empty($vhost_info['bdd']))
|
||||
|
|
Loading…
Add table
Reference in a new issue