Skip to content

Commit

Permalink
afup#1416 bdd
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Jan 7, 2024
1 parent e5185eb commit 6d43eed
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 28 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: CS fixer prerequisites
- name: CS fixer prerequisites config
run: make configs/application/config.php

- name: CS fixer prerequisites parameters
run: make app/config/parameters.yml

- name: Composer install
run: composer install --no-scripts

Expand Down
4 changes: 0 additions & 4 deletions configs/application/config-test.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
$configuration['bdd']['hote']='dbtest';
$configuration['bdd']['base']='web';
$configuration['bdd']['utilisateur']='afup';
$configuration['bdd']['mot_de_passe']='afup';
$configuration['web']['path']='/';

$configuration['mails']['serveur_smtp']='mailcatcher';
Expand Down
4 changes: 0 additions & 4 deletions configs/application/config.php.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
$configuration['bdd']['hote']='127.0.0.1';
$configuration['bdd']['base']='afup_dev';
$configuration['bdd']['utilisateur']='afup_dev';
$configuration['bdd']['mot_de_passe']='p455w0rd';
$configuration['web']['path']='http://.dev/';

$configuration['mails']['serveur_smtp']='';
Expand Down
4 changes: 0 additions & 4 deletions configs/application/config.php.dist-docker
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php
$configuration['bdd']['hote']='db';
$configuration['bdd']['base']='web';
$configuration['bdd']['utilisateur']='afup';
$configuration['bdd']['mot_de_passe']='afup';
$configuration['web']['path']='/';

$configuration['mails']['serveur_smtp']='mailcatcher';
Expand Down
10 changes: 0 additions & 10 deletions htdocs/pages/administration/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@

$formulaire->setDefaults($defaults);

$formulaire->addElement('header', '' , 'Base de données');
$formulaire->addElement('text' , 'bdd|hote' , 'Hote' , array('size' => 30));
$formulaire->addElement('text' , 'bdd|base' , 'Base' , array('size' => 30));
$formulaire->addElement('text' , 'bdd|utilisateur' , 'Utilisateur' , array('size' => 30));
$formulaire->addElement('text' , 'bdd|mot_de_passe', 'Mot de passe' , array('size' => 30));

$formulaire->addElement('header' , '' , 'Mails');
$formulaire->addElement('text' , 'mails|email_expediteur' , 'Email expediteur' , array('size' => 30));
$formulaire->addElement('text' , 'mails|nom_expediteur' , 'Nom expediteur' , array('size' => 30));
Expand Down Expand Up @@ -48,10 +42,6 @@
$formulaire->addElement('header', 'boutons' , '');
$formulaire->addElement('submit', 'soumettre', 'Enregistrer');

$formulaire->addRule('bdd|hote' , 'Hote manquant' , 'required');
$formulaire->addRule('bdd|base' , 'Base manquante' , 'required');
$formulaire->addRule('bdd|utilisateur', 'Utilisateur manquant', 'required');

if ($formulaire->validate()) {
$valeurs = $formulaire->exportValues();
$conf->importer($valeurs);
Expand Down
5 changes: 0 additions & 5 deletions sources/Afup/Forum/AppelConferencier.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

namespace Afup\Site\Forum;

use Afup\Site\Utils\Configuration;
use Afup\Site\Utils\Mailing;
use AppBundle\Email\Mailer\MailUser;
use AppBundle\Email\Mailer\Message;
use AppBundle\Event\Model\Talk;
use Symfony\Component\Translation\Translator;

class AppelConferencier
{
Expand Down
13 changes: 13 additions & 0 deletions sources/Afup/Utils/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace Afup\Site\Utils;

use Symfony\Component\Yaml\Yaml;

define('EURO', '');

/**
Expand Down Expand Up @@ -33,6 +36,16 @@ public function __construct($chemin_fichier)
{
$this->_chemin_fichier = $chemin_fichier;
$this->_valeurs = include($this->_chemin_fichier);

$parametersFile = dirname(__FILE__).'/../../../app/config/parameters.yml';
if (is_file($parametersFile)) {
$parameters = Yaml::parseFile($parametersFile)['parameters'];

$this->_valeurs['bdd']['hote'] = $parameters['database_host'];
$this->_valeurs['bdd']['base'] = $parameters['database_name'];
$this->_valeurs['bdd']['utilisateur'] = $parameters['database_user'];
$this->_valeurs['bdd']['mot_de_passe'] = $parameters['database_password'];
}
}

/**
Expand Down

0 comments on commit 6d43eed

Please sign in to comment.