Skip to content

Commit fe68ebe

Browse files
author
Kristan Kenney
authored
Minor code quality improvements (hestiacp#2298)
* General code clean up (line spacings, comments, typos) Clarified language in upgrade scripts Fixed typo for File Manager version check Added comment headers to function libraries Add comment headers to manual upgrade scripts Clarify upgrade messages and comments * SDK: Add blank script template * Minor fixes to installer scripts (comments/code parity) * Changed hesita.conf to hestia.conf * Clarified comments * Moved code block for initial port setting to align with Debian installer and trigger after hestia.conf is created Add documentation link to installer Update warning prompt at end of install Fix comment and command order Fix capitalization of iptables * Fix capitalization of phpMyAdmin/phpPgAdmin
1 parent 3f36e9b commit fe68ebe

File tree

500 files changed

+1381
-2944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

500 files changed

+1381
-2944
lines changed

bin/v-acknowledge-user-notification

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
#!/bin/bash
22
# info: update user notification
33
# options: USER NOTIFICATION
4-
# labels: panel
54
#
65
# example: v-acknowledge-user-notification
76
#
8-
# The function updates user notification.
9-
7+
# This function updates user notification.
108

119
#----------------------------------------------------------#
12-
# Variable&Function #
10+
# Variables & Functions #
1311
#----------------------------------------------------------#
1412

1513
# Argument definition
@@ -23,6 +21,7 @@ source /etc/hestiacp/hestia.conf
2321
source $HESTIA/func/main.sh
2422
# load config file
2523
source_conf "$HESTIA/conf/hestia.conf"
24+
2625
#----------------------------------------------------------#
2726
# Verifications #
2827
#----------------------------------------------------------#
@@ -34,7 +33,6 @@ is_object_valid 'user' 'USER' "$user"
3433
# Perform verification if read-only mode is enabled
3534
check_hestia_demo_mode
3635

37-
3836
#----------------------------------------------------------#
3937
# Action #
4038
#----------------------------------------------------------#

bin/v-add-backup-host

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/bin/bash
22
# info: add backup host
33
# options: TYPE HOST USERNAME PASSWORD [PATH] [PORT]
4-
# labels:
54
#
65
# example: v-add-backup-host sftp backup.acme.com admin p4$$w@Rd
76
# v-add-backup-host b2 bucketName keyID applicationKey
87
#
98
# Add a new remote backup location. Currently SFTP, FTP and Backblaze are supported
109

1110
#----------------------------------------------------------#
12-
# Variable&Function #
11+
# Variables & Functions #
1312
#----------------------------------------------------------#
1413

1514
# Argument definition
@@ -99,7 +98,6 @@ sftpc() {
9998
EOF
10099
}
101100

102-
103101
#----------------------------------------------------------#
104102
# Verifications #
105103
#----------------------------------------------------------#
@@ -230,7 +228,6 @@ elif [ $type == 'b2' ]; then
230228
chmod 660 $HESTIA/conf/$type.backup.conf
231229
fi
232230

233-
234231
#----------------------------------------------------------#
235232
# Hestia #
236233
#----------------------------------------------------------#

bin/v-add-cron-hestia-autoupdate

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/bin/bash
2-
# info: add cron job for hestia autoupdates
2+
# info: add cron job for hestia automatic updates
33
# options: MODE
4-
# labels:
54
#
6-
# The function adds cronjob for hestia autoupdate from apt or git.
7-
5+
# This function adds a cronjob for hestia automatic updates
6+
# that can be downloaded from apt or git.
87

98
#----------------------------------------------------------#
10-
# Variable&Function #
9+
# Variables & Functions #
1110
#----------------------------------------------------------#
1211

1312
# Argument definition
@@ -22,7 +21,6 @@ source $HESTIA/func/main.sh
2221
# load config file
2322
source_conf "$HESTIA/conf/hestia.conf"
2423

25-
2624
#----------------------------------------------------------#
2725
# Verifications #
2826
#----------------------------------------------------------#
@@ -39,7 +37,6 @@ fi
3937
# Perform verification if read-only mode is enabled
4038
check_hestia_demo_mode
4139

42-
4340
#----------------------------------------------------------#
4441
# Action #
4542
#----------------------------------------------------------#
@@ -75,13 +72,13 @@ str="$str CMD='$command' SUSPENDED='no' TIME='$time' DATE='$date'"
7572
# Adding to crontab
7673
echo "$str" >> $HESTIA/data/users/$user/cron.conf
7774

78-
# Chaning permissions
75+
# Changing permissions
7976
chmod 660 $HESTIA/data/users/$user/cron.conf
8077

8178
# Sort jobs by id number
8279
sort_cron_jobs
8380

84-
# Sync cronjobs with system crond
81+
# Sync cronjobs with system cron
8582
sync_cron_jobs
8683

8784
#----------------------------------------------------------#
@@ -91,7 +88,7 @@ sync_cron_jobs
9188
# Increasing cron value
9289
increase_user_value "$user" '$U_CRON_JOBS'
9390

94-
# Restarting crond
91+
# Restarting cron
9592
$BIN/v-restart-cron
9693
check_result $? "Cron restart failed" >/dev/null
9794

bin/v-add-cron-job

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
#!/bin/bash
22
# info: add cron job
33
# options: USER MIN HOUR DAY MONTH WDAY COMMAND [JOB] [RESTART]
4-
# labels:
54
#
65
# example: v-add-cron-job admin * * * * * sudo /usr/local/hestia/bin/v-backup-users
76
#
8-
# The function adds a job to cron daemon. When executing commands, any output
7+
# This function adds a job to cron daemon. When executing commands, any output
98
# is mailed to user's email if parameter REPORTS is set to 'yes'.
109

11-
1210
#----------------------------------------------------------#
13-
# Variable&Function #
11+
# Variables & Functions #
1412
#----------------------------------------------------------#
1513

1614
# Argument definition
@@ -51,7 +49,6 @@ is_object_new 'cron' 'JOB' "$job"
5149
# Perform verification if read-only mode is enabled
5250
check_hestia_demo_mode
5351

54-
5552
#----------------------------------------------------------#
5653
# Action #
5754
#----------------------------------------------------------#
@@ -77,15 +74,14 @@ sort_cron_jobs
7774
# Sync cronjobs with system crond
7875
sync_cron_jobs
7976

80-
8177
#----------------------------------------------------------#
8278
# Hestia #
8379
#----------------------------------------------------------#
8480

8581
# Increasing cron value
8682
increase_user_value $user '$U_CRON_JOBS'
8783

88-
# Restarting crond
84+
# Restarting cron
8985
$BIN/v-restart-cron "$restart"
9086
check_result $? "Cron restart failed" >/dev/null
9187

bin/v-add-cron-letsencrypt-job

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#!/bin/bash
2-
# info: add letsencrypt cronjob
2+
# info: add cron job for Let's Encrypt certificates
33
# options: NONE
4-
# labels:
54
#
6-
# The script for enabling letsencrypt cronjob
7-
5+
# This function adds a new cron job for Let's Encrypt.
86

97
#----------------------------------------------------------#
10-
# Variable&Function #
8+
# Variables & Functions #
119
#----------------------------------------------------------#
1210

1311
# Includes
@@ -18,7 +16,6 @@ source $HESTIA/func/main.sh
1816
# load config file
1917
source_conf "$HESTIA/conf/hestia.conf"
2018

21-
2219
#----------------------------------------------------------#
2320
# Verifications #
2421
#----------------------------------------------------------#
@@ -39,7 +36,6 @@ if [ -z "$check_cron" ] && [ -n "$CRON_SYSTEM" ]; then
3936
$BIN/v-add-cron-job admin '*/5' '*' '*' '*' '*' "$cmd"
4037
fi
4138

42-
4339
#----------------------------------------------------------#
4440
# Hestia #
4541
#----------------------------------------------------------#

bin/v-add-cron-reports

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
#!/bin/bash
22
# info: add cron reports
33
# options: USER
4-
# labels:
54
#
65
# example: v-add-cron-reports admin
76
#
8-
# The script for enabling reports on cron tasks and administrative
7+
# This function for enabling reports on cron tasks and administrative
98
# notifications.
109

11-
1210
#----------------------------------------------------------#
13-
# Variable&Function #
11+
# Variables & Functions #
1412
#----------------------------------------------------------#
1513

1614
# Argument definition
@@ -24,7 +22,6 @@ source $HESTIA/func/main.sh
2422
# load config file
2523
source_conf "$HESTIA/conf/hestia.conf"
2624

27-
2825
#----------------------------------------------------------#
2926
# Verifications #
3027
#----------------------------------------------------------#
@@ -48,12 +45,11 @@ update_user_value "$user" '$CRON_REPORTS' 'yes'
4845
# Sync system cron with user
4946
sync_cron_jobs
5047

51-
5248
#----------------------------------------------------------#
5349
# Hestia #
5450
#----------------------------------------------------------#
5551

56-
# Restart crond
52+
# Restart cron
5753
$BIN/v-restart-cron
5854
check_result $? "Cron restart failed" >/dev/null
5955

bin/v-add-cron-restart-job

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#!/bin/bash
22
# info: add cron reports
33
# options: NONE
4-
# labels:
54
#
6-
# The script for enabling restart cron tasks
7-
5+
# This function for enabling restart cron tasks
86

97
#----------------------------------------------------------#
10-
# Variable&Function #
8+
# Variables & Functions #
119
#----------------------------------------------------------#
1210

1311
# Includes
@@ -18,7 +16,6 @@ source $HESTIA/func/main.sh
1816
# load config file
1917
source_conf "$HESTIA/conf/hestia.conf"
2018

21-
2219
#----------------------------------------------------------#
2320
# Verifications #
2421
#----------------------------------------------------------#
@@ -39,7 +36,6 @@ if [ -z "$check_cron" ] && [ -n "$CRON_SYSTEM" ]; then
3936
$BIN/v-add-cron-job admin '*' '*' '*' '*' '*' "$cmd"
4037
fi
4138

42-
4339
#----------------------------------------------------------#
4440
# Hestia #
4541
#----------------------------------------------------------#

bin/v-add-database

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
#!/bin/bash
22
# info: add database
33
# options: USER DATABASE DBUSER DBPASS [TYPE] [HOST] [CHARSET]
4-
# labels:
54
#
65
# example: v-add-database admin wordpress_db matt qwerty123
76
#
8-
# The function creates the database concatenating username and user_db.
7+
# This function creates the database concatenating username and user_db.
98
# Supported types of databases you can get using v-list-sys-config script.
109
# If the host isn't stated and there are few hosts configured on the server,
1110
# then the host will be defined by one of three algorithms. "First" will choose
1211
# the first host in the list. "Random" will chose the host by a chance.
1312
# "Weight" will distribute new database through hosts evenly. Algorithm and
1413
# types of supported databases is designated in the main configuration file.
1514

16-
1715
#----------------------------------------------------------#
18-
# Variable&Function #
16+
# Variables & Functions #
1917
#----------------------------------------------------------#
2018

2119
# Argument definition
@@ -76,7 +74,6 @@ dbpass="$password"
7674
# Perform verification if read-only mode is enabled
7775
check_hestia_demo_mode
7876

79-
8077
#----------------------------------------------------------#
8178
# Action #
8279
#----------------------------------------------------------#
@@ -87,7 +84,6 @@ case $type in
8784
pgsql) add_pgsql_database ;;
8885
esac
8986

90-
9187
#----------------------------------------------------------#
9288
# Hestia #
9389
#----------------------------------------------------------#

bin/v-add-database-host

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
#!/bin/bash
22
# info: add new database server
33
# options: TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TEMPLATE] [PORT]
4-
# labels:
54
#
65
# example: v-add-database-host mysql localhost alice p@$$wOrd
76
#
8-
# The function add new database server to the server pool. It supports local
7+
# This function add new database server to the server pool. It supports local
98
# and remote database servers, which is useful for clusters. By adding a host
109
# you can set limit for number of databases on a host. Template parameter is
1110
# used only for PostgreSQL and has an default value "template1". You can read
1211
# more about templates in official PostgreSQL documentation.
1312

14-
1513
#----------------------------------------------------------#
16-
# Variable&Function #
14+
# Variables & Functions #
1715
#----------------------------------------------------------#
1816

1917
# Argument definition
@@ -65,7 +63,6 @@ is_pgsql_host_alive() {
6563
fi
6664
}
6765

68-
6966
#----------------------------------------------------------#
7067
# Verifications #
7168
#----------------------------------------------------------#
@@ -113,7 +110,6 @@ case $type in
113110
str="$str TIME='$time' DATE='$date' PORT='$port'";;
114111
esac
115112

116-
117113
#----------------------------------------------------------#
118114
# Hestia #
119115
#----------------------------------------------------------#

bin/v-add-database-temp-user

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
#!/bin/bash
22
# info: add temp database user
33
# options: USER DATABASE [TYPE] [HOST] [TTL]
4-
# labels: hestia database
54
#
65
# example: v-add-database-temp-user wordress wordpress_db mysql
76
#
8-
# The function creates an temporary database user mysql_sso_db_XXXXXXXX and a random password
7+
# This function creates an temporary database user mysql_sso_db_XXXXXXXX and a random password
98
# The user has an limited validity and only granted access to the specific database
109
# Returns json to be read SSO Script
1110

1211
#----------------------------------------------------------#
13-
# Variable&Function #
12+
# Variables & Functions #
1413
#----------------------------------------------------------#
1514

1615
# Argument definition

0 commit comments

Comments
 (0)