1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dokuwiki_ynh.git synced 2024-09-03 18:26:20 +02:00

[fix] Copy configuration files then modify them

See https://github.com/YunoHost-Apps/dokuwiki_ynh/pull/37#issuecomment-398374816

"Since a few time, because the conf folder will be kept for later uses (especially in change_url), it's better to copy your file in the right place before modifying it."
This commit is contained in:
Gofannon 2018-09-08 21:03:34 +02:00
parent 257acb2b4d
commit d713894752
2 changed files with 27 additions and 28 deletions

View file

@ -100,15 +100,6 @@ ynh_add_fpm_config
# CUSTOMIZE DOKUWIKI # CUSTOMIZE DOKUWIKI
#================================================= #=================================================
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.protected.php"
# Set the "language"
ynh_replace_string "__YNH_LANGUAGE__" "$language" "../conf/local.php"
# Copy Yunohost specific configuration
# Loading order of configuration files # Loading order of configuration files
# #
# By default DokuWiki loads its configuration files in the following order: # By default DokuWiki loads its configuration files in the following order:
@ -119,13 +110,23 @@ ynh_replace_string "__YNH_LANGUAGE__" "$language" "../conf/local.php"
# #
# See https://www.dokuwiki.org/plugin:config#protecting_settings # See https://www.dokuwiki.org/plugin:config#protecting_settings
cp ../conf/local.protected.php $final_path/conf
### Copy Yunohost specific configuration
# This File cannot be modified directly by Dokuwiki, only by hand or by Yunohost # This File cannot be modified directly by Dokuwiki, only by hand or by Yunohost
# It will only be updated by Yunohost package or directly by adventurous users # It will only be updated by Yunohost package or directly by adventurous users
cp ../conf/local.protected.php $final_path/conf
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"
cp ../conf/local.php $final_path/conf
# This file might be modified by dokuwiki admin panel or by plugins # This file might be modified by dokuwiki admin panel or by plugins
# It will not be modified by Yunohost in order to keep user settings # It will not be modified by Yunohost in order to keep user settings
cp ../conf/local.php $final_path/conf
# Set the "language"
ynh_replace_string "__YNH_LANGUAGE__" "$language" "$final_path/conf/local.php"
# Restrict user rights by enforcing "read-only" mode for all users # Restrict user rights by enforcing "read-only" mode for all users
# See https://www.dokuwiki.org/acl#background_info # See https://www.dokuwiki.org/acl#background_info
@ -144,11 +145,11 @@ cp ../conf/acl.auth.php $final_path/conf
cp $final_path/conf/local.php.dist $final_path/conf/local.php.bak cp $final_path/conf/local.php.dist $final_path/conf/local.php.bak
cp $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php cp $final_path/conf/users.auth.php.dist $final_path/conf/users.auth.php
cp $final_path/inc/preload.php.dist $final_path/inc/preload.php
# This file might be used by plugins like https://www.dokuwiki.org/plugin:siteexport # This file might be used by plugins like https://www.dokuwiki.org/plugin:siteexport
# Create it to be more "user friendly" as over the top security is not the main goal here # Create it to be more "user friendly" as over the top security is not the main goal here
# This file could be use for bad behaviour. # This file could be use for bad behaviour.
# See https://www.dokuwiki.org/devel:preload?s[]=preload # See https://www.dokuwiki.org/devel:preload?s[]=preload
cp $final_path/inc/preload.php.dist $final_path/inc/preload.php
# There is no template .dist provided inside DokuWiki installation folder # There is no template .dist provided inside DokuWiki installation folder
# Create "empty" files to be able to manage linux permissions # Create "empty" files to be able to manage linux permissions
@ -158,11 +159,10 @@ cp ../conf/plugins.local.php $final_path/conf/plugins.local.php.bak
# Create file if it does not exist # Create file if it does not exist
if [ ! -f "$final_path/conf/local.protected.php" ]; then if [ ! -f "$final_path/conf/local.protected.php" ]; then
# Set the default "admin"
# Replace string in order to have a functionnal configuration file
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.protected.php"
cp ../conf/local.protected.php $final_path/conf cp ../conf/local.protected.php $final_path/conf
# Set the default "admin"
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"
fi fi
#================================================= #=================================================

View file

@ -56,6 +56,7 @@ if [ -z "$language" ]; then
fi fi
# Yunohost specific configuration, if not exists # Yunohost specific configuration, if not exists
# Previously, these settings were store a unique "dokuwiki.php" # Previously, these settings were store a unique "dokuwiki.php"
@ -75,22 +76,20 @@ fi
# Configuration dedicated to Yunohost (LDAP and admin mainly) # Configuration dedicated to Yunohost (LDAP and admin mainly)
# Create file if it does not exist # Create file if it does not exist
if [ ! -f "$final_path/conf/local.protected.php" ]; then if [ ! -f "$final_path/conf/local.protected.php" ]; then
# Set the default "admin"
# Replace string in order to have a functionnal configuration file
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.protected.php"
cp ../conf/local.protected.php $final_path/conf cp ../conf/local.protected.php $final_path/conf
# Set the default "admin"
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "$final_path/conf/local.protected.php"
fi fi
# Do not overwrite existing dokuwiki configuration as it could have user customization's and settings. # Do not overwrite existing dokuwiki configuration as it could have user customization's and settings.
# Cannot use helper "ynh_backup_if_checksum_is_different" # Cannot use helper "ynh_backup_if_checksum_is_different"
# Create file if it does not exist # Create file if it does not exist
if [ ! -f "$final_path/conf/local.php" ]; then if [ ! -f "$final_path/conf/local.php" ]; then
# Set the default "language" only when file does not exist beforehand
# Replace string in order to have a functionnal configuration file
ynh_replace_string "__YNH_LANGUAGE__" "$language" "../conf/local.php"
cp ../conf/local.php $final_path/conf cp ../conf/local.php $final_path/conf
# Set the default "language"
ynh_replace_string "__YNH_LANGUAGE__" "$language" "$final_path/conf/local.php"
fi fi
# Do not overwrite existing ACL configuration file as it could have user customization's and settings. # Do not overwrite existing ACL configuration file as it could have user customization's and settings.
@ -240,13 +239,13 @@ done
# Safe here as this file is only used by Yunohost. Dokuwiki cannot modified it. # Safe here as this file is only used by Yunohost. Dokuwiki cannot modified it.
ynh_backup_if_checksum_is_different "$final_path/conf/local.protected.php" ynh_backup_if_checksum_is_different "$final_path/conf/local.protected.php"
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.protected.php"
cp ../conf/local.protected.php $final_path/conf cp ../conf/local.protected.php $final_path/conf
# This File cannot be modified directly by Dokuwiki, only by hand or by Yunohost # This File cannot be modified directly by Dokuwiki, only by hand or by Yunohost
# It will only be updated by Yunohost package or directly by adventurous users # It will only be updated by Yunohost package or directly by adventurous users
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.protected.php"
# Recalculate and store the config file checksum into the app settings # Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/conf/local.protected.php" ynh_store_file_checksum "$final_path/conf/local.protected.php"