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

Add multiple blogs management

This commit is contained in:
tituspijean 2023-10-11 23:40:25 +02:00
parent 46ac93e0ac
commit 69beb13e96
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720
4 changed files with 24 additions and 3 deletions

View file

@ -103,3 +103,16 @@ help = "These permissions apply to the first connection of the user, the super u
yes = "true"
no = "false"
bind = "'blogroll':__INSTALL_DIR__/inc/class.auth.ldap.php"
[blogs]
name = "Multiple blogs management"
help = "Here you can instruct YunoHost to handle multiple blogs. It will create the appropriate permissions and NGINX configuration files. You still need to add them in Dotclear's administration panel. Removing them here will not delete them from Dotclear, and vice-versa."
[blogs.blogs_list]
name = "List of blogs to handle"
[blogs.blogs_list.blogs_list]
ask = "List blogs with the format `id@domain.example/path`"
type = "tags"
pattern.regexp = "[\\w]+@[\\w.]+\\/[\\w]*"
pattern.error = "Incorrect format. Use `id@domain.example/path`"

View file

@ -49,7 +49,7 @@ set__blogs_list() {
# https://stackoverflow.com/questions/2312762/compare-difference-of-two-arrays-in-bash
# Get added and removed blogs
added_ids_array=(`echo ${!domain_array[@]} ${!old_domain_array[@]} | tr ' ' '\n' | sort | uniq -u `)
removed_ids_array=(`echo ${!old_domain_array[@]} $!domain_array[@]} | tr ' ' '\n' | sort | uniq -D | uniq `)
removed_ids_array=(`echo ${!old_domain_array[@]} ${!domain_array[@]} | tr ' ' '\n' | sort | uniq -D | uniq `)
for id in $removed_ids_array; do
if [ ynh_permission_exists --permission="$id" ]; then
@ -72,10 +72,10 @@ set__blogs_list() {
if [ ynh_permission_exists --permission="$id" ]; then
ynh_permission_url --permission="$id" --url="$domain_array[$id]$path_array[$id]"
ynh_permission_url --permission="$id.admin" --url="$domain_array[$id]$path_array[$id]/admin"
ynh_permission_url --permission="${id}-admin" --url="$domain_array[$id]$path_array[$id]/admin"
else
ynh_permission_create --permission="$id" --url="$domain_array[$id]$path_array[$id]"
ynh_permission_create --permission="$id.admin" --url="$domain_array[$id]$path_array[$id]/admin"
ynh_permission_create --permission="${id}-admin" --url="$domain_array[$id]$path_array[$id]/admin"
fi
done

View file

@ -131,6 +131,9 @@ installUrl="/admin/install/index.php"
ynh_local_curl $installUrl "u_email=$email" "u_firstname=$firstname" "u_name=$lastname" "u_login=$admin" "u_pwd=$password" "u_pwd2=$password"
# Initializing blogs_list (excluding default)
ynh_app_setting_set --app=$app --key=blogs_list --value=""
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -55,6 +55,11 @@ if [ -z "$blog_admin" ] ||
ynh_app_setting_set --app=$app --key=blog_blogroll --value=$blog_blogroll
fi
if [ -z "$blogs_list" ]; then
# Initializing blogs_list (excluding default)
ynh_app_setting_set --app=$app --key=blogs_list --value=""
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================