HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: 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,pcntl_unshare,
Upload Files
File: //usr/share/webmin/virtual-server/configure-script.pl
#!/usr/bin/perl
package virtual_server;

use File::Basename;

=head1 configure-script.pl

Configure web app script

This command allows you to modify settings, perform backups, create clones, and
execute other administrative tasks for a web app script on a local system, as
long as the app has a dedicated workbench plugin available and installed.

For detailed usage instructions and specific options, run the command with the
C<--help> flag.

=cut

if (!$module_name) {
	$main::no_acl_check++;
	$ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin";
	$ENV{'WEBMIN_VAR'} ||= "/var/webmin";
	if ($0 =~ /^(.*)\/[^\/]+$/) {
		chdir($pwd = $1);
		}
	else {
		chop($pwd = `pwd`);
		}
	$0 = "$pwd/configure-script.pl";
	require './virtual-server-lib.pl';
	}

# Load all modules that can configure web app scripts
my @mods;
foreach my $p (@plugins) {
	my %mod = &get_module_info($p);
	if ($mod{'config_script'}) {
		push(@mods, \%mod);
		&load_plugin_libraries($mod{'dir'});
		}
	}

# Pre-process args to get web app name
my $web_app_name;
for (my $i=0; $i<@ARGV; $i++) {
	if ($ARGV[$i] eq '--app' && $i+1 < @ARGV) {
		$web_app_name = $ARGV[$i+1];
		}
	}

# Check for missing --name parameter
if (!$web_app_name) {
	&usage("Missing script type name");
	}

# Locate the usage and CLI handlers for this script type
my $script_usage_func = &script_find_kit_func(\@mods, $web_app_name, 'usage');
my $script_cli        = &script_find_kit_func(\@mods, $web_app_name, 'cli');

# Bail out if there’s no CLI handler
if (!$script_cli) {
	&usage("Script '$web_app_name' does not support configure API");
	}

# Parse common command-line flags
&parse_common_cli_flags(\@ARGV);

# Call the script-specific CLI function
$script_cli->(\@ARGV);

# Expandable usage function
sub usage
{
print "$_[0]\n\n" if ($_[0]);
print "Configure web app script\n\n";
my $has_script_usage_func = defined(&$script_usage_func);
my $name = 'name';
$name = $web_app_name if ($has_script_usage_func && $web_app_name);
print "virtualmin configure-script --app $name";
if ($has_script_usage_func) {
	$script_usage_func->($web_app_name);
	}
else {
	print "\n";
	}
exit(1);
}