|
|
@@ -0,0 +1,55 @@
|
|
|
+#!/bin/bash
|
|
|
+# info: enable or disable demo mode
|
|
|
+#
|
|
|
+# This function will set the demo mode variable,
|
|
|
+# which will prevent usage of certain v-scripts in the backend
|
|
|
+# and prevent modification of objects in the control panel.
|
|
|
+#
|
|
|
+# It will also disable virtual hosts for Apache and NGINX
|
|
|
+# for domains which have been created.
|
|
|
+
|
|
|
+
|
|
|
+#----------------------------------------------------------#
|
|
|
+# Variable&Function #
|
|
|
+#----------------------------------------------------------#
|
|
|
+
|
|
|
+mode=$1
|
|
|
+
|
|
|
+# Includes
|
|
|
+source $HESTIA/func/main.sh
|
|
|
+source $HESTIA/conf/hestia.conf
|
|
|
+
|
|
|
+#----------------------------------------------------------#
|
|
|
+# Action #
|
|
|
+#----------------------------------------------------------#
|
|
|
+
|
|
|
+if [ -z "$mode" ]; then
|
|
|
+ echo "ERROR: No mode specified."
|
|
|
+ echo "Usage: v-change-sys-demo-mode [no|yes]"
|
|
|
+ exit 1
|
|
|
+elif [ "$mode" = "yes" ]; then
|
|
|
+ #TO-DO: Instructions for disabling vhosts
|
|
|
+ $BIN/v-change-sys-config-value 'DEMO_MODE' "$mode"
|
|
|
+elif [ "$mode" = "no" ]; then
|
|
|
+ #TODO: Instructions for enabling vhosts
|
|
|
+ $BIN/v-change-sys-config-value 'DEMO_MODE' "$mode"
|
|
|
+else
|
|
|
+ echo "ERROR: Invalid mode specified."
|
|
|
+ echo "Valid modes:"
|
|
|
+ echo "no: Disables read only / demo mode."
|
|
|
+ echo "yes: Enables read only / demo mode."
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
+
|
|
|
+#----------------------------------------------------------#
|
|
|
+# Hestia #
|
|
|
+#----------------------------------------------------------#
|
|
|
+
|
|
|
+# Restarting web server
|
|
|
+$BIN/v-restart-web $restart
|
|
|
+check_result $? "restart" >/dev/null 2>&1
|
|
|
+
|
|
|
+$BIN/v-restart-proxy $restart
|
|
|
+check_result $? "restart" >/dev/null 2>&1
|
|
|
+
|
|
|
+exit
|