Просмотр исходного кода

remove PHP code, and fix installer warning

When install hestia, 

Installer first add user and then install PHP, so this php code return a warning 

/usr/local/hestia/bin/v-add-user: line 36: php: command not found

So why add php code to pure bash script :/
Maksim Usmanov | Maks 2 лет назад
Родитель
Сommit
4e7b27b1ff
1 измененных файлов с 4 добавлено и 5 удалено
  1. 4 5
      bin/v-add-user

+ 4 - 5
bin/v-add-user

@@ -35,11 +35,10 @@ source_conf "$HESTIA/conf/hestia.conf"
 is_user_free() {
 	# these names may cause issues with MariaDB/MySQL database names and should be reserved:
 	# sudo has been added due to Privilege escalation as sudo group has always sudo permission
-	check_sysuser=$(php -r '$reserved_names=array("aria", "aria_log", "mysql", "mysql_upgrade", "ib", "ib_buffer",
- "ddl", "ddl_recovery", "performance", "sudo"); if(in_array(strtolower($argv[1]), $reserved_names, true)){echo implode(", ", $reserved_names);}' "$user")
-	if [ -n "$check_sysuser" ]; then
-		check_result "$E_INVALID" "The user name '$user' is reserved and cannot be used. List of reserved names: $check_sysuser"
-		return
+	reserved_names=("aria" "aria_log" "mysql" "mysql_upgrade" "ib" "ib_buffer" "ddl" "ddl_recovery" "performance" "sudo")
+	if [[ "${reserved_names[@],,}" =~ "${user,,}" ]]; then
+        	check_result "$E_INVALID" "The user name '$user' is reserved and cannot be used. List of reserved names: ${reserved_names[*]}"
+        	return
 	fi
 	check_sysuser=$(cut -f 1 -d : /etc/passwd | grep "^$user$")
 	if [ -n "$check_sysuser" ] || [ -e "$USER_DATA" ]; then