diff --git a/manifest.json b/manifest.json index 63186a3c..c3ac1a4d 100644 --- a/manifest.json +++ b/manifest.json @@ -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" } ] } diff --git a/scripts/install b/scripts/install index ad2a0728..3e52ca0c 100755 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/remove b/scripts/remove index f4a1dd64..5204e8ca 100755 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index 96000b27..49bd6f4a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index 6575b712..14132e9c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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