Skip to content

Commit d1505bd

Browse files
committed
dynvars
Improved command for dynvars. Removed the old command.
1 parent 1a26eed commit d1505bd

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

lib/general

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,8 @@ check_for_parameters() {
597597
local par=$(echo "${arg}" | cut -d'=' -f 1 -s)
598598
local val=$(echo "${arg}" | cut -d'=' -f 2 -s)
599599
[[ -z $par ]] && par=$arg
600-
[[ -z $val && $par == "conf-value_"* ]] && val="NeverMatchString" #Special value to allow the string "true" as a valid value.
601600
[[ -z $val ]] && val=true
602601

603-
# Check for Webinoly -conf-value_
604-
if [[ $par == "conf-value_"* ]]; then
605-
dyn_var=$(echo "${par}" | cut -d'_' -f 2 -s)
606-
par=$(echo "${par}" | cut -d'_' -f 1 -s)
607-
fi
608-
609602
# Convert to lowercase and support for hyphen in arguments.
610603
par=${par,,}
611604
par=$(echo $par | sed "s/-/_/g")

usr/webinoly

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# Webinoly Server Manager Plugin
44
# Syntax: webinoly <option> <argument>
5-
# Options: -update, -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -cache-valid, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -conf-value_, -default-site, -tools-site, -mysql-password, -smtp, -backup, -aws-s3-credentials, -db-import, -send-to-s3, -custom-headers, -skip-cache, -skip-cookie-cache, -query-string-cache, -query-string-never-cache, -email, -export, -import, -mysql-public-access
6-
# Arguments: -raw, -profile, -list, -bucket, -source, -delete, -run, -restore, -wp, -destination, -date, -s3-european-buckets, info, -file, -add-db-pre, -no-recovery, -recalculate, -dbname, -skip-db, -filename, -overwrite
5+
# Options: -update, -server-reset, -verify, -dbpass, -tools-port, -login-www-data, -cache-valid, -uninstall, -info, -external-sources-update, -clear-cache, -version, -blockip, -dynvar, -default-site, -tools-site, -mysql-password, -smtp, -backup, -aws-s3-credentials, -db-import, -send-to-s3, -custom-headers, -skip-cache, -skip-cookie-cache, -query-string-cache, -query-string-never-cache, -email, -export, -import, -mysql-public-access
6+
# Arguments: -raw, -profile, -list, -bucket, -source, -delete, -run, -restore, -wp, -destination, -date, -s3-european-buckets, info, -file, -add-db-pre, -no-recovery, -recalculate, -dbname, -skip-db, -filename, -overwrite, -value
77

88
source /opt/webinoly/lib/webin
99
source /opt/webinoly/lib/datadog
@@ -113,12 +113,12 @@ elif [[ -n $blockip ]]; then
113113
nginx_blockip
114114

115115

116-
elif [[ -n $conf_value ]]; then
117-
if [[ -n $dyn_var && $dyn_var =~ ^[A-Za-z\-]+$ ]]; then
118-
[[ $conf_value == "NeverMatchString" ]] && read -p "${blu}Enter a value for '${dyn_var}': ${end}" conf_value
119-
if [[ -n $conf_value ]]; then
120-
conf_write $dyn_var $conf_value
121-
echo "${gre}Configuration successfully updated!${end}"
116+
elif [[ -n $dynvar ]]; then
117+
if [[ -n $dynvar && $dynvar =~ ^[A-Za-z\-]+$ ]]; then
118+
[[ -z $value ]] && read -p "${blu}Enter a value for '${dynvar}': ${end}" value
119+
if [[ -n $value ]]; then
120+
conf_write $dynvar "$value"
121+
echo "${gre}Configuration successfully updated! ${dim}(${dynvar}:$(conf_read $dynvar))${end}" # Retrive the value to really be sure!
122122
else
123123
echo "${red}[ERROR] Please, enter a valid value!${end}"
124124
exit 1

0 commit comments

Comments
 (0)