Server IP : 195.201.23.43 / Your IP : 13.59.203.127 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/virtual-server/ |
Upload File : |
#!/usr/bin/perl # Reset some features on a selected domain require './virtual-server-lib.pl'; &ReadParse(); &error_setup($text{'reset_err'}); &can_edit_templates() || &error($text{'reset_ecannot'}); # Check and parse inputs my $d = &get_domain($in{'server'}); $d && &can_edit_domain($d) || &error($text{'reset_edom'}); my %sel = map { $_, 1 } split(/\0/, $in{'features'}); %sel || &error($text{'reset_efeatures'}); my @dom_features = grep { $d->{$_} && $sel{$_} } &list_ordered_features($d); @dom_features || &error($text{'reset_efeatures2'}); my %feature = map { $_, 1 } grep { $sel{$_} } @features; my %plugins = map { $_, 1 } grep { $sel{$_} } &list_feature_plugins(); # Can each be reset? my %canmap; foreach $f (@dom_features) { my $can = 1; my $fn = &feature_name($f, $d); if ($feature{$f}) { my $crfunc = "can_reset_".$f; $can = defined(&$crfunc) ? &$crfunc($d) : 1; } elsif ($plugin{$f}) { $can = &plugin_defined($f, "feature_can_reset") ? &plugin_call($f, "feature_can_reset", $d) : 1; } $can || &error(&text('reset_enoreset', $fn)); $canmap{$f} = $can; } # Run the before command &set_domain_envs($d, "MODIFY_DOMAIN"); $merr = &making_changes(); &reset_domain_envs($d); if (defined($merr)) { &error(&text('save_emaking', "<tt>$merr</tt>")); } &ui_print_header(&domain_in($d), $text{'reset_title'}, ""); # Reset each feature or plugin that was selected my $oldd = { %$d }; my $dataloss; foreach $f (@dom_features) { my $err; my $fn = &feature_name($f, $d); &$first_print(&text('reset_doing', $fn)); # Check if resetting is a good idea if ($feature{$f}) { my $prfunc = "check_reset_".$f; $err = defined(&$prfunc) ? &$prfunc($d) : undef; } elsif ($plugin{$f}) { $err = &plugin_call($f, "feature_check_reset", $d); } if ($err) { if ($in{'fullreset'}) { &$second_print(&text('reset_iwarning', $err)); } elsif ($in{'skipwarnings'}) { &$second_print(&text('reset_swarning', $err)); } else { &$second_print(&text('reset_dataloss', $err)); $dataloss = 1; next; } } # Do the reset &$indent_print(); if ($feature{$f}) { # Core feature of Virtualmin my $rfunc = "reset_".$f; if (defined(&$rfunc) && (!$in{'fullreset'} || $canmap{$f} == 2)) { # A reset function exists &try_function($f, $rfunc, $d); } else { # Turn on and off via delete and setup calls $d->{$f} = 0; &call_feature_func($f, $d, $oldd); my $newoldd = { %$d }; $d->{$f} = 1; &call_feature_func($f, $d, $newoldd); } } if ($plugin{$f}) { # Defined by a plugin if (&plugin_defined($f, "feature_reset") && (!$in{'fullreset'} || $canmap{$f} == 2)) { # Call the reset function &plugin_call($f, "feature_reset", $d); } else { # Turn off and on again $d->{$f} = 0; &plugin_call($f, "feature_delete", $d); $d->{$f} = 1; &plugin_call($f, "feature_setup", $d); } } &$outdent_print(); &$second_print($text{'setup_done'}); } &run_post_actions(); # Offer to reset anyway if ($dataloss) { print &ui_form_start("reset_features.cgi", "post"); print &ui_hidden("server", $in{'server'}); foreach my $f (keys %sel) { print &ui_hidden("features", $f); } print &ui_form_end( [ [ 'skipwarnings', $text{'reset_override'} ] ]); } &ui_print_footer("", $text{'index_return'}, "edit_newvalidate.cgi?mode=reset", $text{'newvalidate_return'});Private