mirror of
https://github.com/YunoHost-Apps/mediawiki_ynh.git
synced 2024-09-03 19:46:05 +02:00
Use ynh_add_config instead of manually parsing the file
This commit is contained in:
parent
4f402c5406
commit
f160bd7915
2 changed files with 22 additions and 35 deletions
|
@ -147,30 +147,23 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# REPLACE CONFIGURATION SETTINGS
|
# REPLACE CONFIGURATION SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
cp ../conf/LocalSettings.php "$final_path/LocalSettings.php"
|
|
||||||
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__WIKI_NAME__" --replace_string="$wiki_name"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__ADMIN__" --replace_string="$admin"
|
|
||||||
|
|
||||||
if [ "$path_url" = "/" ]; then
|
if [ "$path_url" = "/" ]; then
|
||||||
# MediaWiki expects a "" for the root URL which is typically assumed to be
|
# MediaWiki expects a "" for the root URL which is typically assumed to be "/"
|
||||||
# "/" by other application packages. Therefore, we assume end-users will do
|
# by other application packages. Therefore, we assume end-users will do this
|
||||||
# this as well and make sure to ensure an "" in all cases where "/" is
|
# as well and make sure to ensure an "" in all cases where "/" is specified
|
||||||
# specified
|
localsettings_path_url=""
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string=""
|
|
||||||
else
|
else
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string="$path_url"
|
localsettings_path_url="$path_url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DOMAIN__" --replace_string="$domain"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_NAME__" --replace_string="$db_name"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_USER__" --replace_string="$db_name"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_PWD__" --replace_string="$db_pwd"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LANGUAGE__" --replace_string="$language"
|
|
||||||
|
|
||||||
secret=$(ynh_string_random 64)
|
secret=$(ynh_string_random 64)
|
||||||
ynh_app_setting_set $app secret "$secret"
|
ynh_app_setting_set "$app" secret "$secret"
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__SECRET__" --replace_string="$secret"
|
|
||||||
|
path_url="$localsettings_path_url" \
|
||||||
|
ynh_add_config \
|
||||||
|
--template=../conf/LocalSettings.php \
|
||||||
|
--destination="$final_path/LocalSettings.php" \
|
||||||
|
|
||||||
"php$phpversion" "$final_path/maintenance/update.php"
|
"php$phpversion" "$final_path/maintenance/update.php"
|
||||||
|
|
||||||
|
|
|
@ -177,30 +177,24 @@ ynh_backup_if_checksum_is_different --file="$final_path/LocalSettings.php"
|
||||||
ynh_script_progression --message="Upgrading application files..." --weight=4
|
ynh_script_progression --message="Upgrading application files..." --weight=4
|
||||||
|
|
||||||
rm "$final_path/LocalSettings.php"
|
rm "$final_path/LocalSettings.php"
|
||||||
cp ../conf/LocalSettings.php "$final_path/LocalSettings.php"
|
|
||||||
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__WIKI_NAME__" --replace_string="$wiki_name"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__ADMIN__" --replace_string="$admin"
|
|
||||||
|
|
||||||
if [ "$path_url" = "/" ]; then
|
if [ "$path_url" = "/" ]; then
|
||||||
# MediaWiki expects a "" for the root URL which is typically assumed to be
|
# MediaWiki expects a "" for the root URL which is typically assumed to be "/"
|
||||||
# "/" by other application packages. Therefore, we assume end-users will do
|
# by other application packages. Therefore, we assume end-users will do this
|
||||||
# this as well and make sure to ensure an "" in all cases where "/" is
|
# as well and make sure to ensure an "" in all cases where "/" is specified
|
||||||
# specified
|
localsettings_path_url=""
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string=""
|
|
||||||
else
|
else
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__PATH__" --replace_string="$path_url"
|
localsettings_path_url="$path_url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DOMAIN__" --replace_string="$domain"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_NAME__" --replace_string="$db_name"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_USER__" --replace_string="$db_name"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__DB_PWD__" --replace_string="$db_pwd"
|
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__LANGUAGE__" --replace_string="$language"
|
|
||||||
|
|
||||||
secret=$(ynh_string_random 64)
|
secret=$(ynh_string_random 64)
|
||||||
ynh_app_setting_set $app secret "$secret"
|
ynh_app_setting_set "$app" secret "$secret"
|
||||||
ynh_replace_string --target_file="$final_path/LocalSettings.php" --match_string="__SECRET__" --replace_string="$secret"
|
|
||||||
|
path_url="$localsettings_path_url" \
|
||||||
|
ynh_add_config \
|
||||||
|
--template=../conf/LocalSettings.php \
|
||||||
|
--destination="$final_path/LocalSettings.php" \
|
||||||
|
|
||||||
# Check for admin password being too short for the new mediawiki requirements
|
# Check for admin password being too short for the new mediawiki requirements
|
||||||
password_length=$(ynh_app_setting_get --app=$app --key=admin_password | awk '{print length}')
|
password_length=$(ynh_app_setting_get --app=$app --key=admin_password | awk '{print length}')
|
||||||
|
|
Loading…
Add table
Reference in a new issue