Explorar el Código

Make checks more future proof

Jaap Marcus hace 1 año
padre
commit
10f7e0d854
Se han modificado 2 ficheros con 7 adiciones y 6 borrados
  1. 1 1
      bin/v-add-web-php
  2. 6 5
      bin/v-restart-web-backend

+ 1 - 1
bin/v-add-web-php

@@ -35,7 +35,7 @@ fi
 php_fpm="/etc/init.d/php$version-fpm"
 
 # Verify php version format
-if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
+if [[ ! $version =~ ^[0-9]+\.[0-9]+ ]]; then
 	echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
 	echo "Example: 7.0, 7.4, 8.0"
 	exit "$E_INVALID"

+ 6 - 5
bin/v-restart-web-backend

@@ -36,12 +36,13 @@ send_email_report() {
 
 is_format_valid 'restart'
 
-if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
-	echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
-	echo "Example: 7.0, 7.4, 8.0"
-	exit "$E_INVALID"
+if [ -z "$version" ]; then
+	if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
+		echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
+		echo "Example: 7.0, 7.4, 8.0"
+		exit "$E_INVALID"
+	fi
 fi
-
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#