mirror of
https://github.com/YunoHost-Apps/dokuwiki_ynh.git
synced 2024-09-03 18:26:20 +02:00
[enh] Add language choice + cleaning variables
This commit is contained in:
parent
299a3d8cf3
commit
3c587b3ac1
4 changed files with 43 additions and 18 deletions
|
@ -9,12 +9,15 @@
|
|||
*/
|
||||
|
||||
|
||||
/* Basic Settings */
|
||||
$conf['lang'] = '__YNH_LANGUAGE__'; //your language
|
||||
|
||||
/* Authentication Settings */
|
||||
$conf['useacl'] = 1; //Use Access Control Lists to restrict access?
|
||||
$conf['authtype'] = 'authldap'; //which authentication backend should be used
|
||||
$conf['passcrypt'] = 'sha1'; //Used crypt method (smd5,md5,sha1,ssha,crypt,mysql,my411)
|
||||
$conf['superuser'] = 'YNH_ADMIN_USER'; //The admin can be user or @group or comma separated list user1,@group1,user2
|
||||
$conf['manager'] = 'YNH_ADMIN_USER'; //The manager can be user or @group or comma separated list user1,@group1,user2
|
||||
$conf['superuser'] = '__YNH_ADMIN_USER__'; //The admin can be user or @group or comma separated list user1,@group1,user2
|
||||
$conf['manager'] = '__YNH_ADMIN_USER__'; //The manager can be user or @group or comma separated list user1,@group1,user2
|
||||
|
||||
/* LDAP Yunohost config */
|
||||
$conf['plugin']['authldap']['server'] = 'localhost';
|
||||
|
|
|
@ -62,6 +62,15 @@
|
|||
"fr": "Est-ce un site public ?"
|
||||
},
|
||||
"default": "true"
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": ["en", "fr"],
|
||||
"default": "en"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
|||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
#language=$YNH_APP_ARG_LANGUAGE
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
|
||||
# This is a multi-instance app, meaning it can be installed several times independently
|
||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||
|
@ -61,7 +61,7 @@ ynh_app_setting_set $app domain $domain
|
|||
ynh_app_setting_set $app path $path_url
|
||||
ynh_app_setting_set $app admin $admin
|
||||
ynh_app_setting_set $app is_public $is_public
|
||||
#ynh_app_setting_set $app language $language
|
||||
ynh_app_setting_set $app language $language
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -97,26 +97,19 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ...
|
||||
# CUSTOMIZE DOKUWIKI
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
# Set the "language"
|
||||
ynh_replace_string "__YNH_LANGUAGE__" "$language" "../conf/local.php"
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
# Set the "admin" user of Dokuwiki
|
||||
ynh_replace_string "YNH_ADMIN_USER" "$admin" "../conf/local.php"
|
||||
# Set the "admin" user
|
||||
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.php"
|
||||
|
||||
# Copy Yunohost specific configuration
|
||||
sudo cp ../conf/local.php $final_path/conf
|
||||
|
||||
|
||||
# Restrict user rights by enforcing "read-only" mode for all users
|
||||
# See https://www.dokuwiki.org/acl#background_info
|
||||
# Default is "8"
|
||||
|
@ -128,6 +121,14 @@ sudo cp ../conf/acl.auth.php $final_path/conf
|
|||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
#ynh_store_file_checksum "$final_path/conf/local.php"
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -19,6 +19,7 @@ domain=$(ynh_app_setting_get $app domain)
|
|||
path_url=$(ynh_app_setting_get $app path)
|
||||
admin=$(ynh_app_setting_get $app admin)
|
||||
is_public=$(ynh_app_setting_get $app is_public)
|
||||
language=$(ynh_app_setting_get $app language)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
|
||||
#=================================================
|
||||
|
@ -47,6 +48,12 @@ if [ -z "$admin" ]; then
|
|||
sudo ynh_app_setting_set $app is_public -v "$is_public"
|
||||
fi
|
||||
|
||||
# language default value, if not set
|
||||
if [ -z "$language" ]; then
|
||||
language='en'
|
||||
ynh_app_setting_set $app language $language
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -106,8 +113,13 @@ if [ -d "${final_path}/data/media" ]; then
|
|||
sudo chown -R $app:root $final_path/{data/attic,data/cache,data/index,data/locks,data/media*,data/meta,data/pages,data/tmp}
|
||||
fi
|
||||
|
||||
# Set the "language" of Dokuwiki
|
||||
# Might overwrite user choice if language has been change directly in Dokuwiki admin panel
|
||||
# Should be enhance to avoid this. For now, it is easier to overwrite as there is no need to take care of existing configuration
|
||||
ynh_replace_string "__YNH_LANGUAGE__" "$language" "../conf/local.php"
|
||||
|
||||
# Set the "admin" user of Dokuwiki
|
||||
ynh_replace_string "YNH_ADMIN_USER" "$admin" "../conf/local.php"
|
||||
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.php"
|
||||
|
||||
# Copy Yunohost specific configuration
|
||||
sudo cp ../conf/local.php $final_path/conf
|
||||
|
|
Loading…
Add table
Reference in a new issue