Skip to content

Commit f2675db

Browse files
author
Kristan Kenney
committed
Add v-rebuild-all
Rebuilds all assets associated with a user account (web domains, DNS zones, mail domains, databases, cron jobs, and user account configuration).
1 parent 8c3d792 commit f2675db

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

bin/v-rebuild-all

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# info: rebuild all assets for a specified user
3+
# options: USER [RESTART]
4+
#
5+
# The function rebuilds all assets for a user account:
6+
# - Web domains
7+
# - DNS zones
8+
# - Mail domains
9+
# - Databases
10+
# - Cron Jobs
11+
# - User account configuration
12+
13+
#----------------------------------------------------------#
14+
# Variable&Function #
15+
#----------------------------------------------------------#
16+
17+
# Argument definition
18+
user=$1
19+
restart=$2
20+
21+
# Includes
22+
source $HESTIA/func/main.sh
23+
source $HESTIA/func/rebuild.sh
24+
source $HESTIA/conf/hestia.conf
25+
26+
# Export sbin
27+
export PATH=$PATH:/usr/sbin
28+
29+
30+
#----------------------------------------------------------#
31+
# Verifications #
32+
#----------------------------------------------------------#
33+
34+
check_args '1' "$#" 'USER [RESTART]'
35+
is_format_valid 'user'
36+
is_object_valid 'user' 'USER' "$user"
37+
is_object_unsuspended 'user' 'USER' "$user"
38+
39+
40+
#----------------------------------------------------------#
41+
# Action #
42+
#----------------------------------------------------------#
43+
44+
# Rebuild loop
45+
for user in $($HESTIA/bin/v-list-sys-users plain); do
46+
$BIN/v-rebuild-web-domains $user $restart
47+
$BIN/v-rebuild-dns-domains $user $restart
48+
$BIN/v-rebuild-mail-domains $user $restart
49+
$BIN/v-rebuild-databases $user $restart
50+
$BIN/v-rebuild-cron-jobs $user $restart
51+
$BIN/v-rebuild-user $user $restart
52+
done
53+
54+
55+
#----------------------------------------------------------#
56+
# Hestia #
57+
#----------------------------------------------------------#
58+
59+
# Logging
60+
log_event "$OK" "$ARGUMENTS"
61+
62+
exit

web/bulk/db/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
if ($_SESSION['user'] == 'admin') {
1919
switch ($action) {
20-
case 'rebuild': $cmd='v-rebuild-web-domain';
20+
case 'rebuild': $cmd='v-rebuild-database';
2121
break;
2222
case 'delete': $cmd='v-delete-database';
2323
break;

web/bulk/user/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
break;
2626
case 'update counters': $cmd='v-update-user-counters';
2727
break;
28-
case 'rebuild': $cmd='v-rebuild-user'; $restart = 'no';
28+
case 'rebuild': $cmd='v-rebuild-all'; $restart = 'no';
2929
break;
3030
case 'rebuild web': $cmd='v-rebuild-web-domains'; $restart = 'no';
3131
break;

0 commit comments

Comments
 (0)