diff --git a/HowtoDrupal.md b/HowtoDrupal.md
index 65a36033..c19a514a 100644
--- a/HowtoDrupal.md
+++ b/HowtoDrupal.md
@@ -12,13 +12,13 @@ title: Howto Drupal
* Un serveur web (Apache/Nginx/...)
* Une base de données MySQL/Mariadb ou PostgreSQL
* PHP 8.1 (Drupal 10), PHP 7.4/8.0/8.1 (Drupal 9), PHP 7.3/7.4 (Drupal 7 et 8)
+* Pour Drush : /home en `exec` et `mariadb-client` installé
Pour plus de détails, voir [la documentation de Drupal](https://www.drupal.org/docs/user_guide/en/install-requirements.html) notamment :
* [pré-requis pour Drupal 7](https://www.drupal.org/docs/7/system-requirements/)
* [pré-requis pour Drupal 8 et versions suivantes](https://www.drupal.org/docs/system-requirements/)
-
### Apache
Drupal est livré avec des fichiers `.htaccess` qui utilisent un nombre varié de directives.
@@ -68,9 +68,68 @@ drupal/core-project-message 10.2.1 Adds a message after Composer instal
drupal/core-recommended 10.2.1 Core and its dependencies with known-compatible minor versions. Require this project INSTEAD OF drupal/core.
~~~
-On peut en suite, aller directement à l'addresse du site pour obtenir l'interface d'installation du site.
+On peut en suite, aller directement à l'addresse du site (DocumentRoot qui pointe vers `/home/foo/www/web/`) pour obtenir l'interface de finalisation du site.
On aura notamment besoin d'avoir des identifiants pour accéder à une base de données.
+On peut également finaliser l'installation avec Drush (cf plus bas) :
+
+~~~
+$ cd $ROOT
+$ drush site:install standard
+
+ Database name [drupal]:
+ > foo
+
+ Database driver [mysql]:
+ >
+
+ Database username [drupal]:
+ > foo
+
+ Database password [drupal]:
+ > PASSWORD
+
+ Database host [127.0.0.1]:
+ >
+
+ Database port [3306]:
+ >
+
+ You are about to:
+ * DROP all tables in your 'foo' database.
+
+ Do you want to continue? (yes/no) [yes]:
+ >
+
+ [notice] Starting Drupal installation. This takes a while.
+ [notice] Performed install task: install_select_language
+ [notice] Performed install task: install_select_profile
+ [notice] Performed install task: install_load_profile
+ [notice] Performed install task: install_verify_requirements
+ [notice] Performed install task: install_settings_form
+ [notice] Performed install task: install_verify_database_ready
+ [notice] Performed install task: install_base_system
+ [notice] Performed install task: install_bootstrap_full
+ [notice] Performed install task: install_profile_modules
+ [notice] Performed install task: install_profile_themes
+ [notice] Performed install task: install_install_profile
+ [notice] Performed install task: install_configure_form
+ [notice] Performed install task: install_finished
+ [success] Installation complete. User name: admin User password: PASSWORD
+
+$ cd /web/sites/default/
+
+$ drush sql-connect
+mysql --user=foo --password='PASSWORD' --database=foo --host=127.0.0.1 --port=3306 -A
+
+$ drush status
+Drupal version : 10.2.1
+Site URI : http://default
+DB driver : mysql
+DB hostname : 127.0.0.1
+[…]
+~~~
+
### Cron
@@ -84,6 +143,8 @@ $ crontab -l
[Drush](https://www.drush.org/) est un outil en ligne de commande pour installer/gérer des sites Drupal.
+Liste des commandes disponibles par défaut :
+
### Installation
Pour installer la dernière version :
@@ -142,6 +203,25 @@ Drupal root : /home/foo/www/web
Site path : sites/default
~~~
+### Alias
+
+Fichiers dans le répertoire `~/.drush/` :
+
+* `local.drushrc.php` : configuration générale
+* `FOO.alias.drushrc.php` : contexte spécifique pour la commande `drush @FOO`
+* `BAR.alias.drushrc.php` : contexte spécifique pour la commande `drush @BAR`
+
+~~~
+$ cat ~/.drush/FOO.alias.drushrc.php
+
+$aliases['FOO'] = array (
+ 'uri' => 'foo.example.com',
+ 'root' => '/home/foo/www/web',
+...
+~~~
+
+## Configuration
+
### Configuration derrière un reverse-proxy
Dans la configuration de Drupal, des directives sont à activer pour la prise en compte des headers HTTP X-Forwarded-For).
@@ -166,6 +246,102 @@ Elles ressemblent à :
}
~~~
+## Multisite
+
+
+
+Il est possible de créer différents sites Drupal à partir d'une même installation.
+Cela permet d'avoir une seule fois le code source de Drupal et donc une gestion simplifiée.
+Cela peut avoir des inconvénients si besoin de gérer finement des ensembles de personnalisations différentes par site.
+
+On suppose qu'une installation de base de Drupal a été faite, et Drush également installé.
+
+> *Note* : il est nécessaire d'avoir la commande `mysql` installée, donc `mariadb-client` doit être installé là où tourne PHP
+
+Pour l'installation d'un premier site distinct du `default` créé à l'installation de Drupal :
+
+~~~
+$ cd $ROOT
+
+$ drush site:install standard --sites-subdir=test1
+
+ Database name [drupal]:
+ > foo_test1
+
+ Database driver [mysql]:
+ >
+
+ Database username [drupal]:
+ > foo
+
+ Database password [drupal]:
+ > PASSWORD
+
+ Database host [127.0.0.1]:
+ >
+
+ Database port [3306]:
+ >
+
+ You are about to:
+ * Create a sites/test1/settings.php file
+ * Create a sites/sites.php file
+ * DROP all tables in your 'foo_test1' database.
+
+ Do you want to continue? (yes/no) [yes]:
+ >
+
+ [notice] Starting Drupal installation. This takes a while.
+ [notice] Performed install task: install_select_language
+ [notice] Performed install task: install_select_profile
+ [notice] Performed install task: install_load_profile
+ [notice] Performed install task: install_verify_requirements
+ [notice] Performed install task: install_settings_form
+ [notice] Performed install task: install_verify_database_ready
+ [notice] Performed install task: install_base_system
+ [notice] Performed install task: install_bootstrap_full
+ [notice] Performed install task: install_profile_modules
+ [notice] Performed install task: install_profile_themes
+ [notice] Performed install task: install_install_profile
+ [notice] Performed install task: install_configure_form
+ [notice] Performed install task: install_finished
+ [success] Installation complete. User name: admin User password: PASSWORD
+~~~
+
+Cela crée donc un fichier `web/sites/sites.php` pour gérer plusieurs sites.
+
+Et les sites sont « crées » dans des répertoires `web/sites/SITE/`
+contenant principalement un fichier `settings.php` contenant notamment les paramètres de base de données du site.
+
+~~~
+$ cd web/sites/test1/
+
+$ drush sql-connect
+mysql --user=foo --password='PASSWORD' --database=foo_test1 --host=127.0.0.1 --port=3306 -A
+
+$ drush status
+Drupal version : 10.2.1
+Site URI : http://test1
+DB driver : mysql
+DB hostname : 127.0.0.1
+[…]
+~~~
+
+Il suffit ensuite de créer la configuration Apache ou Nginx pour les FQDN souhaités avec un DocumentRoot dans `web/`
+et de bien configurer le fichier `web/sites/sites.php` par exemple :
+
+~~~
+$sites['test1.example.com'] = 'test1';
+$sites['test2.example.com'] = 'test2';
+~~~
+
+On peut utiliser la commande Drush sur un site en particulier via l'argument `-l` :
+
+~~~
+$ drush -l test1 status
+$ drush -l test1 updatedb
+~~~
+
## Optimisation
@@ -177,6 +353,9 @@ Elles ressemblent à :
Désactiver le logging non nécessaire en prod... surtout dans la base de données :
+
+
+
## Sécurité
### Annonces de sécurité