1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00

Add ynh_add_config (#98)

* Add ynh_add_config
This commit is contained in:
Éric Gaspar 2021-04-18 10:38:58 +02:00 committed by GitHub
parent c0894146b5
commit 72ac45c104
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 22 deletions

View file

@ -97,15 +97,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Configuring ttrss..." --weight=1 ynh_script_progression --message="Configuring ttrss..." --weight=1
cp ../conf/config.php "$final_path/config.php" domain_path=https://$domain$path_url
ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php"
# Change variables in ttrss configuration
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DOMAIN_PATH__" --replace_string="https://$domain$path_url" --target_file="$final_path/config.php"
# Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/config.php"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -130,7 +123,7 @@ ynh_script_progression --message="Initializing database..." --weight=6
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" \
< "$final_path/schema/ttrss_schema_mysql.sql" < "$final_path/schema/ttrss_schema_mysql.sql"
ynh_exec_as $app php"${phpversion}" ${final_path}/update.php --update-schema ynh_exec_as $app php${phpversion} ${final_path}/update.php --update-schema
#================================================= #=================================================
# START TTRSS IN BACKGROUND # START TTRSS IN BACKGROUND

View file

@ -127,18 +127,8 @@ then
mv "$tmpdir" "$final_path" mv "$tmpdir" "$final_path"
ynh_secure_remove --file="$tmpdir" ynh_secure_remove --file="$tmpdir"
# Verify the checksum and backup the file if it's different domain_path=https://$domain$path_url
ynh_backup_if_checksum_is_different --file="$final_path/config.php" ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php"
cp ../conf/config.php "$final_path/config.php"
# Change variables in ttrss configuration
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.php"
ynh_replace_string --match_string="__DOMAIN_PATH__" --replace_string="https://$domain$path_url" --target_file="$final_path/config.php"
# Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/config.php"
#================================================= #=================================================
# UPGRADE DATABASE # UPGRADE DATABASE