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

[enh] Split configuration in different files

Separate dedicated Yunohost configuration in a new file that cannot be modified by user
Adapt scripts to handle new files

See https://github.com/YunoHost-Apps/dokuwiki_ynh/pull/37
This commit is contained in:
Gofannon 2018-06-27 23:12:30 +02:00
parent 5716fb1686
commit c25787db1e
4 changed files with 61 additions and 31 deletions

View file

@ -11,24 +11,3 @@
/* Basic Settings */ /* Basic Settings */
$conf['lang'] = '__YNH_LANGUAGE__'; //your language $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
/* LDAP Yunohost config */
$conf['plugin']['authldap']['server'] = 'localhost';
$conf['plugin']['authldap']['port'] = 389;
$conf['plugin']['authldap']['version'] = 3;
$conf['plugin']['authldap']['usertree'] = 'ou=users,dc=yunohost,dc=org';
$conf['plugin']['authldap']['userfilter'] = '(&(uid=%{user})(objectClass=posixAccount))';
# no groups
#$conf['plugin']['authldap']['grouptree'] = 'ou=Group, dc=server, dc=tld';
#$conf['plugin']['authldap']['groupfilter'] = '(&(objectClass=posixGroup)(|(gidNumber=%{gid})(memberUID=%{user})))';
/* Advanced Settings */
$conf['updatecheck'] = 0; //automatically check for new releases?
$conf['cssdatauri'] = 512; //Maximum byte size of small images to embed into CSS, won't work on IE<8

33
conf/local.protected.php Normal file
View file

@ -0,0 +1,33 @@
<?php
/**
* This file is used for configuration settings which cannot be modified by Dokuwiki admin panel
* See here for explanations : https://www.dokuwiki.org/config
*
* Yunohost dedicated settings are stored here in order to be able to upgrade the Yunohost package safely latter for Yunohost packager ( Yeah \o/ )
*
* You should not modify this file direclty as it will be overwritten by Yunohost package
* Use "local.php" instead. You have been warned !
*/
/* 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
/* LDAP Yunohost config */
$conf['plugin']['authldap']['server'] = 'localhost';
$conf['plugin']['authldap']['port'] = 389;
$conf['plugin']['authldap']['version'] = 3;
$conf['plugin']['authldap']['usertree'] = 'ou=users,dc=yunohost,dc=org';
$conf['plugin']['authldap']['userfilter'] = '(&(uid=%{user})(objectClass=posixAccount))';
# no groups
#$conf['plugin']['authldap']['grouptree'] = 'ou=Group, dc=server, dc=tld';
#$conf['plugin']['authldap']['groupfilter'] = '(&(objectClass=posixGroup)(|(gidNumber=%{gid})(memberUID=%{user})))';
/* Advanced Settings */
$conf['updatecheck'] = 0; //automatically check for new releases?
// Taken from previous package. Don't know what it does. Maybe Yunohost corner logo ?
$conf['cssdatauri'] = 512; //Maximum byte size of small images to embed into CSS, won't work on IE<8

View file

@ -100,14 +100,22 @@ 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" # Set the "language"
ynh_replace_string "__YNH_LANGUAGE__" "$language" "../conf/local.php" ynh_replace_string "__YNH_LANGUAGE__" "$language" "../conf/local.php"
# Set the "admin" user
ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.php"
# Copy Yunohost specific configuration # Copy Yunohost specific configuration
cp ../conf/local.protected.php $final_path/conf
# 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
cp ../conf/local.php $final_path/conf cp ../conf/local.php $final_path/conf
# 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
# Restrict user rights by enforcing "read-only" mode for all users # Restrict user rights by enforcing "read-only" mode for all users

View file

@ -113,16 +113,26 @@ if [ -d "${final_path}/data/media" ]; then
chown -R $app:root $final_path/{data/attic,data/cache,data/index,data/locks,data/media*,data/meta,data/pages,data/tmp} chown -R $app:root $final_path/{data/attic,data/cache,data/index,data/locks,data/media*,data/meta,data/pages,data/tmp}
fi fi
# Set the "language" of Dokuwiki # Set the "admin" user
# Might overwrite user choice if language has been change directly in Dokuwiki admin panel ynh_replace_string "__YNH_ADMIN_USER__" "$admin" "../conf/local.protected.php"
# 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"
# Copy Yunohost specific configuration # Copy Yunohost specific configuration
cp ../conf/local.protected.php $final_path/conf
# 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
# Do not overwrite existing dokuwiki configuration as it could have user customization's and settings.
# Create file if it does not exist
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
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.
# Create file if it does not exist # Create file if it does not exist