1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00

Let the user agree to modify php.ini or not

This commit is contained in:
polytan02 2017-02-19 13:44:33 +00:00
parent 9cd1f3a54b
commit 0fcb48a6f0
5 changed files with 40 additions and 3 deletions

View file

@ -77,6 +77,15 @@
},
"choices": ["Yes", "No"],
"default": "Yes"
},
{
"name": "run_exec",
"ask": {
"en": "Do you agree to modify php.ini to allow exec() function to be used by hubzilla ?",
"fr": "Acceptez-vous de modifier php.ini pour autoriser exec() à être utilisée par hubzilla ?"
},
"choices": ["Yes", "No"],
"default": "No"
}
]
}

View file

@ -18,6 +18,7 @@ admin=$YNH_APP_ARG_ADMIN
email=$YNH_APP_ARG_EMAIL
upload=$YNH_APP_ARG_UPLOAD
is_public=$YNH_APP_ARG_IS_PUBLIC
run_exec=$YNH_APP_ARG_RUN_EXEC
# Source app helpers
source /usr/share/yunohost/helpers
@ -104,7 +105,13 @@ sudo chown root: $nginxconf
sudo chmod 600 $nginxconf
# Modify php.ini to allow exec() function and increase the upload size limits
#sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini
if [ "$run_exec" = "Yes" ];
then
sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini
else
echo "no modification of php.ini"
fi
# Dedicated php-fpm
sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/php-fpm.conf
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
phpfpmconf=/etc/php5/fpm/pool.d/$app.conf

View file

@ -10,6 +10,7 @@ source /usr/share/yunohost/helpers
domain=$(ynh_app_setting_get $app domain)
db_user=$(ynh_app_setting_get $app db_user)
run_exec=$(ynh_app_setting_get $app run_exec)
REMOVE_BDD $db_user # Suppression de la base de donnée et de l'utilisateur associé.
@ -23,7 +24,12 @@ REMOVE_FPM_CONF # Suppression de la configuration du pool php-fpm
sudo rm -f /etc/cron.d/poller-cron
# Restore php.ini as it was before installing hubzilla
#sudo sed -i 's/,,/pcntl_exec/g' /etc/php5/fpm/php.ini
if [ "$run_exec" = "Yes" ];
then
sudo sed -i 's/,,/,pcntl_exec,/g' /etc/php5/fpm/php.ini
else
echo "no modification of php.ini"
fi
# Reload services after cleaning
sudo service php5-fpm reload

View file

@ -13,6 +13,7 @@ admin=$(ynh_app_setting_get $app admin)
final_path=$(ynh_app_setting_get $app final_path)
db_user=$(ynh_app_setting_get $app db_user)
db_pwd=$(ynh_app_setting_get $app db_pwd)
run_exec=$(ynh_app_setting_get $app run_exec)
if [ -d $final_path ]; then
echo "There is already a directory: $final_path " >&2
@ -37,6 +38,13 @@ sudo cp -a ./sources/. $final_path/
ynh_mysql_create_db $db_user $db_user $db_pwd
mysql --debug-check -u $db_user -p$db_pwd $db_user < ./backupdb.sql
# Modify php.ini to allow exec() function and increase the upload size limits
if [ "$run_exec" = "Yes" ];
then
sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini
else
echo "no modification of php.ini"
fi
# Copy dedicated php-fpm process from backup folder to the right location
sudo cp -a ./php-fpm.conf /etc/php5/fpm/pool.d/$app.conf

View file

@ -17,6 +17,7 @@ db_pwd=$(ynh_app_setting_get $app db_pwd)
db_user=$(ynh_app_setting_get $app db_user)
email=$(ynh_app_setting_get $app email)
upload=$(ynh_app_setting_get $app upload)
run_exec=$(ynh_app_setting_get $app run_exec)
CHECK_PATH # Vérifie et corrige la syntaxe du path.
@ -65,7 +66,13 @@ sudo chown root: $nginxconf
sudo chmod 600 $nginxconf
# Modify php.ini to allow exec() function and increase the upload size limits
#sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini
if [ "$run_exec" = "Yes" ];
then
sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini
else
echo "no modification of php.ini"
fi
# Dedicated php-fpm
sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/php-fpm.conf
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
phpfpmconf=/etc/php5/fpm/pool.d/$app.conf