[ref] Rename mysql_db argument to with_mysql for comprehension
This commit is contained in:
parent
1245610751
commit
52869bcf5a
6 changed files with 12 additions and 12 deletions
|
@ -59,7 +59,7 @@
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mysql_db",
|
"name": "with_mysql",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Do you need a MySQL database?",
|
"en": "Do you need a MySQL database?",
|
||||||
|
|
|
@ -12,7 +12,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
mysql_db=$(ynh_app_setting_get "$app" mysql_db)
|
with_mysql=$(ynh_app_setting_get "$app" with_mysql)
|
||||||
|
|
||||||
# Copy the app files
|
# Copy the app files
|
||||||
DESTDIR="/var/www/${app}"
|
DESTDIR="/var/www/${app}"
|
||||||
|
@ -23,7 +23,7 @@ ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "conf/nginx.conf"
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf"
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "conf/php-fpm.conf"
|
||||||
|
|
||||||
# Dump the database
|
# Dump the database
|
||||||
if [[ $mysql_db -eq 1 ]]; then
|
if [[ $with_mysql -eq 1 ]]; then
|
||||||
dbname=$app
|
dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
|
|
@ -12,7 +12,7 @@ domain=$1
|
||||||
path=${2%/}
|
path=${2%/}
|
||||||
password=$3
|
password=$3
|
||||||
is_public=$4
|
is_public=$4
|
||||||
mysql_db=$5
|
with_mysql=$5
|
||||||
|
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
. /usr/share/yunohost/helpers
|
. /usr/share/yunohost/helpers
|
||||||
|
@ -50,7 +50,7 @@ sed -i "s@{DOMAIN}@${domain}@g" ../sources/www/index.html
|
||||||
sed -i "s@{USER}@${user}@g" ../sources/www/index.html
|
sed -i "s@{USER}@${user}@g" ../sources/www/index.html
|
||||||
|
|
||||||
# Initialize database as needed
|
# Initialize database as needed
|
||||||
if [[ $mysql_db -eq 1 ]]; then
|
if [[ $with_mysql -eq 1 ]]; then
|
||||||
dbname=$app
|
dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
dbpass=$(ynh_string_random)
|
dbpass=$(ynh_string_random)
|
||||||
|
@ -72,7 +72,7 @@ sudo chown root: "$DESTDIR"
|
||||||
|
|
||||||
# Save app settings
|
# Save app settings
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
ynh_app_setting_set "$app" mysql_db "$mysql_db"
|
ynh_app_setting_set "$app" with_mysql "$with_mysql"
|
||||||
ynh_app_setting_set "$app" password "$password"
|
ynh_app_setting_set "$app" password "$password"
|
||||||
ynh_app_setting_set "$app" user "$user"
|
ynh_app_setting_set "$app" user "$user"
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ app_nb=$YNH_APP_INSTANCE_NUMBER
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
mysql_db=$(ynh_app_setting_get "$app" mysql_db)
|
with_mysql=$(ynh_app_setting_get "$app" with_mysql)
|
||||||
|
|
||||||
# Drop MySQL database and user as needed
|
# Drop MySQL database and user as needed
|
||||||
if [[ $mysql_db -eq 1 ]]; then
|
if [[ $with_mysql -eq 1 ]]; then
|
||||||
dbname=$app
|
dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
|
|
@ -11,7 +11,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
# Retrieve old app settings
|
# Retrieve old app settings
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
mysql_db=$(ynh_app_setting_get "$app" mysql_db)
|
with_mysql=$(ynh_app_setting_get "$app" with_mysql)
|
||||||
password=$(ynh_app_setting_get "$app" password)
|
password=$(ynh_app_setting_get "$app" password)
|
||||||
user=$(ynh_app_setting_get "$app" user)
|
user=$(ynh_app_setting_get "$app" user)
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ sudo chown -hR "${user}:" "$DESTDIR"
|
||||||
sudo chown root: "$DESTDIR"
|
sudo chown root: "$DESTDIR"
|
||||||
|
|
||||||
# Create and restore the database as needed
|
# Create and restore the database as needed
|
||||||
if [[ $mysql_db -eq 1 ]]; then
|
if [[ $with_mysql -eq 1 ]]; then
|
||||||
dbname=$app
|
dbname=$app
|
||||||
dbuser=$app
|
dbuser=$app
|
||||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
|
|
@ -13,11 +13,11 @@ domain=$(ynh_app_setting_get "$app" domain)
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
path=${path%/}
|
path=${path%/}
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||||
mysql_db=$(ynh_app_setting_get "$app" mysql_db)
|
with_mysql=$(ynh_app_setting_get "$app" with_mysql)
|
||||||
password=$(ynh_app_setting_get "$app" password)
|
password=$(ynh_app_setting_get "$app" password)
|
||||||
user=$(ynh_app_setting_get "$app" user)
|
user=$(ynh_app_setting_get "$app" user)
|
||||||
|
|
||||||
([[ -n "$mysql_db" ]] && [[ -n "$password" ]] && [[ -n "$user" ]]) \
|
([[ -n "$with_mysql" ]] && [[ -n "$password" ]] && [[ -n "$user" ]]) \
|
||||||
|| ynh_die "The app changed and can not be automatically upgraded. \
|
|| ynh_die "The app changed and can not be automatically upgraded. \
|
||||||
You will have to manually upgrade it following those instructions: \
|
You will have to manually upgrade it following those instructions: \
|
||||||
https://github.com/YunoHost-Apps/my_webapp_ynh#upgrade"
|
https://github.com/YunoHost-Apps/my_webapp_ynh#upgrade"
|
||||||
|
|
Loading…
Add table
Reference in a new issue