Newer
Older
$content = str_replace('{vhost_port}', $conf['apache']['vhost_port'], $content);
// comment out the listen directive if port is 80 or 443
if($conf['apache']['vhost_port'] == 80 or $conf['apache']['vhost_port'] == 443) {
$content = str_replace('{vhost_port_listen}', '#', $content);
} else {
$content = str_replace('{vhost_port_listen}', '', $content);
}
wf("$vhost_conf_dir/ispconfig.vhost", $content);
//copy('tpl/apache_ispconfig.vhost.master', "$vhost_conf_dir/ispconfig.vhost");
if($this->install_ispconfig_interface == true && $this->is_update == false) {
if(@is_link("$vhost_conf_enabled_dir/ispconfig.vhost")) unlink("$vhost_conf_enabled_dir/ispconfig.vhost");
if(!@is_link("$vhost_conf_enabled_dir/000-ispconfig.vhost")) {
exec("ln -s $vhost_conf_dir/ispconfig.vhost $vhost_conf_enabled_dir/000-ispconfig.vhost");
}
if(!is_file('/var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter')) {
exec('mkdir -p /var/www/php-fcgi-scripts/ispconfig');
exec('cp tpl/apache_ispconfig_fcgi_starter.master /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
exec('chmod +x /var/www/php-fcgi-scripts/ispconfig/.php-fcgi-starter');
exec('ln -s /usr/local/ispconfig/interface/web /var/www/ispconfig');
exec('chown -R ispconfig:ispconfig /var/www/php-fcgi-scripts/ispconfig');
tbrehm
committed
//* Install the SVN update script
exec('cp ../helper_scripts/update_from_svn.sh /usr/local/bin/ispconfig_update_from_svn.sh');
exec('chown root /usr/local/bin/ispconfig_update_from_svn.sh');
exec('chmod 700 /usr/local/bin/ispconfig_update_from_svn.sh');
//* Make the logs readable for the ispconfig user
if(@is_file('/var/log/mail.log')) exec('chmod +r /var/log/mail.log');
if(@is_file('/var/log/mail.warn')) exec('chmod +r /var/log/mail.warn');
if(@is_file('/var/log/mail.err')) exec('chmod +r /var/log/mail.err');
if(@is_file('/var/log/messages')) exec('chmod +r /var/log/messages');
if(@is_file('/var/log/clamav/clamav.log')) exec('chmod +r /var/log/clamav/clamav.log');
if(@is_file('/var/log/clamav/freshclam.log')) exec('chmod +r /var/log/clamav/freshclam.log');
//* Create the ispconfig log directory
if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig');
if(!is_file('/var/log/ispconfig/ispconfig.log')) exec('touch /var/log/ispconfig/ispconfig.log');
tbrehm
committed
}
public function configure_dbserver()
{
global $conf;
//* If this server shall act as database server for client DB's, we configure this here
$install_dir = $conf['ispconfig_install_dir'];
// Create a file with the database login details which
// are used to create the client databases.
if(!is_dir("$install_dir/server/lib")) {
$command = "mkdir $install_dir/server/lib";
caselog($command.' &> /dev/null', __FILE__, __LINE__, "EXECUTED: $command", "Failed to execute the command $command");
}
$content = rf("tpl/mysql_clientdb.conf.master");
$content = str_replace('{username}',$conf['mysql']['admin_user'],$content);
$content = str_replace('{password}',$conf['mysql']['admin_password'], $content);
wf("$install_dir/server/lib/mysql_clientdb.conf",$content);
exec('chmod 600 '."$install_dir/server/lib/mysql_clientdb.conf");
exec('chown root:root '."$install_dir/server/lib/mysql_clientdb.conf");
}
global $conf;
//* Root Crontab
exec('crontab -u root -l > crontab.txt');
// remove existing ispconfig cronjobs, in case the syntax has changed
foreach($existing_root_cron_jobs as $key => $val) {
if(stristr($val,'/usr/local/ispconfig')) unset($existing_root_cron_jobs[$key]);
}
'* * * * * /usr/local/ispconfig/server/server.sh > /dev/null 2>> /var/log/ispconfig/cron.log',
'30 00 * * * /usr/local/ispconfig/server/cron_daily.sh > /dev/null 2>> /var/log/ispconfig/cron.log'
if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
file_put_contents('crontab.txt', $existing_root_cron_jobs);
exec('crontab -u root crontab.txt &> /dev/null');
if(is_user('getmail')) {
$cf = $conf['getmail'];
exec('crontab -u getmail -l > crontab.txt');
$existing_cron_jobs = file('crontab.txt');
$cron_jobs = array(
'*/5 * * * * '.$cf['program'].' -n -g '.$cf['config_dir'].' -r '.$cf['config_dir'].'/*.conf > /dev/null 2>> /var/log/ispconfig/cron.log'
// remove existing ispconfig cronjobs, in case the syntax has changed
foreach($cron_jobs as $key => $val) {
if(stristr($val,$cf['program'])) unset($existing_cron_jobs[$key]);
foreach($cron_jobs as $cron_job) {
if(!in_array($cron_job."\n", $existing_cron_jobs)) {
$existing_cron_jobs[] = $cron_job."\n";
}
file_put_contents('crontab.txt', $existing_cron_jobs);
exec('crontab -u getmail crontab.txt &> /dev/null');
unlink('crontab.txt');
exec('touch /var/log/ispconfig/cron.log');
tbrehm
committed
}