mirror of
https://github.com/YunoHost-Apps/prestashop_ynh.git
synced 2024-09-03 20:06:39 +02:00
Netoyyagde .fonctions pour passer Linter
This commit is contained in:
parent
3e70209b47
commit
78a2ad0954
1 changed files with 0 additions and 87 deletions
|
@ -209,19 +209,6 @@ CHECK_MD5_CONFIG () { # Créé un backup du fichier de config si il a été modi
|
||||||
# Ainsi, les officiels prendront le pas sur ceux-ci le cas échéant
|
# Ainsi, les officiels prendront le pas sur ceux-ci le cas échéant
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Ignore the yunohost-cli log to prevent errors with conditionals commands
|
|
||||||
# usage: ynh_no_log COMMAND
|
|
||||||
# Simply duplicate the log, execute the yunohost command and replace the log without the result of this command
|
|
||||||
# It's a very badly hack...
|
|
||||||
ynh_no_log() {
|
|
||||||
ynh_cli_log=/var/log/yunohost/yunohost-cli.log
|
|
||||||
sudo cp -a ${ynh_cli_log} ${ynh_cli_log}-move
|
|
||||||
eval $@
|
|
||||||
exit_code=$?
|
|
||||||
sudo mv ${ynh_cli_log}-move ${ynh_cli_log}
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
# Normalize the url path syntax
|
# Normalize the url path syntax
|
||||||
# Handle the slash at the beginning of path and its absence at ending
|
# Handle the slash at the beginning of path and its absence at ending
|
||||||
# Return a normalized url path
|
# Return a normalized url path
|
||||||
|
@ -245,36 +232,6 @@ ynh_normalize_url_path () {
|
||||||
echo $path
|
echo $path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a database, an user and its password. Then store the password in the app's config
|
|
||||||
#
|
|
||||||
# User of database will be store in db_user's variable.
|
|
||||||
# Name of database will be store in db_name's variable.
|
|
||||||
# And password in db_pwd's variable.
|
|
||||||
#
|
|
||||||
# usage: ynh_mysql_generate_db user name
|
|
||||||
# | arg: user - Owner of the database
|
|
||||||
# | arg: name - Name of the database
|
|
||||||
ynh_mysql_generate_db () {
|
|
||||||
db_pwd=$(ynh_string_random) # Generate a random password
|
|
||||||
ynh_mysql_create_db "$2" "$1" "$db_pwd" # Create the database
|
|
||||||
ynh_app_setting_set $app mysqlpwd $db_pwd # Store the password in the app's config
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove a database if it exist and the associated user
|
|
||||||
#
|
|
||||||
# usage: ynh_mysql_remove_db user name
|
|
||||||
# | arg: user - Proprietary of the database
|
|
||||||
# | arg: name - Name of the database
|
|
||||||
ynh_mysql_remove_db () {
|
|
||||||
if mysqlshow -u root -p$(sudo cat $MYSQL_ROOT_PWD_FILE) | grep -q "^| $2"; then # Check if the database exist
|
|
||||||
echo "Remove database $2" >&2
|
|
||||||
ynh_mysql_drop_db $2 # Remove the database
|
|
||||||
ynh_mysql_drop_user $1 # Remove the associated user to database
|
|
||||||
else
|
|
||||||
echo "Database $2 not found" >&2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Correct the name given in argument for mariadb
|
# Correct the name given in argument for mariadb
|
||||||
#
|
#
|
||||||
# Avoid invalid name for your database
|
# Avoid invalid name for your database
|
||||||
|
@ -289,50 +246,6 @@ ynh_make_valid_dbid () {
|
||||||
echo $dbid
|
echo $dbid
|
||||||
}
|
}
|
||||||
|
|
||||||
# Manage a fail of the script
|
|
||||||
#
|
|
||||||
# Print a warning to inform that the script was failed
|
|
||||||
# Execute the ynh_clean_setup function if used in the app script
|
|
||||||
#
|
|
||||||
# usage of ynh_clean_setup function
|
|
||||||
# This function provide a way to clean some residual of installation that not managed by remove script.
|
|
||||||
# To use it, simply add in your script:
|
|
||||||
# ynh_clean_setup () {
|
|
||||||
# instructions...
|
|
||||||
# }
|
|
||||||
# This function is optionnal.
|
|
||||||
#
|
|
||||||
# Usage: ynh_exit_properly is used only by the helper ynh_check_error.
|
|
||||||
# You must not use it directly.
|
|
||||||
ynh_exit_properly () {
|
|
||||||
exit_code=$?
|
|
||||||
if [ "$exit_code" -eq 0 ]; then
|
|
||||||
exit 0 # Exit without error if the script ended correctly
|
|
||||||
fi
|
|
||||||
|
|
||||||
trap '' EXIT # Ignore new exit signals
|
|
||||||
set +eu # Do not exit anymore if a command fail or if a variable is empty
|
|
||||||
|
|
||||||
echo -e "!!\n $app's script has encountered an error. Its execution was cancelled.\n!!" >&2
|
|
||||||
|
|
||||||
if type -t ynh_clean_setup > /dev/null; then # Check if the function exist in the app script.
|
|
||||||
ynh_clean_setup # Call the function to do specific cleaning for the app.
|
|
||||||
fi
|
|
||||||
|
|
||||||
ynh_die # Exit with error status
|
|
||||||
}
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script.
|
|
||||||
#
|
|
||||||
# Stop immediatly the execution if an error occured or if a empty variable is used.
|
|
||||||
# The execution of the script is derivate to ynh_exit_properly function before exit.
|
|
||||||
#
|
|
||||||
# Usage: ynh_check_error
|
|
||||||
ynh_check_error () {
|
|
||||||
set -eu # Exit if a command fail, and if a variable is used unset.
|
|
||||||
trap ynh_exit_properly EXIT # Capturing exit signals on shell script
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install dependencies with a equivs control file
|
# Install dependencies with a equivs control file
|
||||||
#
|
#
|
||||||
# usage: ynh_app_dependencies dep [dep [...]]
|
# usage: ynh_app_dependencies dep [dep [...]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue