Skip to content

Commit 10f7e0d

Browse files
committed
Make checks more future proof
1 parent d498ac4 commit 10f7e0d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

bin/v-add-web-php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fi
3535
php_fpm="/etc/init.d/php$version-fpm"
3636

3737
# Verify php version format
38-
if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
38+
if [[ ! $version =~ ^[0-9]+\.[0-9]+ ]]; then
3939
echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
4040
echo "Example: 7.0, 7.4, 8.0"
4141
exit "$E_INVALID"

bin/v-restart-web-backend

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ send_email_report() {
3636

3737
is_format_valid 'restart'
3838

39-
if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
40-
echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
41-
echo "Example: 7.0, 7.4, 8.0"
42-
exit "$E_INVALID"
39+
if [ -z "$version" ]; then
40+
if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
41+
echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
42+
echo "Example: 7.0, 7.4, 8.0"
43+
exit "$E_INVALID"
44+
fi
4345
fi
44-
4546
#----------------------------------------------------------#
4647
# Action #
4748
#----------------------------------------------------------#

0 commit comments

Comments
 (0)