Browse Source

English translation and typo

pull/55/head
Maniack Crudelis 7 years ago
parent
commit
f7621ae582
  1. 4
      README.md
  2. 15
      scripts/backup
  3. 37
      scripts/install
  4. 11
      scripts/remove
  5. 22
      scripts/restore
  6. 37
      scripts/upgrade

4
README.md

@ -62,7 +62,7 @@ Please do your pull request to the [testing branch](https://github.com/YunoHost-
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```
sudo yunohost app install https://github.com/YunoHost-Apps/wordpress_ynh/tree/testing --verbose
sudo yunohost app install https://github.com/YunoHost-Apps/wordpress_ynh/tree/testing --debug
or or
sudo yunohost app upgrade wordpress -u https://github.com/YunoHost-Apps/wordpress_ynh/tree/testing --verbose
sudo yunohost app upgrade wordpress -u https://github.com/YunoHost-Apps/wordpress_ynh/tree/testing --debug
``` ```

15
scripts/backup

@ -6,12 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -35,26 +30,26 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP OF THE MAIN DIR OF THE APP
# BACKUP THE APP MAIN DIR
#================================================= #=================================================
CHECK_SIZE "$final_path" CHECK_SIZE "$final_path"
ynh_backup "$final_path" ynh_backup "$final_path"
#================================================= #=================================================
# BACKUP OF THE NGINX CONFIGURATION
# BACKUP NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP OF THE PHP-FPM CONFIGURATION
# BACKUP PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP OF THE SQL BDD
# BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_mysql_dump_db "$db_name" > db.sql ynh_mysql_dump_db "$db_name" > db.sql

37
scripts/install

@ -43,7 +43,7 @@ path_url=$(ynh_normalize_url_path $path_url)
ynh_webpath_register $app $domain $path_url ynh_webpath_register $app $domain $path_url
if [ "$path_url" == "/" ] && [ $multisite -eq 1 ]; then if [ "$path_url" == "/" ] && [ $multisite -eq 1 ]; then
ynh_die "Multisite option of wordpress doesn't work at root of domain."
ynh_die "Multisite option of wordpress doesn't work at the root of a domain."
fi fi
#================================================= #=================================================
@ -66,7 +66,7 @@ ynh_app_setting_set $app multisite $multisite
ynh_install_app_dependencies php5-cli ynh_install_app_dependencies php5-cli
#================================================= #=================================================
# CREATE A SQL BDD
# CREATE A MYSQL DATABASE
#================================================= #=================================================
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid $app)
@ -92,7 +92,7 @@ ynh_add_nginx_config
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
# Create a system user
# Create a dedicated system user
ynh_system_user_create $app ynh_system_user_create $app
#================================================= #=================================================
@ -132,9 +132,10 @@ done
# Set right permissions for curl install # Set right permissions for curl install
chown -R $app: $final_path chown -R $app: $final_path
# Rend la page d'install publique pour curl
# Set the app as temporarily public for curl call
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set $app unprotected_uris "/"
yunohost app ssowatconf # Régénère la configuration de SSOwat
# Regen SSOwat configuration
yunohost app ssowatconf
# Reload Nginx # Reload Nginx
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
@ -144,15 +145,17 @@ ynh_local_curl "/wp-admin/install.php?step=2" "&weblog_title=YunoBlog" "user_nam
ynh_print_info "Please wait during Wordpress installation" >&2 ynh_print_info "Please wait during Wordpress installation" >&2
for i in `seq 1 300` for i in `seq 1 300`
do # La boucle attend la fin de l'installation de wordpress Ou 5 minutes.
do
# The loop waits for wordpress to be installed, or 5 minutes.
if ynh_mysql_connect_as $db_name $db_pwd $db_name <<< "show tables" | grep -q "wp_options"; then if ynh_mysql_connect_as $db_name $db_pwd $db_name <<< "show tables" | grep -q "wp_options"; then
break # Si la table wp_options est trouvée, l'installation de wordpress est terminée. Quitte la boucle.
# If the table wp_options is found, wordpress has finished its installation.
break
fi fi
sleep 1 sleep 1
done done
#================================================= #=================================================
# INSTALL WORDPRESS' PLUGINS
# INSTALL WORDPRESS PLUGINS
#================================================= #=================================================
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
@ -177,13 +180,13 @@ $wpcli_alias core language activate $language
if [ $multisite -eq 1 ] if [ $multisite -eq 1 ]
then then
ynh_replace_string "#--MULTISITE--" "" /etc/nginx/conf.d/$domain.d/$app.conf ynh_replace_string "#--MULTISITE--" "" /etc/nginx/conf.d/$domain.d/$app.conf
# Autorise le multisite wordpress
# Allow multisite
ynh_replace_string "//--MULTISITE1--define" "define " $final_path/wp-config.php ynh_replace_string "//--MULTISITE1--define" "define " $final_path/wp-config.php
# Active le multisite via wp-cli.
# Activate multisite via wp-cli
ynh_exec_fully_quiet $wpcli_alias core multisite-convert --base=$path_url/ ynh_exec_fully_quiet $wpcli_alias core multisite-convert --base=$path_url/
# Active le multisite wordpress
# Activate multisite in wordpress config
ynh_replace_string "//--MULTISITE2--define" "define" $final_path/wp-config.php ynh_replace_string "//--MULTISITE2--define" "define" $final_path/wp-config.php
ynh_mysql_connect_as $db_name $db_pwd $db_name < ../conf/sql/multisite.sql ynh_mysql_connect_as $db_name $db_pwd $db_name < ../conf/sql/multisite.sql
@ -194,7 +197,7 @@ else
fi fi
#================================================= #=================================================
# ACTIVATE WORDPRESS' PLUGINS
# ACTIVATE WORDPRESS PLUGINS
#================================================= #=================================================
$wpcli_alias plugin activate simple-ldap-login $plugin_network $wpcli_alias plugin activate simple-ldap-login $plugin_network
@ -203,7 +206,7 @@ $wpcli_alias plugin activate companion-auto-update $plugin_network
$wpcli_alias plugin activate wp-fail2ban $plugin_network $wpcli_alias plugin activate wp-fail2ban $plugin_network
#================================================= #=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE
# STORE THE CONFIG FILE CHECKSUM
#================================================= #=================================================
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
@ -215,15 +218,17 @@ ynh_store_file_checksum "$final_path/wp-config.php"
# SECURING FILES AND DIRECTORIES # SECURING FILES AND DIRECTORIES
#================================================= #=================================================
# Les fichiers appartiennent à l'user wordpress, pour permettre les mises à jour.
# Set permissions to app files
# Files have to be own by the user of wordpress. To allow upgrade from the app.
chown -R $app: $final_path chown -R $app: $final_path
# Sauf le fichier de config wp-config.php qui appartient à root
# Except the file config wp-config.php
chown root: $final_path/wp-config.php chown root: $final_path/wp-config.php
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN
#================================================= #=================================================
# Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5
#================================================= #=================================================
@ -232,7 +237,7 @@ ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authenticatio
if [ $is_public -eq 0 ]; if [ $is_public -eq 0 ];
then then
# Retire l'accès public
# Remove the public access
ynh_app_setting_delete $app unprotected_uris ynh_app_setting_delete $app unprotected_uris
fi fi

11
scripts/remove

@ -28,28 +28,28 @@ db_name=$(ynh_app_setting_get $app db_name)
ynh_remove_app_dependencies ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE THE SQL BDD
# REMOVE THE MYSQL DATABASE
#================================================= #=================================================
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name ynh_mysql_remove_db $db_name $db_name
#================================================= #=================================================
# REMOVE THE MAIN DIR OF THE APP
# REMOVE APP MAIN DIR
#================================================= #=================================================
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "/var/www/$app" ynh_secure_remove "/var/www/$app"
#================================================= #=================================================
# REMOVE THE NGINX CONFIGURATION
# REMOVE NGINX CONFIGURATION
#================================================= #=================================================
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE THE PHP-FPM CONFIGURATION
# REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
@ -59,6 +59,7 @@ ynh_remove_fpm_config
# REMOVE FAIL2BAN CONFIGURATION # REMOVE FAIL2BAN CONFIGURATION
#================================================= #=================================================
# Remove the dedicated fail2ban config
ynh_remove_fail2ban_config ynh_remove_fail2ban_config
#================================================= #=================================================
@ -67,5 +68,5 @@ ynh_remove_fail2ban_config
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
# Delete a system user
# Delete dedicated system user
ynh_system_user_delete $app ynh_system_user_delete $app

22
scripts/restore

@ -45,21 +45,21 @@ test ! -d $final_path \
ynh_maintenance_mode_ON ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD RESTORE STEPS
# STANDARD RESTORATION STEPS
#================================================= #=================================================
# RESTORE OF THE NGINX CONFIGURATION
# RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE OF THE MAIN DIR OF THE APP
# RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_restore_file "$final_path" ynh_restore_file "$final_path"
#================================================= #=================================================
# RESTORE OF THE SQL BDD
# RESTORE THE MYSQL DATABASE
#================================================= #=================================================
db_pwd=$(ynh_app_setting_get $app mysqlpwd) db_pwd=$(ynh_app_setting_get $app mysqlpwd)
@ -67,28 +67,30 @@ ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#================================================= #=================================================
# RECREATE OF THE DEDICATED USER
# RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_system_user_create $app # Recreate the dedicated user, if not exist
# Create the dedicated user (if not existing)
ynh_system_user_create $app
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
# Les fichiers appartiennent à l'user wordpress, pour permettre les mises à jour.
# Set permissions to app files
# Files have to be own by the user of wordpress. To allow upgrade from the app.
chown -R $app: $final_path chown -R $app: $final_path
# Sauf le fichier de config wp-config.php qui appartient à root
# Except the file config wp-config.php
chown root: $final_path/wp-config.php chown root: $final_path/wp-config.php
#================================================= #=================================================
# RESTORE OF THE PHP-FPM CONFIGURATION
# RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
#================================================= #=================================================
# RESTORE FAIL2BAN CONFIGURATION
# RESTORE THE FAIL2BAN CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"

37
scripts/upgrade

@ -51,28 +51,32 @@ if [ -z "$language" ]; then
ynh_app_setting_set $app language $language ynh_app_setting_set $app language $language
fi fi
# Fix is_public as a boolean
if [ "${is_public,,}" = "yes" ]; then if [ "${is_public,,}" = "yes" ]; then
ynh_app_setting_set $app is_public 1 # Fixe is_public en booléen
ynh_app_setting_set $app is_public 1
is_public=1 is_public=1
elif [ "${is_public,,}" = "no" ]; then elif [ "${is_public,,}" = "no" ]; then
ynh_app_setting_set $app is_public 0 ynh_app_setting_set $app is_public 0
is_public=0 is_public=0
fi fi
# Fix multisite as a boolean
if [ "${multisite,,}" = "yes" ]; then if [ "${multisite,,}" = "yes" ]; then
ynh_app_setting_set $app multisite 1 # Fixe multisite en booléen
ynh_app_setting_set $app multisite 1
multisite=1 multisite=1
elif [ "${multisite,,}" = "no" ]; then elif [ "${multisite,,}" = "no" ]; then
ynh_app_setting_set $app multisite 0 ynh_app_setting_set $app multisite 0
multisite=0 multisite=0
fi fi
if [ -z $db_name ]; then # Si db_name n'est pas renseigné dans app setting
# If db_name doesn't exist, create it
if [ -z $db_name ]; then
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name ynh_app_setting_set $app db_name $db_name
fi fi
if grep add_filter.*auto_update $final_path/wp-config.php; then # Si des add_filter demeurent dans le wp-config
# If some 'add_filter' are still in wp_config, remove them
if grep add_filter.*auto_update $final_path/wp-config.php; then
sed --in-place '/add_filter.*auto_update/d' $final_path/wp-config.php sed --in-place '/add_filter.*auto_update/d' $final_path/wp-config.php
fi fi
@ -121,7 +125,7 @@ ynh_add_nginx_config
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
# Create the dedicated user, if not exist
# Create a dedicated user (if not existing)
ynh_system_user_create $app ynh_system_user_create $app
#================================================= #=================================================
@ -134,10 +138,10 @@ ynh_add_fpm_config
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
# SAVE THE CONFIG FILE IF IT BEEN MODIFIED
# SAVE THE CONFIG FILE IF IT HAS BEEN MODIFIED
#================================================= #=================================================
# Verify the checksum and backup the file if it's different
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different "$final_path/wp-config.php" ynh_backup_if_checksum_is_different "$final_path/wp-config.php"
#================================================= #=================================================
@ -161,7 +165,7 @@ fi
ynh_app_setting_set $app multisite $multisite ynh_app_setting_set $app multisite $multisite
#================================================= #=================================================
# UPDATE WORDPRESS' PLUGINS
# UPDATE WORDPRESS PLUGINS
#================================================= #=================================================
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
@ -183,7 +187,7 @@ $wpcli_alias plugin is-installed http-authentication && $wpcli_alias plugin deac
# STORE THE CHECKSUM OF THE CONFIG FILE # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================
# Recalculate and store the config file checksum into the app settings
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$final_path/wp-config.php" ynh_store_file_checksum "$final_path/wp-config.php"
#================================================= #=================================================
@ -192,25 +196,30 @@ ynh_store_file_checksum "$final_path/wp-config.php"
# SECURING FILES AND DIRECTORIES # SECURING FILES AND DIRECTORIES
#================================================= #=================================================
# Les fichiers appartiennent à l'user wordpress, pour permettre les mises à jour.
# Set permissions to app files
# Files have to be own by the user of wordpress. To allow upgrade from the app.
chown -R $app: $final_path chown -R $app: $final_path
# Sauf le fichier de config wp-config.php qui appartient à root
# Except the file config wp-config.php
chown root: $final_path/wp-config.php chown root: $final_path/wp-config.php
#================================================= #=================================================
# UPGRADE FAIL2BAN # UPGRADE FAIL2BAN
#================================================= #=================================================
# Create a dedicated fail2ban config
ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_app_setting_delete $app skipped_uris # Retire le skipped_uris si il existe encore.
if [ $is_public -eq 0 ]; then # Retire l'accès public
# Remove skipped_uris if it's still present
ynh_app_setting_delete $app skipped_uris
if [ $is_public -eq 0 ]; then
# Remove the public access
ynh_app_setting_delete $app unprotected_uris ynh_app_setting_delete $app unprotected_uris
else # Ou remplace le skipped_uris par unprotected_uris le cas échéant.
else
# Or replace skipped_uris by unprotected_uris
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set $app unprotected_uris "/"
fi fi

Loading…
Cancel
Save