remove mod_log_sql as planned

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-03-15 08:38:29 +01:00
parent eaba3c783a
commit cbc745ff72
17 changed files with 144 additions and 418 deletions

View File

@@ -156,15 +156,6 @@ return array(
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx') 'websrv_avail' => array('nginx')
), ),
'system_mod_log_sql' => array(
'label' => $lng['serversettings']['mod_log_sql'],
'settinggroup' => 'system',
'varname' => 'mod_log_sql',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'defaultwebsrverrhandler_enabled' => array( 'defaultwebsrverrhandler_enabled' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',

View File

@@ -439,7 +439,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'last_tasks_run', '000000'), ('system', 'last_tasks_run', '000000'),
('system', 'nameservers', ''), ('system', 'nameservers', ''),
('system', 'mxservers', ''), ('system', 'mxservers', ''),
('system', 'mod_log_sql', '0'),
('system', 'mod_fcgid', '0'), ('system', 'mod_fcgid', '0'),
('system', 'apacheconf_vhost', '/etc/apache/vhosts.conf'), ('system', 'apacheconf_vhost', '/etc/apache/vhosts.conf'),
('system', 'apacheconf_diroptions', '/etc/apache/diroptions.conf'), ('system', 'apacheconf_diroptions', '/etc/apache/diroptions.conf'),

View File

@@ -37,16 +37,14 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot
$header2 = "## Do not remove the line above! This tells Froxlor to update this configuration\n## If you wish to manually change this configuration file, remove the first line to make sure Froxlor won't rebuild this file\n## Generated for domain {SITE_DOMAIN} on " . date('l dS \of F Y h:i:s A') . "\n"; $header2 = "## Do not remove the line above! This tells Froxlor to update this configuration\n## If you wish to manually change this configuration file, remove the first line to make sure Froxlor won't rebuild this file\n## Generated for domain {SITE_DOMAIN} on " . date('l dS \of F Y h:i:s A') . "\n";
$awstats_dir = makeCorrectDir($customerDocroot.'/awstats/'.$siteDomain.'/'); $awstats_dir = makeCorrectDir($customerDocroot.'/awstats/'.$siteDomain.'/');
if(!is_dir($awstats_dir)) if (!is_dir($awstats_dir)) {
{
safe_exec('mkdir -p '.escapeshellarg($awstats_dir)); safe_exec('mkdir -p '.escapeshellarg($awstats_dir));
} }
// chown created folder, #258 // chown created folder, #258
makeChownWithNewStats($awstats_params); makeChownWithNewStats($awstats_params);
// weird but could happen... // weird but could happen...
if(!is_dir($settings['system']['awstats_conf'])) if (!is_dir($settings['system']['awstats_conf'])) {
{
safe_exec('mkdir -p '.escapeshellarg($settings['system']['awstats_conf'])); safe_exec('mkdir -p '.escapeshellarg($settings['system']['awstats_conf']));
} }
@@ -68,36 +66,23 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot
); );
// File names // File names
$domain_file = makeCorrectFile($settings['system']['awstats_conf'].'/awstats.' . $siteDomain . '.conf'); $domain_file = makeCorrectFile($settings['system']['awstats_conf'].'/awstats.' . $siteDomain . '.conf');
$model_file = dirname(dirname(dirname(dirname(__FILE__)))); $model_file = dirname(dirname(dirname(dirname(__FILE__))));
$model_file.= '/templates/misc/awstatsmodel/'; $model_file.= '/templates/misc/awstatsmodel/awstats.froxlor.model.conf';
if($settings['system']['mod_log_sql'] == '1')
{
$model_file.= 'awstats.froxlor.model_log_sql.conf';
} else {
$model_file.= 'awstats.froxlor.model.conf';
}
$model_file = makeCorrectFile($model_file); $model_file = makeCorrectFile($model_file);
// Test if the file exists // Test if the file exists
if (file_exists($domain_file)) {
if(file_exists($domain_file))
{
// Check for the generated header - if this is a manual modification we won't update // Check for the generated header - if this is a manual modification we won't update
$awstats_domain_conf = fopen($domain_file, 'r'); $awstats_domain_conf = fopen($domain_file, 'r');
if(fgets($awstats_domain_conf, strlen($header)) != $header) if (fgets($awstats_domain_conf, strlen($header)) != $header) {
{
fclose($awstats_domain_conf); fclose($awstats_domain_conf);
return; return;
} }
// Close the file // Close the file
fclose($awstats_domain_conf); fclose($awstats_domain_conf);
} }
@@ -105,17 +90,14 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot
$awstats_model_conf = fopen($model_file, 'r'); $awstats_model_conf = fopen($model_file, 'r');
// Write the header // Write the header
fwrite($awstats_domain_conf, $header); fwrite($awstats_domain_conf, $header);
fwrite($awstats_domain_conf, preg_replace($regex, $replace, $header2)); fwrite($awstats_domain_conf, preg_replace($regex, $replace, $header2));
// Write the configuration file // Write the configuration file
while (($line = fgets($awstats_model_conf, 4096)) !== false) {
while(($line = fgets($awstats_model_conf, 4096)) !== false) if (!preg_match('/^#/', $line)
{ && trim($line) != ''
if(!preg_match('/^#/', $line) ) {
&& trim($line) != '')
{
fwrite($awstats_domain_conf, preg_replace($regex, $replace, $line)); fwrite($awstats_domain_conf, preg_replace($regex, $replace, $line));
} }
} }

View File

@@ -520,9 +520,6 @@ $lng['serversettings']['ftpdomain']['title'] = 'FTP акаунти @домейн
$lng['serversettings']['ftpdomain']['description'] = 'Клиентите могат да създават FTP акаунти: потребител@домейн?'; $lng['serversettings']['ftpdomain']['description'] = 'Клиентите могат да създават FTP акаунти: потребител@домейн?';
$lng['panel']['back'] = 'Назад'; $lng['panel']['back'] = 'Назад';
// ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Временно запиши логовете в базата данни';
$lng['customer']['tickets'] = 'Запитвания'; $lng['customer']['tickets'] = 'Запитвания';

View File

@@ -522,8 +522,6 @@ $lng['panel']['back'] = 'Back';
// ADDED IN 1.2.16-svn12 // ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Doèasnì ukládat logy do databáze';
$lng['serversettings']['mod_log_sql']['description'] = 'Použít <a target="blank" href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> pro doèasné uložení webrequestù<br /><b>Toto vyžaduje speciální <a target="blank" href="http://files.syscp.org/docs/mod_log_sql/" title="mod_log_sql - documentation">konfiguraci apache</a>!</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'Includuj PHP pøes mod_fcgid/suexec'; $lng['serversettings']['mod_fcgid']['title'] = 'Includuj PHP pøes mod_fcgid/suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Použij mod_fcgid/suexec/libnss_mysql pro bì h PHP s odpovídajícím Úøivatelským Úètem.<br/><b>toto vyžaduje speciální konfiguraci apache!</b>'; $lng['serversettings']['mod_fcgid']['description'] = 'Použij mod_fcgid/suexec/libnss_mysql pro bì h PHP s odpovídajícím Úøivatelským Úètem.<br/><b>toto vyžaduje speciální konfiguraci apache!</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Použij alternativní e-mailovou adresu'; $lng['serversettings']['sendalternativemail']['title'] = 'Použij alternativní e-mailovou adresu';

View File

@@ -500,8 +500,6 @@ $lng['panel']['back'] = 'Back';
// ADDED IN 1.2.16-svn12 // ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Logs tijdelijk opslaan in de database';
$lng['serversettings']['mod_log_sql']['description'] = 'Gebruike <a target="blank" href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> om toegangslogs tijdelijk in de database op te slaan<br /><b>Dit vereist een speciale <a target="blank" href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - documentation">configuratie van Apache</a>!</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'PHP insluiten via mod_fcgid/suexec'; $lng['serversettings']['mod_fcgid']['title'] = 'PHP insluiten via mod_fcgid/suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Gebruik mod_fcgid/suexec/libnss_mysql om PHP uit te voeren onder het gebruikersaccount.<br/><b>Dit vereist een aangepaste configuratie van de webserver. Alle volgende optie\'s zijn alleen geldig wanneer deze module actief is.</b>'; $lng['serversettings']['mod_fcgid']['description'] = 'Gebruik mod_fcgid/suexec/libnss_mysql om PHP uit te voeren onder het gebruikersaccount.<br/><b>Dit vereist een aangepaste configuratie van de webserver. Alle volgende optie\'s zijn alleen geldig wanneer deze module actief is.</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Gebruik alternatief emailadres'; $lng['serversettings']['sendalternativemail']['title'] = 'Gebruik alternatief emailadres';

View File

@@ -545,8 +545,6 @@ $lng['panel']['back'] = 'Back';
// ADDED IN 1.2.16-svn12 // ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Temporary save logs in the database';
$lng['serversettings']['mod_log_sql']['description'] = 'Use <a target="blank" href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> to save webrequests temporarily<br /><b>This needs a special <a target="blank" href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - documentation">apache-configuration</a>!</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'Enable FCGID'; $lng['serversettings']['mod_fcgid']['title'] = 'Enable FCGID';
$lng['serversettings']['mod_fcgid']['description'] = 'Use this to run PHP with the corresponding useraccount.<br /><br /><b>This needs a special webserver configuration for Apache, see <a target="blank" href="http://redmine.froxlor.org/projects/froxlor/wiki/FCGID_-_handbook">FCGI - handbook</a></b>'; $lng['serversettings']['mod_fcgid']['description'] = 'Use this to run PHP with the corresponding useraccount.<br /><br /><b>This needs a special webserver configuration for Apache, see <a target="blank" href="http://redmine.froxlor.org/projects/froxlor/wiki/FCGID_-_handbook">FCGI - handbook</a></b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Use alternative email-address'; $lng['serversettings']['sendalternativemail']['title'] = 'Use alternative email-address';

View File

@@ -539,8 +539,6 @@ $lng['panel']['back'] = 'Retour';
// ADDED IN 1.2.16-svn12 // ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Sauvegarder temporairement les logs dans la base de données';
$lng['serversettings']['mod_log_sql']['description'] = 'Utiliser <a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> pour sauvegarder temporairement les requètes Web.<br /><b>Cela à besoin d\'une configuration spécifique <a href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - documentation">d\'Apache</a> !</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'Utiliser PHP par mod_fcgid / suexec'; $lng['serversettings']['mod_fcgid']['title'] = 'Utiliser PHP par mod_fcgid / suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Utiliser mod_fcgid / suexec / libnss_mysql pour lancer PHP avec le compte correspondant à l\'utilisateur ?<br/><b>Cela à besoin d\'une configuration spécifique d\'Apache !</b>'; $lng['serversettings']['mod_fcgid']['description'] = 'Utiliser mod_fcgid / suexec / libnss_mysql pour lancer PHP avec le compte correspondant à l\'utilisateur ?<br/><b>Cela à besoin d\'une configuration spécifique d\'Apache !</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Utiliser une adresse e-mail alternative'; $lng['serversettings']['sendalternativemail']['title'] = 'Utiliser une adresse e-mail alternative';

View File

@@ -544,8 +544,6 @@ $lng['panel']['back'] = 'Zurück';
// ADDED IN 1.2.16-svn12 // ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Logs in Datenbank zwischenspeichern';
$lng['serversettings']['mod_log_sql']['description'] = '<a target="blank" href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> benutzen um die Webzugriffe temporär zu speichern<br /><b>Dies benötigt eine spezielle Apache-Konfiguration</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'PHP über mod_fcgid/suexec einbinden'; $lng['serversettings']['mod_fcgid']['title'] = 'PHP über mod_fcgid/suexec einbinden';
$lng['serversettings']['mod_fcgid']['description'] = 'PHP unter dem jeweiligen Useraccount laufen lassen.<br /><br /><b>Dies benötigt eine spezielle Webserver-Konfiguration für Apache, siehe <a target="blank" href="http://redmine.froxlor.org/projects/froxlor/wiki/FCGID_-_Handbuch">FCGID-Handbuch</a>.</b>'; $lng['serversettings']['mod_fcgid']['description'] = 'PHP unter dem jeweiligen Useraccount laufen lassen.<br /><br /><b>Dies benötigt eine spezielle Webserver-Konfiguration für Apache, siehe <a target="blank" href="http://redmine.froxlor.org/projects/froxlor/wiki/FCGID_-_Handbuch">FCGID-Handbuch</a>.</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Alternative E-Mail-Adresse benutzen'; $lng['serversettings']['sendalternativemail']['title'] = 'Alternative E-Mail-Adresse benutzen';

View File

@@ -532,8 +532,6 @@ $lng['panel']['back'] = 'Indietro';
// ADDED IN 1.2.16-svn12 // ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Salva i log temporaneamente nel database';
$lng['serversettings']['mod_log_sql']['description'] = 'Usa <a target="blank" href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> per salvare temporaneamente le richieste web<br /><b>Questo richiede una <a target="blank" href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - documentation">configurazione di apache</a> particolare!</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'Includi PHP via mod_fcgid/suexec'; $lng['serversettings']['mod_fcgid']['title'] = 'Includi PHP via mod_fcgid/suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Usa mod_fcgid/suexec/libnss_mysql per avviare PHP con il corrispondente account-utente.<br/><b>Questo richiede una speciale configurazione del Webserver. Tutte le opzioni seguenti sono validi solo se il modulo è abilitato.</b>'; $lng['serversettings']['mod_fcgid']['description'] = 'Usa mod_fcgid/suexec/libnss_mysql per avviare PHP con il corrispondente account-utente.<br/><b>Questo richiede una speciale configurazione del Webserver. Tutte le opzioni seguenti sono validi solo se il modulo è abilitato.</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Usa un\'indirizzo email alternativo'; $lng['serversettings']['sendalternativemail']['title'] = 'Usa un\'indirizzo email alternativo';

View File

@@ -488,7 +488,6 @@ $lng['admin']['configfiles']['choosedaemon'] = 'Escolha um daemon';
$lng['serversettings']['ftpdomain']['title'] = 'Contas FTP @domínio'; $lng['serversettings']['ftpdomain']['title'] = 'Contas FTP @domínio';
$lng['serversettings']['ftpdomain']['description'] = 'Clientes podem criar contas de FTP user@domíniodocliente?'; $lng['serversettings']['ftpdomain']['description'] = 'Clientes podem criar contas de FTP user@domíniodocliente?';
$lng['panel']['back'] = 'Volta'; $lng['panel']['back'] = 'Volta';
$lng['serversettings']['mod_log_sql']['title'] = 'Temporariamente salva os logs no banco de dados';
$lng['serversettings']['mod_fcgid']['title'] = 'Incluir PHP via mod_fcgid/suexec'; $lng['serversettings']['mod_fcgid']['title'] = 'Incluir PHP via mod_fcgid/suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.<br/><b>This needs a special Apache configuration. All following options are only valid if the module is enabled.</b>'; $lng['serversettings']['mod_fcgid']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.<br/><b>This needs a special Apache configuration. All following options are only valid if the module is enabled.</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Utilize endereço de e-mail alternativo'; $lng['serversettings']['sendalternativemail']['title'] = 'Utilize endereço de e-mail alternativo';

View File

@@ -518,8 +518,6 @@ $lng['panel']['back'] = 'Tillbaka';
// ADDED IN 1.2.16-svn12 // ADDED IN 1.2.16-svn12
$lng['serversettings']['mod_log_sql']['title'] = 'Tillfälligt spara loggfiler i databasen';
$lng['serversettings']['mod_log_sql']['description'] = 'Använd <a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> för att spara webfrågor tillfälligt<br /><b>Detta behöver en special <a href="http://files.syscp.org/docs/mod_log_sql/" title="mod_log_sql - documentation">apache-configuration</a>!</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'Inkludera PHP via mod_fcgid/suexec'; $lng['serversettings']['mod_fcgid']['title'] = 'Inkludera PHP via mod_fcgid/suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Använd mod_fcgid/suexec/libnss_mysql för att köra PHP med tillhörande användarkonto.<br/><b>Denna inställning behöver en speciell apache-konfiguration!</b>'; $lng['serversettings']['mod_fcgid']['description'] = 'Använd mod_fcgid/suexec/libnss_mysql för att köra PHP med tillhörande användarkonto.<br/><b>Denna inställning behöver en speciell apache-konfiguration!</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Använd en alternativ E-postadress'; $lng['serversettings']['sendalternativemail']['title'] = 'Använd en alternativ E-postadress';

View File

@@ -537,45 +537,31 @@ class apache
{ {
$stats_text = ''; $stats_text = '';
if($domain['speciallogfile'] == '1' if($domain['speciallogfile'] == '1') {
&& $this->settings['system']['mod_log_sql'] != '1')
{ if ($domain['parentdomainid'] == '0') {
if($domain['parentdomainid'] == '0')
{ if ($this->settings['system']['awstats_enabled'] == '1') {
if($this->settings['system']['awstats_enabled'] == '1')
{
$stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '"' . "\n"; $stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '"' . "\n";
$stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n"; $stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n";
} } else {
else
{
$stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']) . '"' . "\n"; $stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']) . '"' . "\n";
} }
} } else {
else
{ if ($this->settings['system']['awstats_enabled'] == '1') {
if($this->settings['system']['awstats_enabled'] == '1')
{
$stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['parentdomain']) . '"' . "\n"; $stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['parentdomain']) . '"' . "\n";
$stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n"; $stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n";
} } else {
else
{
$stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['parentdomain']) . '"' . "\n"; $stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['parentdomain']) . '"' . "\n";
} }
} }
} } else {
else if ($domain['customerroot'] != $domain['documentroot']) {
{ if ($this->settings['system']['awstats_enabled'] == '1') {
if($domain['customerroot'] != $domain['documentroot'])
{
if($this->settings['system']['awstats_enabled'] == '1')
{
$stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '"' . "\n"; $stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '"' . "\n";
$stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n"; $stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n";
} } else {
else
{
$stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer') . '"' . "\n"; $stats_text.= ' Alias /webalizer "' . makeCorrectFile($domain['customerroot'] . '/webalizer') . '"' . "\n";
} }
} }
@@ -583,8 +569,7 @@ class apache
// because the stats are in /awstats/[domain], not just /awstats/ // because the stats are in /awstats/[domain], not just /awstats/
// also, the awstats-icons are someplace else too! // also, the awstats-icons are someplace else too!
// -> webalizer does not need this! // -> webalizer does not need this!
elseif($this->settings['system']['awstats_enabled'] == '1') elseif ($this->settings['system']['awstats_enabled'] == '1') {
{
$stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']) . '"' . "\n"; $stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']) . '"' . "\n";
$stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n"; $stats_text.= ' Alias /awstats-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n";
} }
@@ -596,37 +581,20 @@ class apache
/* /*
* Lets set the logfiles * Lets set the logfiles
*/ */
protected function getLogfiles($domain) {
protected function getLogfiles($domain)
{
$logfiles_text = ''; $logfiles_text = '';
if($domain['speciallogfile'] == '1' if ($domain['speciallogfile'] == '1') {
&& $this->settings['system']['mod_log_sql'] != '1') if ($domain['parentdomainid'] == '0') {
{
if($domain['parentdomainid'] == '0')
{
$speciallogfile = '-' . $domain['domain']; $speciallogfile = '-' . $domain['domain'];
} } else {
else
{
$speciallogfile = '-' . $domain['parentdomain']; $speciallogfile = '-' . $domain['parentdomain'];
} }
} } else {
else
{
$speciallogfile = ''; $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 // The normal access/error - logging is enabled
$error_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log'); $error_log = makeCorrectFile($this->settings['system']['logfiles_directory'] . $domain['loginname'] . $speciallogfile . '-error.log');
// Create the logfile if it does not exist (fixes #46) // Create the logfile if it does not exist (fixes #46)
@@ -643,52 +611,35 @@ class apache
$logfiles_text.= ' ErrorLog "' . $error_log . "\"\n"; $logfiles_text.= ' ErrorLog "' . $error_log . "\"\n";
$logfiles_text.= ' CustomLog "' . $access_log .'" combined' . "\n"; $logfiles_text.= ' CustomLog "' . $access_log .'" combined' . "\n";
} if ($this->settings['system']['awstats_enabled'] == '1') {
if ((int)$domain['parentdomainid'] == 0) {
if($this->settings['system']['awstats_enabled'] == '1')
{
if((int)$domain['parentdomainid'] == 0)
{
// prepare the aliases and subdomains for stats config files // prepare the aliases and subdomains for stats config files
$server_alias = ''; $server_alias = '';
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` $alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '`
WHERE `aliasdomain`=\'' . $domain['id'] . '\' WHERE `aliasdomain`=\'' . $domain['id'] . '\'
OR `parentdomainid` =\''. $domain['id']. '\''); OR `parentdomainid` =\''. $domain['id']. '\'');
while(($alias_domain = $this->db->fetch_array($alias_domains)) !== false) while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
{
$server_alias.= ' ' . $alias_domain['domain'] . ' '; $server_alias.= ' ' . $alias_domain['domain'] . ' ';
if($alias_domain['iswildcarddomain'] == '1') if ($alias_domain['iswildcarddomain'] == '1') {
{
$server_alias.= '*.' . $alias_domain['domain']; $server_alias.= '*.' . $alias_domain['domain'];
} } else {
else if ($alias_domain['wwwserveralias'] == '1') {
{
if($alias_domain['wwwserveralias'] == '1')
{
$server_alias.= 'www.' . $alias_domain['domain']; $server_alias.= 'www.' . $alias_domain['domain'];
} } else {
else
{
$server_alias.= ''; $server_alias.= '';
} }
} }
} }
if($domain['iswildcarddomain'] == '1') if ($domain['iswildcarddomain'] == '1') {
{
$alias = '*.' . $domain['domain']; $alias = '*.' . $domain['domain'];
} } else {
else if ($domain['wwwserveralias'] == '1') {
{
if($domain['wwwserveralias'] == '1')
{
$alias = 'www.' . $domain['domain']; $alias = 'www.' . $domain['domain'];
} } else {
else
{
$alias = ''; $alias = '';
} }
} }

View File

@@ -535,34 +535,21 @@ class lighttpd
return $ssl_settings; return $ssl_settings;
} }
protected function getLogFiles($domain) protected function getLogFiles($domain) {
{
$logfiles_text = ''; $logfiles_text = '';
if($domain['speciallogfile'] == '1' if($domain['speciallogfile'] == '1') {
&& $this->settings['system']['mod_log_sql'] != '1')
{ if ($domain['parentdomainid'] == '0') {
if($domain['parentdomainid'] == '0')
{
$speciallogfile = '-' . $domain['domain']; $speciallogfile = '-' . $domain['domain'];
} } else {
else
{
$speciallogfile = '-' . $domain['parentdomain']; $speciallogfile = '-' . $domain['parentdomain'];
} }
} } else {
else
{
$speciallogfile = ''; $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
}
else
{
// The normal access/error - logging is enabled // The normal access/error - logging is enabled
// error log cannot be set conditionally see // error log cannot be set conditionally see
// https://redmine.lighttpd.net/issues/665 // https://redmine.lighttpd.net/issues/665
@@ -574,52 +561,37 @@ class lighttpd
chgrp($access_log, $this->settings['system']['httpgroup']); chgrp($access_log, $this->settings['system']['httpgroup']);
$logfiles_text.= ' accesslog.filename = "' . $access_log . '"' . "\n"; $logfiles_text.= ' accesslog.filename = "' . $access_log . '"' . "\n";
}
if($this->settings['system']['awstats_enabled'] == '1') if ($this->settings['system']['awstats_enabled'] == '1') {
{
if((int)$domain['parentdomainid'] == 0) if ((int)$domain['parentdomainid'] == 0) {
{
// prepare the aliases and subdomains for stats config files // prepare the aliases and subdomains for stats config files
$server_alias = ''; $server_alias = '';
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` $alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '`
WHERE `aliasdomain`=\'' . $domain['id'] . '\' WHERE `aliasdomain`=\'' . $domain['id'] . '\'
OR `parentdomainid` =\''. $domain['id']. '\''); OR `parentdomainid` =\''. $domain['id']. '\'');
while(($alias_domain = $this->db->fetch_array($alias_domains)) !== false) while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
{
$server_alias.= ' ' . $alias_domain['domain'] . ' '; $server_alias.= ' ' . $alias_domain['domain'] . ' ';
if($alias_domain['iswildcarddomain'] == '1') if ($alias_domain['iswildcarddomain'] == '1') {
{
$server_alias.= '*.' . $domain['domain']; $server_alias.= '*.' . $domain['domain'];
} } else {
else if ($alias_domain['wwwserveralias'] == '1') {
{
if($alias_domain['wwwserveralias'] == '1')
{
$server_alias.= 'www.' . $alias_domain['domain']; $server_alias.= 'www.' . $alias_domain['domain'];
} } else {
else
{
$server_alias.= ''; $server_alias.= '';
} }
} }
} }
if($domain['iswildcarddomain'] == '1') if ($domain['iswildcarddomain'] == '1') {
{
$alias = '*.' . $domain['domain']; $alias = '*.' . $domain['domain'];
} } else {
else if ($domain['wwwserveralias'] == '1') {
{
if($domain['wwwserveralias'] == '1')
{
$alias = 'www.' . $domain['domain']; $alias = 'www.' . $domain['domain'];
} } else {
else
{
$alias = ''; $alias = '';
} }
} }
@@ -876,49 +848,33 @@ class lighttpd
* Lets set the text part for the stats software * Lets set the text part for the stats software
*/ */
protected function getStats($domain) protected function getStats($domain) {
{
$stats_text = ''; $stats_text = '';
if($domain['speciallogfile'] == '1' if ($domain['speciallogfile'] == '1') {
&& $this->settings['system']['mod_log_sql'] != '1')
{ if ($domain['parentdomainid'] == '0') {
if($domain['parentdomainid'] == '0') if ($this->settings['system']['awstats_enabled'] == '1') {
{
if($this->settings['system']['awstats_enabled'] == '1')
{
$stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']).'" )' . "\n"; $stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']).'" )' . "\n";
$stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n"; $stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n";
} } else {
else
{
$stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']).'/" )' . "\n"; $stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']).'/" )' . "\n";
} }
} } else {
else if ($this->settings['system']['awstats_enabled'] == '1') {
{
if($this->settings['system']['awstats_enabled'] == '1')
{
$stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['parentdomain']).'" )' . "\n"; $stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['parentdomain']).'" )' . "\n";
$stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n"; $stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n";
} } else {
else
{
$stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['parentdomain']).'/" )' . "\n"; $stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['parentdomain']).'/" )' . "\n";
} }
} }
} } else {
else if ($domain['customerroot'] != $domain['documentroot']) {
{ if ($this->settings['system']['awstats_enabled'] == '1') {
if($domain['customerroot'] != $domain['documentroot'])
{
if($this->settings['system']['awstats_enabled'] == '1')
{
$stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']).'" )' . "\n"; $stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']).'" )' . "\n";
$stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n"; $stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n";
} } else {
else
{
$stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/').'" )' . "\n"; $stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/').'" )' . "\n";
} }
} }
@@ -926,8 +882,7 @@ class lighttpd
// because the stats are in /awstats/[domain], not just /awstats/ // because the stats are in /awstats/[domain], not just /awstats/
// also, the awstats-icons are someplace else too! // also, the awstats-icons are someplace else too!
// -> webalizer does not need this! // -> webalizer does not need this!
elseif($this->settings['system']['awstats_enabled'] == '1') elseif ($this->settings['system']['awstats_enabled'] == '1') {
{
$stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']).'" )' . "\n"; $stats_text.= ' alias.url = ( "/awstats/" => "'.makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']).'" )' . "\n";
$stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n"; $stats_text.= ' alias.url += ( "/awstats-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n";
} }

View File

@@ -735,27 +735,18 @@ class nginx
return $stats_text; return $stats_text;
} }
/** protected function getLogFiles($domain) {
* @TODO mod_log_sql
*/
protected function getLogFiles($domain)
{
$logfiles_text = ''; $logfiles_text = '';
if($domain['speciallogfile'] == '1' if ($domain['speciallogfile'] == '1') {
&& $this->settings['system']['mod_log_sql'] != '1')
{ if ($domain['parentdomainid'] == '0') {
if($domain['parentdomainid'] == '0')
{
$speciallogfile = '-' . $domain['domain']; $speciallogfile = '-' . $domain['domain'];
} } else {
else
{
$speciallogfile = '-' . $domain['parentdomain']; $speciallogfile = '-' . $domain['parentdomain'];
} }
} } else {
else
{
$speciallogfile = ''; $speciallogfile = '';
} }
@@ -775,50 +766,34 @@ class nginx
$logfiles_text.= "\t".'access_log ' . $access_log . ' combined;' . "\n"; $logfiles_text.= "\t".'access_log ' . $access_log . ' combined;' . "\n";
$logfiles_text.= "\t".'error_log ' . $error_log . ' error;' . "\n"; $logfiles_text.= "\t".'error_log ' . $error_log . ' error;' . "\n";
if($this->settings['system']['awstats_enabled'] == '1') if ($this->settings['system']['awstats_enabled'] == '1') {
{ if ((int)$domain['parentdomainid'] == 0) {
if((int)$domain['parentdomainid'] == 0)
{
// prepare the aliases and subdomains for stats config files // prepare the aliases and subdomains for stats config files
$server_alias = ''; $server_alias = '';
$alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '` $alias_domains = $this->db->query('SELECT `domain`, `iswildcarddomain`, `wwwserveralias` FROM `' . TABLE_PANEL_DOMAINS . '`
WHERE `aliasdomain`=\'' . $domain['id'] . '\' WHERE `aliasdomain`=\'' . $domain['id'] . '\'
OR `parentdomainid` =\''. $domain['id']. '\''); OR `parentdomainid` =\''. $domain['id']. '\'');
while(($alias_domain = $this->db->fetch_array($alias_domains)) !== false) while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) {
{
$server_alias.= ' ' . $alias_domain['domain'] . ' '; $server_alias.= ' ' . $alias_domain['domain'] . ' ';
if($alias_domain['iswildcarddomain'] == '1') if ($alias_domain['iswildcarddomain'] == '1') {
{
$server_alias.= '*.' . $domain['domain']; $server_alias.= '*.' . $domain['domain'];
} } else {
else if ($alias_domain['wwwserveralias'] == '1') {
{
if($alias_domain['wwwserveralias'] == '1')
{
$server_alias.= 'www.' . $alias_domain['domain']; $server_alias.= 'www.' . $alias_domain['domain'];
} } else {
else
{
$server_alias.= ''; $server_alias.= '';
} }
} }
} }
if($domain['iswildcarddomain'] == '1') if ($domain['iswildcarddomain'] == '1') {
{
$alias = '*.' . $domain['domain']; $alias = '*.' . $domain['domain'];
} } else {
else if ($domain['wwwserveralias'] == '1') {
{
if($domain['wwwserveralias'] == '1')
{
$alias = 'www.' . $domain['domain']; $alias = 'www.' . $domain['domain'];
} } else {
else
{
$alias = ''; $alias = '';
} }
} }

View File

@@ -291,80 +291,3 @@ function callWebalizerGetTraffic($logfile, $outputdir, $caption, $usersdomainlis
return floatval($returnval); return floatval($returnval);
} }
/**
* This function saves the logfile written by mod_log_sql
* into a logfile webalizer can parse
*
* @param string $domain The "speciallogfile" - domain(s)
* @param string $loginname The loginname of the customer
* @return bool
*
* @author Florian Aders <eleras@syscp.org>
*/
function safeSQLLogfile($domains, $loginname)
{
global $db, $settings, $theme;
$sql = "SELECT * FROM access_log ";
$where = "WHERE virtual_host = ";
if(!is_array($domains))
{
// If it isn't an array, it's a speciallogfile-domain
$logname = $settings['system']['logfiles_directory'] . $loginname . '-' . $domains . '-access.log';
$where.= "'$domains' OR virtual_host = 'www.$domains'";
}
else
{
// If we have an array, these are all domains aggregated into a single logfile
if(count($domains) == 0)
{
// If the $omains-array is empty, this customer has only speciallogfile-
// domains, so just return, all logfiles are already written to disk
return true;
}
$logname = $settings['system']['logfiles_directory'] . $loginname . '-access.log';
// Build the "WHERE" - part of the sql-query
foreach($domains as $domain)
{
// A domain may be reached with or without the "www" in front.
$where.= "'$domain' OR virtual_host = 'www.$domain' OR virtual_host = ";
}
$where = substr($where, 0, -19);
}
// We want clean, ordered logfiles
$sql.= $where . " ORDER BY time_stamp;";
$logs = $db->query($sql);
// Don't overwrite the logfile - append the new stuff
file_put_contents($logname, "", FILE_APPEND);
while($logline = $db->fetch_array($logs))
{
// Create a "CustomLog" - line
$writelog = $logline['remote_host'] . " " . $logline['virtual_host'] . " " . $logline['remote_user'] . " ";
$writelog.= date("[d/M/Y:H:i:s O]", $logline['time_stamp']);
$writelog.= " \"" . $logline['request_method'] . " " . $logline['request_uri'] . " " . $logline['request_protocol'] . "\" ";
$writelog.= $logline['status'];
$writelog.= " " . $logline['bytes_sent'] . " \"" . $logline['referer'] . "\" \"" . $logline['agent'] . "\"\n";
file_put_contents($logname, $writelog, FILE_APPEND);
}
// Remove the just written stuff
$db->query("DELETE FROM access_log " . $where);
return true;
}

View File

@@ -153,16 +153,14 @@ while($row_database = $db->fetch_array($databases))
$db_root->close(); $db_root->close();
# We are using the file-system quota, this will speed up the diskusage - collection // We are using the file-system quota, this will speed up the diskusage - collection
if ($settings['system']['diskquota_enabled']) if ($settings['system']['diskquota_enabled']) {
{
$usedquota = getFilesystemQuota(); $usedquota = getFilesystemQuota();
} }
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` ORDER BY `customerid` ASC"); $result = $db->query("SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` ORDER BY `customerid` ASC");
while($row = $db->fetch_array($result)) while ($row = $db->fetch_array($result)) {
{
/** /**
* HTTP-Traffic * HTTP-Traffic
*/ */
@@ -170,31 +168,24 @@ while($row = $db->fetch_array($result))
fwrite($debugHandler, 'http traffic for ' . $row['loginname'] . ' started...' . "\n"); fwrite($debugHandler, 'http traffic for ' . $row['loginname'] . ' started...' . "\n");
$httptraffic = 0; $httptraffic = 0;
if(isset($domainlist[$row['customerid']]) if (isset($domainlist[$row['customerid']])
&& is_array($domainlist[$row['customerid']]) && is_array($domainlist[$row['customerid']])
&& count($domainlist[$row['customerid']]) != 0) && count($domainlist[$row['customerid']]) != 0
{ ) {
// Examining which caption to use for default webalizer stats... // Examining which caption to use for default webalizer stats...
if ($row['standardsubdomain'] != '0') {
if($row['standardsubdomain'] != '0')
{
// ... of course we'd prefer to use the standardsubdomain ... // ... of course we'd prefer to use the standardsubdomain ...
$caption = $domainlist[$row['customerid']][$row['standardsubdomain']]; $caption = $domainlist[$row['customerid']][$row['standardsubdomain']];
} } else {
else
{
// ... but if there is no standardsubdomain, we have to use the loginname ... // ... but if there is no standardsubdomain, we have to use the loginname ...
$caption = $row['loginname']; $caption = $row['loginname'];
// ... which results in non-usable links to files in the stats, so lets have a look if we find a domain which is not speciallogfiledomain // ... which results in non-usable links to files in the stats, so lets have a look if we find a domain which is not speciallogfiledomain
foreach ($domainlist[$row['customerid']] as $domainid => $domain) {
foreach($domainlist[$row['customerid']] as $domainid => $domain) if (!isset($speciallogfile_domainlist[$row['customerid']])
{ || !isset($speciallogfile_domainlist[$row['customerid']][$domainid])
if(!isset($speciallogfile_domainlist[$row['customerid']]) ) {
|| !isset($speciallogfile_domainlist[$row['customerid']][$domainid]))
{
$caption = $domain; $caption = $domain;
break; break;
} }
@@ -204,38 +195,25 @@ while($row = $db->fetch_array($result))
$httptraffic = 0; $httptraffic = 0;
reset($domainlist[$row['customerid']]); reset($domainlist[$row['customerid']]);
if(isset($speciallogfile_domainlist[$row['customerid']]) if (isset($speciallogfile_domainlist[$row['customerid']])
&& is_array($speciallogfile_domainlist[$row['customerid']]) && is_array($speciallogfile_domainlist[$row['customerid']])
&& count($speciallogfile_domainlist[$row['customerid']]) != 0) && count($speciallogfile_domainlist[$row['customerid']]) != 0
{ ) {
reset($speciallogfile_domainlist[$row['customerid']]); reset($speciallogfile_domainlist[$row['customerid']]);
foreach($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) if ($settings['system']['awstats_enabled'] == '0') {
{ foreach ($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) {
if($settings['system']['mod_log_sql'] == 1)
{
safeSQLLogfile($domain, $row['loginname']);
// Remove this domain from the domainlist - it's already analysed
// and doesn't need to be selected twice
unset($domainlist[$row['customerid']][$domainid]);
}
if($settings['system']['awstats_enabled'] == '0')
{
$httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']])); $httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']]));
} }
} }
} }
// logrotate speciallogfiles // logrotate speciallogfiles
if(isset($speciallogfile_domainlist[$row['customerid']]) if (isset($speciallogfile_domainlist[$row['customerid']])
&& is_array($speciallogfile_domainlist[$row['customerid']]) && is_array($speciallogfile_domainlist[$row['customerid']])
&& count($speciallogfile_domainlist[$row['customerid']]) != 0) && count($speciallogfile_domainlist[$row['customerid']]) != 0
{ ) {
reset($speciallogfile_domainlist[$row['customerid']]); reset($speciallogfile_domainlist[$row['customerid']]);
foreach($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) foreach ($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) {
{
$logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf'; $logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf';
$fh = fopen($logrotatefile, 'w'); $fh = fopen($logrotatefile, 'w');
@@ -264,21 +242,13 @@ while($row = $db->fetch_array($result))
reset($domainlist[$row['customerid']]); reset($domainlist[$row['customerid']]);
if($settings['system']['mod_log_sql'] == 1)
{
safeSQLLogfile($domainlist[$row['customerid']], $row['loginname']);
}
// callAwstatsGetTraffic is called ONLY HERE and // callAwstatsGetTraffic is called ONLY HERE and
// *not* also in the special-logfiles-loop, because the function // *not* also in the special-logfiles-loop, because the function
// will iterate through all customer-domains and the awstats-configs // will iterate through all customer-domains and the awstats-configs
// know the logfile-name, #246 // know the logfile-name, #246
if($settings['system']['awstats_enabled'] == '1') if ($settings['system']['awstats_enabled'] == '1') {
{
$httptraffic+= floatval(callAwstatsGetTraffic($row['customerid'], $row['documentroot'] . '/awstats/', $domainlist[$row['customerid']])); $httptraffic+= floatval(callAwstatsGetTraffic($row['customerid'], $row['documentroot'] . '/awstats/', $domainlist[$row['customerid']]));
} } else {
else
{
$httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'], $row['documentroot'] . '/webalizer/', $caption, $domainlist[$row['customerid']])); $httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'], $row['documentroot'] . '/webalizer/', $caption, $domainlist[$row['customerid']]));
} }
@@ -286,8 +256,7 @@ while($row = $db->fetch_array($result))
makeChownWithNewStats($row); makeChownWithNewStats($row);
// logrotate // logrotate
if($settings['system']['logrotate_enabled'] == '1') if ($settings['system']['logrotate_enabled'] == '1') {
{
fwrite($debugHandler, ' logrotate customers logs' . "\n"); fwrite($debugHandler, ' logrotate customers logs' . "\n");
$logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf'; $logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf';
@@ -318,8 +287,8 @@ while($row = $db->fetch_array($result))
* Webalizer/AWStats might run for some time, so we'd better check if our database is still present * Webalizer/AWStats might run for some time, so we'd better check if our database is still present
*/ */
if (empty($db->link_id) if (empty($db->link_id)
|| $db->link_id === false) || $db->link_id === false
{ ) {
fwrite($debugHandler, 'Database-connection seems to be down, trying to reconnect' . "\n"); fwrite($debugHandler, 'Database-connection seems to be down, trying to reconnect' . "\n");
// just in case // just in case
@@ -348,8 +317,7 @@ while($row = $db->fetch_array($result))
fwrite($debugHandler, 'ftp traffic for ' . $row['loginname'] . ' started...' . "\n"); fwrite($debugHandler, 'ftp traffic for ' . $row['loginname'] . ' started...' . "\n");
$ftptraffic = $db->query_first("SELECT SUM(`up_bytes`) AS `up_bytes_sum`, SUM(`down_bytes`) AS `down_bytes_sum` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$row['customerid'] . "'"); $ftptraffic = $db->query_first("SELECT SUM(`up_bytes`) AS `up_bytes_sum`, SUM(`down_bytes`) AS `down_bytes_sum` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$row['customerid'] . "'");
if(!is_array($ftptraffic)) if (!is_array($ftptraffic)) {
{
$ftptraffic = array( $ftptraffic = array(
'up_bytes_sum' => 0, 'up_bytes_sum' => 0,
'down_bytes_sum' => 0 'down_bytes_sum' => 0