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:
parent
46ac93e0ac
commit
69beb13e96
4 changed files with 24 additions and 3 deletions
|
@ -103,3 +103,16 @@ help = "These permissions apply to the first connection of the user, the super u
|
||||||
yes = "true"
|
yes = "true"
|
||||||
no = "false"
|
no = "false"
|
||||||
bind = "'blogroll':__INSTALL_DIR__/inc/class.auth.ldap.php"
|
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`"
|
||||||
|
|
|
@ -49,7 +49,7 @@ set__blogs_list() {
|
||||||
# https://stackoverflow.com/questions/2312762/compare-difference-of-two-arrays-in-bash
|
# https://stackoverflow.com/questions/2312762/compare-difference-of-two-arrays-in-bash
|
||||||
# Get added and removed blogs
|
# Get added and removed blogs
|
||||||
added_ids_array=(`echo ${!domain_array[@]} ${!old_domain_array[@]} | tr ' ' '\n' | sort | uniq -u `)
|
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
|
for id in $removed_ids_array; do
|
||||||
if [ ynh_permission_exists --permission="$id" ]; then
|
if [ ynh_permission_exists --permission="$id" ]; then
|
||||||
|
@ -72,10 +72,10 @@ set__blogs_list() {
|
||||||
|
|
||||||
if [ ynh_permission_exists --permission="$id" ]; then
|
if [ ynh_permission_exists --permission="$id" ]; then
|
||||||
ynh_permission_url --permission="$id" --url="$domain_array[$id]$path_array[$id]"
|
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
|
else
|
||||||
ynh_permission_create --permission="$id" --url="$domain_array[$id]$path_array[$id]"
|
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
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
|
@ -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"
|
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
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -55,6 +55,11 @@ if [ -z "$blog_admin" ] ||
|
||||||
ynh_app_setting_set --app=$app --key=blog_blogroll --value=$blog_blogroll
|
ynh_app_setting_set --app=$app --key=blog_blogroll --value=$blog_blogroll
|
||||||
fi
|
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
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue