protected function getLogfiles($domain) { $logfiles_text = ''; if ($domain['speciallogfile'] == '1' && $this->settings['system']['mod_log_sql'] != '1') { if ($domain['parentdomainid'] == '0') { $speciallogfile = '-' . $domain['domain']; } else { $speciallogfile = '-' . $domain['parentdomain']; } } else { $speciallogfile = ''; } if ($this->settings['system']['mod_log_sql'] == '1') { // We are using mod_log_sql (http://www.outoforder.cc/projects/apache/mod_log_sql/) // TODO: See how we are able emulate the error_log $logfiles_text .= ' LogSQLTransferLogTable access_log' . "\n"; } else { // The normal access/error - logging is enabled $logfiles_text .= ' ErrorLog "' . $this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log' . "\"\n"; $logfiles_text .= ' CustomLog "' . $this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log" combined' . "\n"; } if ($this->settings['system']['awstats_enabled'] == '1') { // prepare the aliases for stats config files $server_alias = ''; $alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . $domain['id'] . '\''); while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) { $server_alias .= ' ' . $alias_domain['domain'] . ' '; if ($alias_domain['iswildcarddomain'] == '1') { $server_alias .= '*.' . $domain['domain']; } else { if ($alias_domain['wwwserveralias'] == '1') { $server_alias .= 'www.' . $alias_domain['domain']; } else { $server_alias .= ''; } } } if ($domain['iswildcarddomain'] == '1') { $alias = '*.' . $domain['domain']; } else { if ($domain['wwwserveralias'] == '1') { $alias = 'www.' . $domain['domain']; } else { $alias = ''; } } // After inserting the AWStats information, be sure to build the awstats conf file as well createAWStatsConf($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias); } return $logfiles_text; }
/** * Lets set the logfiles */ protected function getLogfiles($domain) { $logfiles_text = ''; if ($domain['speciallogfile'] == '1') { if ($domain['parentdomainid'] == '0') { $speciallogfile = '-' . $domain['domain']; } else { $speciallogfile = '-' . $domain['parentdomain']; } } else { $speciallogfile = ''; } // The normal access/error - logging is enabled $error_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-error.log'); // Create the logfile if it does not exist (fixes #46) touch($error_log); chown($error_log, Settings::Get('system.httpuser')); chgrp($error_log, Settings::Get('system.httpgroup')); $access_log = makeCorrectFile(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log'); // Create the logfile if it does not exist (fixes #46) touch($access_log); chown($access_log, Settings::Get('system.httpuser')); chgrp($access_log, Settings::Get('system.httpgroup')); $logfiles_text .= ' ErrorLog "' . $error_log . "\"\n"; $logfiles_text .= ' CustomLog "' . $access_log . '" combined' . "\n"; if (Settings::Get('system.awstats_enabled') == '1') { if ((int) $domain['parentdomainid'] == 0) { // prepare the aliases and subdomains for stats config files $server_alias = ''; $alias_domains_stmt = Database::prepare("\n\t\t\t\t\tSELECT `domain`, `iswildcarddomain`, `wwwserveralias`\n\t\t\t\t\tFROM `" . TABLE_PANEL_DOMAINS . "`\n\t\t\t\t\tWHERE `aliasdomain` = :domainid OR `parentdomainid` = :domainid\n\t\t\t\t"); Database::pexecute($alias_domains_stmt, array('domainid' => $domain['id'])); while (($alias_domain = $alias_domains_stmt->fetch(PDO::FETCH_ASSOC)) !== false) { $server_alias .= ' ' . $alias_domain['domain'] . ' '; if ($alias_domain['iswildcarddomain'] == '1') { $server_alias .= '*.' . $alias_domain['domain']; } elseif ($alias_domain['wwwserveralias'] == '1') { $server_alias .= 'www.' . $alias_domain['domain']; } } $alias = ''; if ($domain['iswildcarddomain'] == '1') { $alias = '*.' . $domain['domain']; } elseif ($domain['wwwserveralias'] == '1') { $alias = 'www.' . $domain['domain']; } // After inserting the AWStats information, // be sure to build the awstats conf file as well // and chown it using $awstats_params, #258 // Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations createAWStatsConf(Settings::Get('system.logfiles_directory') . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain); } } return $logfiles_text; }
protected function getLogfiles($domain) { $logfiles_text = ''; if ($domain['speciallogfile'] == '1' && $this->settings['system']['mod_log_sql'] != '1') { if ($domain['parentdomainid'] == '0') { $speciallogfile = '-' . $domain['domain']; } else { $speciallogfile = '-' . $domain['parentdomain']; } } else { $speciallogfile = ''; } if ($this->settings['system']['mod_log_sql'] == '1') { // We are using mod_log_sql (http://www.outoforder.cc/projects/apache/mod_log_sql/) // TODO: See how we are able emulate the error_log $logfiles_text .= ' LogSQLTransferLogTable access_log' . "\n"; } else { // The normal access/error - logging is enabled $error_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log'); // Create the logfile if it does not exist (fixes #46) touch($error_log); chown($error_log, $this->settings['system']['httpuser']); chgrp($error_log, $this->settings['system']['httpgroup']); $access_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log'); // Create the logfile if it does not exist (fixes #46) touch($access_log); chown($access_log, $this->settings['system']['httpuser']); chgrp($access_log, $this->settings['system']['httpgroup']); $logfiles_text .= ' ErrorLog "' . $error_log . "\"\n"; $logfiles_text .= ' CustomLog "' . $access_log . '" combined' . "\n"; } if ($this->settings['system']['awstats_enabled'] == '1') { if ((int) $domain['parentdomainid'] == 0) { // prepare the aliases and subdomains for stats config files $server_alias = ''; $alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . $domain['id'] . '\' OR `parentdomainid` =\'' . $domain['id'] . '\''); while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) { $server_alias .= ' ' . $alias_domain['domain'] . ' '; if ($alias_domain['iswildcarddomain'] == '1') { $server_alias .= '*.' . $alias_domain['domain']; } else { if ($alias_domain['wwwserveralias'] == '1') { $server_alias .= 'www.' . $alias_domain['domain']; } else { $server_alias .= ''; } } } if ($domain['iswildcarddomain'] == '1') { $alias = '*.' . $domain['domain']; } else { if ($domain['wwwserveralias'] == '1') { $alias = 'www.' . $domain['domain']; } else { $alias = ''; } } // After inserting the AWStats information, // be sure to build the awstats conf file as well // and chown it using $awstats_params, #258 // Bug 960 + Bug 970 : Use full $domain instead of custom $awstats_params as following classes depend on the informations createAWStatsConf($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-access.log', $domain['domain'], $alias . $server_alias, $domain['customerroot'], $domain); } } return $logfiles_text; }