1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wordpress_ynh.git synced 2024-09-03 20:36:10 +02:00

add documentation

This commit is contained in:
Gofannon 2023-03-15 20:26:02 +01:00
parent 64f3f05d96
commit 01de870304

View file

@ -183,6 +183,9 @@ done
#=================================================
ynh_script_progression --message="Installing WordPress plugins..." --weight=20
# documentation for tool "wp-cli"
# install: https://make.wordpress.org/cli/handbook/guides/installing/
# use: https://developer.wordpress.org/cli/commands/option/
ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=$final_path/wp-cli.phar
wpcli_alias="php$phpversion $final_path/wp-cli.phar --allow-root --path=$final_path"
@ -243,28 +246,18 @@ $wpcli_alias plugin activate authldap $plugin_network
# configure the plugin from a json config file
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file=../conf/plugin_authldap_single.json
$wpcli_alias option update authLDAPOptions --format=json < ../conf/plugin_authldap_single.json
# Set "default user role" as 'subscriber' if no LDAP group found. (Same settings as previous "permission managment" system)
# Setting not included in the "upgrade script" if the setting has been manually changed by an admin in the app. So it is not overwritten by a package upgrade
# TODO: could be asked while installing the package the default setting
$wpcli_alias option patch insert authLDAPOptions DefaultRole "subscriber"
# To display the list of all the possibles options for this plugin, from your server, enter:
# $ php8.0 ./wp-cli.phar --path=/var/www/wordpress --allow-root option get authLDAPOptions --json | jq
# ^ you might need to download it from the projet
#$wpcli_alias option pluck authLDAPOptions DefaultRole --format=json | jq --raw-output
#is_empty=$($wpcli_alias option pluck authLDAPOptions DefaultRole --format=json | jq --raw-output)
#if [[ -z "$is_empty" ]]; then
# # $var is empty, do what you want
# $wpcli_alias option patch insert authLDAPOptions DefaultRole "subscriber"
#else
# $wpcli_alias option patch update authLDAPOptions DefaultRole "subscriber"
#fi
# Set "default user role" as 'subscriber' if no permision (aka LDAP group) found for the user. (Same settings as previous "permission managment" system. So it should no break stuff...)
#
# This setting is not included in the "plugin_authldap_single.json script" so the json file can be used for "install" and "upgrade"
# - Install => Set "default user role" choosen by the packager
# - Upgrade => Do not modify the default setting as the Wordpress administrator could have changed the defaut role for its use case.
# TODO: could be asked to the admin while installing the app and set it up here somehow?
$wpcli_alias option patch insert authLDAPOptions DefaultRole "subscriber"
# Do not activate http-authentication, this plugin is sometimes unstable
$wpcli_alias plugin activate companion-auto-update $plugin_network
@ -326,7 +319,6 @@ fi
# - "main" can login and do almost nothing
# See https://wordpress.org/documentation/article/roles-and-capabilities/
ynh_permission_create --permission="admin" --url="/wp-login.php" --additional_urls="/wp-admin.php" --allowed=$admin_wordpress --show_tile=true
#ynh_permission_create --permission="admin" --url="/wp-login.php" --additional_urls="/wp-admin.php" --allowed=$admin_wordpress --label="$app - admin" --show_tile=true
# Add "label" for user panel
#ynh_permission_update --permission="main" --label="$app - subscriber"