mirror of
https://github.com/YunoHost-Apps/wordpress_ynh.git
synced 2024-09-03 20:36:10 +02:00
Update helpers
This commit is contained in:
parent
931b5dc1a2
commit
d4b6c29957
8 changed files with 167 additions and 170 deletions
117
YEP.md
Normal file
117
YEP.md
Normal file
|
@ -0,0 +1,117 @@
|
|||
#### [Level 0](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-0)
|
||||
[YEP 1.1 - Nommer son app et son dépot](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
|
||||
`Validated`
|
||||
[YEP 1.2 - Inscrire l'app sur un "répertoire" connu](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-12)
|
||||
`Validated`
|
||||
|
||||
#### [Level 1](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-1)
|
||||
[YEP 2.2 - Utiliser bash pour les scripts principaux](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-22)
|
||||
`Validated`
|
||||
[YEP 2.5 - Copier correctement des fichiers](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-25)
|
||||
`Don't know`
|
||||
[YEP 2.7 - Donner des permissions suffisantes aux instructions bash](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-27)
|
||||
`Validated`
|
||||
[YEP 2.15 - Suivre les instructions d'installation de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-215)
|
||||
`Validated`
|
||||
|
||||
#### [Level 2](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-2)
|
||||
[YEP 1.5 - Mettre à jour régulièrement le statut de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
|
||||
`Validated`
|
||||
[YEP 2.18.2 - Gérer l'installation à la racine d’un nom de domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2182)
|
||||
`Validated` - *Automatically verified.*
|
||||
[YEP 2.18.3 - Gérer l'installation sur un sous-domaine](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2183)
|
||||
`Validated` - *Automatically verified.*
|
||||
[YEP 2.18.4 - Gérer l'installation sur un chemin /path](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2184)
|
||||
`Validated` - *Automatically verified.*
|
||||
[YEP 4.6 - Gère le multi-instance](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-11)
|
||||
`Validated` - *Automatically verified.*
|
||||
|
||||
#### [Level 3](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-3)
|
||||
[YEP 2.3 - Sauvegarder les réponses lors de l'installation](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-23)
|
||||
`Validated`
|
||||
|
||||
#### [Level 4](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-4)
|
||||
[YEP 4.1 - Lier au ldap](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-41)
|
||||
`Validated`
|
||||
[YEP 4.2 - Lier l'authentification au sso](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-42)
|
||||
`Validated`
|
||||
|
||||
#### [Level 5](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-5)
|
||||
[YEP 1.3 - Indiquer la licence associée au paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-13)
|
||||
`Validated`
|
||||
[YEP 2.1 - Respecter le format du manifeste](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-21)
|
||||
`Validated` - *Automatically verified.*
|
||||
[YEP 2.12 - Utiliser les commandes pratiques (helpers)](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-212)
|
||||
`Validated`
|
||||
[YEP 2.18.1 - Lancer le script d'installation d'une webapp correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2181)
|
||||
`Validated`
|
||||
|
||||
#### [Level 6](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-6)
|
||||
[YEP 1.4 - Informer sur l'intention de maintenir un paquet](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-14)
|
||||
`Validated`
|
||||
[YEP 1.6 - Se tenir informé sur l'évolution du packaging d'apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-16)
|
||||
`Validated`
|
||||
[YEP 1.7 - Ajouter l'app à l'organisation YunoHost-Apps](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-17)
|
||||
`Validated` - *Automatically verified.*
|
||||
[YEP 1.8 - Publier des demandes de test](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-18)
|
||||
`Validated`
|
||||
[YEP 1.9 - Documenter l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-19)
|
||||
`Validated`
|
||||
[YEP 1.10 - Garder un historique de version propre](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-110)
|
||||
`Don't know`
|
||||
[YEP 2.9 - Enlever toutes traces de l'app lors de la suppression](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-29)
|
||||
`Validated`
|
||||
[YEP 3.3 - Faciliter le contrôle de l'intégrité des sources](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-33)
|
||||
`Validated`
|
||||
[YEP 3.5 - Suivre les recommendations de la documentation de l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-35)
|
||||
`Partially validated`
|
||||
[YEP 3.6 - Mettre à jour les versions contenant des CVE](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-36)
|
||||
`Validated`
|
||||
[YEP 4.3 - Fournir un script de sauvegarde YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-43)
|
||||
`Validated` - *Automatically verified.*
|
||||
[YEP 4.4 - Fournir un script de restauration YunoHost fonctionnel](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-44)
|
||||
`Validated` - *Automatically verified.*
|
||||
|
||||
#### [Level 7](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-7)
|
||||
[YEP 2.6 - Annuler l'action si les valeurs d'entrées sont incorrectes](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-26)
|
||||
`Validated`
|
||||
[YEP 3.2 - Ouvrir un port correctement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-32)
|
||||
`Not applicable`
|
||||
|
||||
#### [Level 8](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-8)
|
||||
[YEP 2.4 - Détecter et gérer les erreurs](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-24)
|
||||
`Validated`
|
||||
[YEP 2.8 - Modifier correctement une configuration système](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-28)
|
||||
`Validated`
|
||||
[YEP 2.16 - Vérifier la disponibilité des dépendances sur ARM, x86 et x64](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-216)
|
||||
`Not yet validated` - *Automatically verified.*
|
||||
[YEP 2.18.5 - Gérer la tuile YunoHost pour faciliter la navigation entre les applications](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-2185)
|
||||
`Validated`
|
||||
[YEP 3.4 - Isoler l'app](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-34)
|
||||
`Partially validated`
|
||||
[YEP 4.5 - Utiliser les hooks](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-45)
|
||||
`Not applicable`
|
||||
|
||||
#### [Level 9](https://github.com/YunoHost/doc/blob/master/packaging_apps_levels_fr.md#niveau-9)
|
||||
[YEP 2.10 - Configurer les logs de l'application](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-210)
|
||||
`Not applicable`
|
||||
[YEP 2.11 - Utiliser une variable plutôt que l'app id directement](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-211)
|
||||
`Validated`
|
||||
[YEP 2.13 - Traduire le paquet en anglais](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-213)
|
||||
`Not yet validated`
|
||||
[YEP 2.14 - Remplir correctement un fichier de conf](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-214)
|
||||
`Not yet validated`
|
||||
[YEP 2.17 - Prendre en compte la version d'origine lors des mises à jour](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-217)
|
||||
`Validated`
|
||||
[YEP 4.2.1 - Déconnexion](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-421)
|
||||
`Don't know`
|
||||
|
||||
#### Other YEP
|
||||
[YEP 3.1 - Ne pas demander ou stocker de mot de passe LDAP](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-31)
|
||||
`Validated`
|
||||
[YEP 4.7 - Ajouter un module à la CLI](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-47)
|
||||
`Not applicable`
|
||||
[YEP 4.8 - Ajouter un module à l'admin web](https://github.com/YunoHost/doc/blob/master/packaging_apps_guidelines_fr.md#yep-48)
|
||||
`Not applicable`
|
||||
|
||||
State of each YEP can be one of these: `Validated`, `Partially validated`, `Not yet validated`, `Not applicable`, `Don't know`.
|
|
@ -1,5 +1,4 @@
|
|||
;; Test complet sans multisite
|
||||
auto_remove=1
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
|
@ -21,7 +20,6 @@
|
|||
port_already_use=0
|
||||
change_url=0
|
||||
;; Test avec multisite
|
||||
auto_remove=1
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
"name": "WordPress",
|
||||
"id": "wordpress",
|
||||
"packaging_format": 1,
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.6.4"
|
||||
},
|
||||
"description": {
|
||||
"en": "Create a beautiful blog or website easily",
|
||||
"fr": "Logiciel de création de blog ou de site Web"
|
||||
|
@ -16,6 +13,9 @@
|
|||
"name": "Maniack Crudelis",
|
||||
"email": "maniackc_dev@crudelis.fr"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.7.2"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
|
|
|
@ -1,93 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# =============================================================================
|
||||
# YUNOHOST 2.7 FORTHCOMING HELPERS
|
||||
# =============================================================================
|
||||
|
||||
# Create a dedicated nginx config
|
||||
#
|
||||
# usage: ynh_add_nginx_config
|
||||
ynh_add_nginx_config () {
|
||||
finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different "$finalnginxconf"
|
||||
sudo cp ../conf/nginx.conf "$finalnginxconf"
|
||||
|
||||
# To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable.
|
||||
# Substitute in a nginx config file only if the variable is not empty
|
||||
if test -n "${path_url:-}"; then
|
||||
ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf"
|
||||
fi
|
||||
if test -n "${domain:-}"; then
|
||||
ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf"
|
||||
fi
|
||||
if test -n "${port:-}"; then
|
||||
ynh_replace_string "__PORT__" "$port" "$finalnginxconf"
|
||||
fi
|
||||
if test -n "${app:-}"; then
|
||||
ynh_replace_string "__NAME__" "$app" "$finalnginxconf"
|
||||
fi
|
||||
if test -n "${final_path:-}"; then
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf"
|
||||
fi
|
||||
ynh_store_file_checksum "$finalnginxconf"
|
||||
|
||||
sudo systemctl reload nginx
|
||||
}
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
#
|
||||
# usage: ynh_remove_nginx_config
|
||||
ynh_remove_nginx_config () {
|
||||
ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
sudo systemctl reload nginx
|
||||
}
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
#
|
||||
# usage: ynh_add_fpm_config
|
||||
ynh_add_fpm_config () {
|
||||
finalphpconf="/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_backup_if_checksum_is_different "$finalphpconf"
|
||||
sudo cp ../conf/php-fpm.conf "$finalphpconf"
|
||||
ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf"
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf"
|
||||
ynh_replace_string "__USER__" "$app" "$finalphpconf"
|
||||
sudo chown root: "$finalphpconf"
|
||||
ynh_store_file_checksum "$finalphpconf"
|
||||
|
||||
if [ -e "../conf/php-fpm.ini" ]
|
||||
then
|
||||
finalphpini="/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
ynh_backup_if_checksum_is_different "$finalphpini"
|
||||
sudo cp ../conf/php-fpm.ini "$finalphpini"
|
||||
sudo chown root: "$finalphpini"
|
||||
ynh_store_file_checksum "$finalphpini"
|
||||
fi
|
||||
|
||||
sudo systemctl reload php5-fpm
|
||||
}
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
#
|
||||
# usage: ynh_remove_fpm_config
|
||||
ynh_remove_fpm_config () {
|
||||
ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1
|
||||
sudo systemctl reload php5-fpm
|
||||
}
|
||||
|
||||
#=================================================
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# CHECKING
|
||||
#=================================================
|
||||
|
||||
CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# DISPLAYING
|
||||
#=================================================
|
||||
|
@ -96,10 +8,6 @@ WARNING () { # Écrit sur le canal d'erreur pour passer en warning.
|
|||
$@ >&2
|
||||
}
|
||||
|
||||
QUIET () { # Redirige la sortie standard dans /dev/null
|
||||
$@ > /dev/null
|
||||
}
|
||||
|
||||
ALL_QUIET () { # Redirige la sortie standard et d'erreur dans /dev/null
|
||||
$@ > /dev/null 2>&1
|
||||
}
|
||||
|
@ -108,35 +16,6 @@ ALL_QUIET () { # Redirige la sortie standard et d'erreur dans /dev/null
|
|||
# BACKUP
|
||||
#=================================================
|
||||
|
||||
BACKUP_FAIL_UPGRADE () {
|
||||
WARNING echo "Upgrade failed."
|
||||
app_bck=${app//_/-} # Replace all '_' by '-'
|
||||
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$backup_number; then # Vérifie l'existence de l'archive avant de supprimer l'application et de restaurer
|
||||
sudo yunohost app remove $app # Supprime l'application avant de la restaurer.
|
||||
sudo yunohost backup restore --ignore-hooks $app_bck-pre-upgrade$backup_number --apps $app --force # Restore the backup if upgrade failed
|
||||
ynh_die "The app was restored to the way it was before the failed upgrade."
|
||||
fi
|
||||
}
|
||||
|
||||
BACKUP_BEFORE_UPGRADE () { # Backup the current version of the app, restore it if the upgrade fails
|
||||
backup_number=1
|
||||
old_backup_number=2
|
||||
app_bck=${app//_/-} # Replace all '_' by '-'
|
||||
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade1; then # Vérifie l'existence d'une archive déjà numéroté à 1.
|
||||
backup_number=2 # Et passe le numéro de l'archive à 2
|
||||
old_backup_number=1
|
||||
fi
|
||||
|
||||
sudo yunohost backup create --ignore-hooks --apps $app --name $app_bck-pre-upgrade$backup_number # Créer un backup différent de celui existant.
|
||||
if [ "$?" -eq 0 ]; then # Si le backup est un succès, supprime l'archive précédente.
|
||||
if sudo yunohost backup list | grep -q $app_bck-pre-upgrade$old_backup_number; then # Vérifie l'existence de l'ancienne archive avant de la supprimer, pour éviter une erreur.
|
||||
QUIET sudo yunohost backup delete $app_bck-pre-upgrade$old_backup_number
|
||||
fi
|
||||
else # Si le backup a échoué
|
||||
ynh_die "Backup failed, the upgrade process was aborted."
|
||||
fi
|
||||
}
|
||||
|
||||
HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un humain
|
||||
human=$(numfmt --to=iec --from-unit=1K $1)
|
||||
echo $human
|
||||
|
@ -144,8 +23,8 @@ HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un huma
|
|||
|
||||
CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant
|
||||
file_to_analyse=$1
|
||||
backup_size=$(sudo du --summarize "$file_to_analyse" | cut -f1)
|
||||
free_space=$(sudo df --output=avail "/home/yunohost.backup" | sed 1d)
|
||||
backup_size=$(du --summarize "$file_to_analyse" | cut -f1)
|
||||
free_space=$(df --output=avail "/home/yunohost.backup" | sed 1d)
|
||||
|
||||
if [ $free_space -le $backup_size ]
|
||||
then
|
||||
|
|
|
@ -2,25 +2,25 @@
|
|||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# MANAGE FAILURE OF THE SCRIPT
|
||||
#=================================================
|
||||
|
||||
# Exit on command errors and treat unset variables as an error
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
if [ ! -e _common.sh ]; then
|
||||
# Get the _common.sh file if it's not in the current directory
|
||||
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
||||
sudo chmod a+rx _common.sh
|
||||
cp ../settings/scripts/_common.sh ./_common.sh
|
||||
chmod a+rx _common.sh
|
||||
fi
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
@ -60,4 +60,3 @@ ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
|||
|
||||
ynh_mysql_dump_db "$db_name" > db.sql
|
||||
CHECK_SIZE "db.sql"
|
||||
ynh_backup "db.sql"
|
||||
|
|
|
@ -33,6 +33,9 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
||||
#=================================================
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
||||
# Normalize the url path syntax
|
||||
path_url=$(ynh_normalize_url_path $path_url)
|
||||
|
||||
|
@ -41,8 +44,6 @@ ynh_webpath_available $domain $path_url
|
|||
# Register (book) web path
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||
|
||||
if [ "$path_url" == "/" ] && [ $multisite -eq 1 ]; then
|
||||
ynh_die "Multisite option of wordpress doesn't work at root of domain."
|
||||
fi
|
||||
|
@ -109,7 +110,7 @@ ynh_add_fpm_config
|
|||
# CONFIGURE WP-CONFIG
|
||||
#=================================================
|
||||
|
||||
sudo cp ../conf/wp-config.php $final_path/wp-config.php
|
||||
cp ../conf/wp-config.php $final_path/wp-config.php
|
||||
# Change variables in Wordpress configuration
|
||||
ynh_replace_string "__DB_USER__" "$db_name" $final_path/wp-config.php
|
||||
ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/wp-config.php
|
||||
|
@ -133,14 +134,14 @@ done
|
|||
#=================================================
|
||||
|
||||
# Set right permissions for curl install
|
||||
sudo chown -R $app: $final_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
# Rend la page d'install publique pour curl
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
sudo yunohost app ssowatconf # Régénère la configuration de SSOwat
|
||||
yunohost app ssowatconf # Régénère la configuration de SSOwat
|
||||
|
||||
# Reload Nginx
|
||||
sudo systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
|
||||
# Wordpress installation
|
||||
ynh_local_curl "/wp-admin/install.php?step=2" "&weblog_title=YunoBlog" "user_name=$admin_wordpress" "admin_password=$db_pwd" "admin_password2=$db_pwd" "admin_email=$admin_wordpress@$domain" "Submit=Install+WordPress"
|
||||
|
@ -160,7 +161,7 @@ WARNING echo ""
|
|||
# INSTALL WORDPRESS' PLUGINS
|
||||
#=================================================
|
||||
|
||||
sudo wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
|
||||
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
|
||||
wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path"
|
||||
|
||||
$wpcli_alias plugin install simple-ldap-login
|
||||
|
@ -228,9 +229,9 @@ ynh_store_file_checksum "$final_path/wp-config.php"
|
|||
#=================================================
|
||||
|
||||
# Les fichiers appartiennent à l'user wordpress, pour permettre les mises à jour.
|
||||
sudo chown -R $app: $final_path
|
||||
chown -R $app: $final_path
|
||||
# Sauf le fichier de config wp-config.php qui appartient à root
|
||||
sudo chown root: $final_path/wp-config.php
|
||||
chown root: $final_path/wp-config.php
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -246,7 +247,7 @@ fi
|
|||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
sudo systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# REMOVE WP-CLI.PHAR
|
||||
|
|
|
@ -2,25 +2,25 @@
|
|||
|
||||
#=================================================
|
||||
# GENERIC STARTING
|
||||
#=================================================
|
||||
# MANAGE FAILURE OF THE SCRIPT
|
||||
#=================================================
|
||||
|
||||
# Exit on command errors and treat unset variables as an error
|
||||
set -eu
|
||||
|
||||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
if [ ! -e _common.sh ]; then
|
||||
# Get the _common.sh file if it's not in the current directory
|
||||
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
||||
sudo chmod a+rx _common.sh
|
||||
cp ../settings/scripts/_common.sh ./_common.sh
|
||||
chmod a+rx _common.sh
|
||||
fi
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
@ -37,7 +37,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
|
||||
sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
||||
yunohost app checkurl "${domain}${path_url}" -a "$app" \
|
||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die "There is already a directory: $final_path "
|
||||
|
@ -75,9 +75,9 @@ ynh_system_user_create $app # Recreate the dedicated user, if not exist
|
|||
#=================================================
|
||||
|
||||
# Les fichiers appartiennent à l'user wordpress, pour permettre les mises à jour.
|
||||
sudo chown -R $app: $final_path
|
||||
chown -R $app: $final_path
|
||||
# Sauf le fichier de config wp-config.php qui appartient à root
|
||||
sudo chown root: $final_path/wp-config.php
|
||||
chown root: $final_path/wp-config.php
|
||||
|
||||
#=================================================
|
||||
# RESTORE OF THE PHP-FPM CONFIGURATION
|
||||
|
@ -92,5 +92,5 @@ ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
|||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
|
||||
sudo systemctl reload php5-fpm
|
||||
sudo systemctl reload nginx
|
||||
systemctl reload php5-fpm
|
||||
systemctl reload nginx
|
||||
|
|
|
@ -41,7 +41,7 @@ if [ -z "$final_path" ]; then
|
|||
fi
|
||||
|
||||
if [ -z "$language" ]; then
|
||||
language=$(sudo grep WPLANG $final_path/wp-config.php | cut -d"'" -f4)
|
||||
language=$(grep WPLANG $final_path/wp-config.php | cut -d"'" -f4)
|
||||
ynh_app_setting_set $app language $language
|
||||
fi
|
||||
|
||||
|
@ -76,11 +76,14 @@ fi
|
|||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
||||
BACKUP_BEFORE_UPGRADE # Backup the current version of the app
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
BACKUP_FAIL_UPGRADE # restore it if the upgrade fails
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
|
@ -141,7 +144,7 @@ ynh_app_setting_set $app multisite $multisite
|
|||
# UPDATE WORDPRESS' PLUGINS
|
||||
#=================================================
|
||||
|
||||
sudo wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
|
||||
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
|
||||
wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path"
|
||||
update_plugin () {
|
||||
( $wpcli_alias plugin is-installed $1 && $wpcli_alias plugin update $1 ) || $wpcli_alias plugin install $1
|
||||
|
@ -165,9 +168,9 @@ ynh_store_file_checksum "$final_path/wp-config.php"
|
|||
#=================================================
|
||||
|
||||
# Les fichiers appartiennent à l'user wordpress, pour permettre les mises à jour.
|
||||
sudo chown -R $app: $final_path
|
||||
chown -R $app: $final_path
|
||||
# Sauf le fichier de config wp-config.php qui appartient à root
|
||||
sudo chown root: $final_path/wp-config.php
|
||||
chown root: $final_path/wp-config.php
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -184,7 +187,7 @@ fi
|
|||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
sudo systemctl reload nginx
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# REMOVE WP-CLI.PHAR
|
||||
|
|
Loading…
Add table
Reference in a new issue