Browse Source

Remove installed PHP versions

Ernesto Nicolás Carrea 5 years ago
parent
commit
8f39fa8903
3 changed files with 11 additions and 3 deletions
  1. 4 1
      bin/module/php/del.inc
  2. 2 1
      bin/module/php/install.inc
  3. 5 1
      bin/module/php/remove.inc

+ 4 - 1
bin/module/php/del.inc

@@ -16,8 +16,11 @@ hestia_module_php_del() {
         exit 1
     fi
 
+    # PHP version is first parameter
+    param_ver="$1"
+
     if [ ! $param_ver ]; then
-        echo "You must specify --ver [php_version]"
+        echo "You must specify PHP version"
         exit 1
     fi
 

+ 2 - 1
bin/module/php/install.inc

@@ -12,9 +12,10 @@ hestia_module_php_install() {
 
     echo "Installing PHP (FPM) module..."
 
-    $BIN/hestia module php add --ver $PHP_DEFAULT_VERSION
+    $BIN/hestia module php add $PHP_DEFAULT_VERSION
 
     pool_d=$(osal_multiphp_fpm_pool_d $PHP_DEFAULT_VERSION)
+    mkdir -p $pool_d
     cp -f $HESTIA_INSTALL_DIR/php-fpm/www.conf $pool_d/www.conf
 
     if [ "$OS_BASE" = 'debian' ]; then    

+ 5 - 1
bin/module/php/remove.inc

@@ -22,7 +22,11 @@ hestia_module_php_remove() {
     # FIXME: this will not remove unsupported but installed PHP versions
     # (i.e. supported by an older version of Hestia)
     for php_version in $PHP_SUPPORTED_VERSIONS; do
-        $BIN/hestia module php del $php_version
+        php_withoutdot=${php_version//.}
+        php_version_present=$(osal_kv_read $HESTIA_CONF_MODULES/php.conf "php${php_withoutdot}_present" '')
+        if [ "$php_version_present" ]; then
+            $BIN/hestia module php del $php_version
+        fi
     done
 
     osal_kv_write $HESTIA/conf/hestia.conf 'WEB_BACKEND' 'no'