remove.inc 1.4 KB

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