Browse Source

Merge branch 'main' into feature/user-roles

Kristan Kenney 5 years ago
parent
commit
dfe5b005c9
5 changed files with 240 additions and 0 deletions
  1. 48 0
      bin/v-restore-cron-job
  2. 48 0
      bin/v-restore-database
  3. 48 0
      bin/v-restore-dns-domain
  4. 48 0
      bin/v-restore-mail-domain
  5. 48 0
      bin/v-restore-web-domain

+ 48 - 0
bin/v-restore-cron-job

@@ -0,0 +1,48 @@
+#!/bin/bash
+# info: restore single cron job
+# options: USER BACKUP DOMAIN [NOTIFY]
+# labels: panel
+#
+# example: v-restore-cron-job USER BACKUP CRON [NOTIFY]
+# 
+# The function allows the user to restore a single cron job
+# from a backup archive.
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+backup=$2
+cronjob=$3
+notify=$4
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+args_usage='USER BACKUP CRON [NOTIFY]'
+check_args '3' "$#" "$args_usage"
+is_format_valid 'user' 'backup'
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+$BIN/v-restore-user $user $backup 'no' 'no' 'no' 'no' $cronjob 'no' $notify
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 48 - 0
bin/v-restore-database

@@ -0,0 +1,48 @@
+#!/bin/bash
+# info: restore single database
+# options: USER BACKUP DOMAIN [NOTIFY]
+# labels: panel
+#
+# example: v-restore-web-domain USER BACKUP DATABASE [NOTIFY]
+# 
+# The function allows the user to restore a single database
+# from a backup archive.
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+backup=$2
+database=$3
+notify=$4
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+args_usage='USER BACKUP DOMAIN [NOTIFY]'
+check_args '3' "$#" "$args_usage"
+is_format_valid 'user' 'backup'
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+$BIN/v-restore-user $user $backup 'no' 'no' 'no' $database 'no' 'no' $notify
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 48 - 0
bin/v-restore-dns-domain

@@ -0,0 +1,48 @@
+#!/bin/bash
+# info: restore single dns domain
+# options: USER BACKUP DOMAIN [NOTIFY]
+# labels: panel
+#
+# example: v-restore-web-domain USER BACKUP DOMAIN [NOTIFY]
+# 
+# The function allows the user to restore a single DNS domain
+# from a backup archive.
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+backup=$2
+domain=$3
+notify=$4
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+args_usage='USER BACKUP DOMAIN [NOTIFY]'
+check_args '3' "$#" "$args_usage"
+is_format_valid 'user' 'backup'
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+$BIN/v-restore-user $user $backup 'no' $domain 'no' 'no' 'no' 'no' $notify
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 48 - 0
bin/v-restore-mail-domain

@@ -0,0 +1,48 @@
+#!/bin/bash
+# info: restore single mail domain
+# options: USER BACKUP DOMAIN [NOTIFY]
+# labels: panel
+#
+# example: v-restore-web-domain USER BACKUP DOMAIN [NOTIFY]
+# 
+# The function allows the user to restore a single mail domain
+# from a backup archive.
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+backup=$2
+domain=$3
+notify=$4
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+args_usage='USER BACKUP DOMAIN [NOTIFY]'
+check_args '3' "$#" "$args_usage"
+is_format_valid 'user' 'backup'
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+$BIN/v-restore-user $user $backup 'no' 'no' $domain 'no' 'no' 'no' $notify
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 48 - 0
bin/v-restore-web-domain

@@ -0,0 +1,48 @@
+#!/bin/bash
+# info: restore single web domain
+# options: USER BACKUP DOMAIN [NOTIFY]
+# labels: panel
+#
+# example: v-restore-web-domain USER BACKUP DOMAIN [NOTIFY]
+# 
+# The function allows the user to restore a single web domain
+# from a backup archive.
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+backup=$2
+domain=$3
+notify=$4
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+# Perform verification if read-only mode is enabled
+check_hestia_demo_mode
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+args_usage='USER BACKUP DOMAIN [NOTIFY]'
+check_args '3' "$#" "$args_usage"
+is_format_valid 'user' 'backup'
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+$BIN/v-restore-user $user $backup $domain 'no' 'no' 'no' 'no' 'no' $notify
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+log_event "$OK" "$ARGUMENTS"
+
+exit