remove.inc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. hestia_module_php_remove() {
  3. source $HESTIA/bin/module/func.inc
  4. source $HESTIA/bin/module/php/func.inc
  5. module_installed=$(hestia_module_isinstalled php)
  6. if [ ! "$module_installed" ] && [ ! "$param_force" ]; then
  7. echo "PHP module is not installed. See 'hestia module info php'."
  8. return 1
  9. fi
  10. module_variant=$(hestia_module_getvariant php)
  11. if [ "$module_variant" != 'php-fpm' ] && [ ! "$param_force" ]; then
  12. echo "The installed PHP module is not FPM. See 'hestia module info php'."
  13. return 1
  14. fi
  15. echo "Removing PHP (FPM) module..."
  16. # Remove all added versions
  17. # FIXME: this will not remove unsupported but installed PHP versions
  18. # (i.e. supported by an older version of Hestia)
  19. for php_version in $PHP_SUPPORTED_VERSIONS; do
  20. php_withoutdot=${php_version//.}
  21. php_version_present=$(osal_kv_read $HESTIA_CONF_MODULES/php.conf "php${php_withoutdot}_present" '')
  22. if [ "$php_version_present" ]; then
  23. $BIN/hestia module php del $php_version
  24. fi
  25. done
  26. osal_kv_write $HESTIA/conf/hestia.conf 'WEB_BACKEND' 'no'
  27. osal_kv_write $HESTIA_CONF_MODULES/php.conf 'installed' '0'
  28. osal_kv_write $HESTIA_CONF_MODULES/php.conf 'description' ''
  29. osal_kv_write $HESTIA_CONF_MODULES/php.conf 'enabled' '0'
  30. osal_kv_write $HESTIA_CONF_MODULES/php.conf 'variant' ''
  31. osal_kv_write $HESTIA_CONF_MODULES/php.conf 'version' '0'
  32. return 0
  33. }