Server : Apache System : Linux copper.netcy.com 2.6.32-754.27.1.el6.centos.plus.x86_64 #1 SMP Thu Jan 30 13:54:25 UTC 2020 x86_64 User : montcaro ( 581) PHP Version : 7.4.28 Disable Function : NONE Directory : /scripts/ |
#!/usr/local/cpanel/3rdparty/bin/perl # cpanel - mkwwwacctconf Copyright 2010 cPanel, Inc. # All rights Reserved. # copyright@cpanel.net http://cpanel.net # This code is subject to the cpanel license. Unauthorized copying is prohibited use strict; use Cpanel::Config::SaveWwwAcctConf (); use Cpanel::Config::LoadWwwAcctConf (); use Cpanel::DIp::MainIP (); use Cpanel::Hostname (); use Whostmgr::TweakSettings::Basic (); my $reset = @ARGV && grep( /^--(?:reset|force)$/, @ARGV ) ? 1 : 0; my $inherit = ( grep { $_ eq '--inherit' } @ARGV ) ? 1 : 0; my $wwwacctconf = '/etc/wwwacct.conf'; my %cur_conf = Cpanel::Config::LoadWwwAcctConf::loadwwwacctconf(); # Don't clobber a valid config if ( !$reset && -e $wwwacctconf ) { exit if ( $cur_conf{'DEFMOD'} || $cur_conf{'NS'} || $cur_conf{'HOST'} ); # Check to see if some common settings are configured } my $hostname = Cpanel::Hostname::gethostname(); my $sharedip = Cpanel::DIp::MainIP::getmainserverip(); # Sanity check if ( !$sharedip ) { die 'Unable to determine main shared IP.'; } # default nameserver entries my @hostnameparts = split /[.]/, $hostname; shift @hostnameparts; my $hostnamedomain = join '.', @hostnameparts; my $ns = 'ns1.' . $hostnamedomain; my $ns2 = 'ns2.' . $hostnamedomain; my $conf_hostname = ( $hostname && $hostname =~ m{\.} ) ? $hostname : q{}; my $conf_ns = $conf_hostname ? $ns : q{}; my $conf_ns2 = $conf_hostname ? $ns2 : q{}; my %system_specific_values = ( 'ADDR' => $sharedip, 'HOST' => $conf_hostname, 'NS' => $conf_ns, 'NS2' => $conf_ns2, ); my %conf; for my $key ( keys %Whostmgr::TweakSettings::Basic::Conf ) { my $default = $Whostmgr::TweakSettings::Basic::Conf{$key}->{'default'}; if ( !defined($default) ) { $conf{$key} = $inherit ? $cur_conf{$key} : q{}; } elsif ( ref $default eq 'CODE' ) { $conf{$key} = $default->(); } else { $conf{$key} = $default; } } @conf{ keys %system_specific_values } = values %system_specific_values; Cpanel::Config::SaveWwwAcctConf::savewwwacctconf( \%conf );