diff --git a/actions/admin/settings/130.webserver.php b/actions/admin/settings/130.webserver.php index 241dd423..0041105d 100644 --- a/actions/admin/settings/130.webserver.php +++ b/actions/admin/settings/130.webserver.php @@ -156,15 +156,6 @@ return array( 'save_method' => 'storeSettingField', '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( 'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'], 'settinggroup' => 'defaultwebsrverrhandler', diff --git a/install/froxlor.sql b/install/froxlor.sql index cc2fc4c6..8de361dc 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -439,7 +439,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'last_tasks_run', '000000'), ('system', 'nameservers', ''), ('system', 'mxservers', ''), - ('system', 'mod_log_sql', '0'), ('system', 'mod_fcgid', '0'), ('system', 'apacheconf_vhost', '/etc/apache/vhosts.conf'), ('system', 'apacheconf_diroptions', '/etc/apache/diroptions.conf'), diff --git a/lib/functions/froxlor/function.createAWStatsConf.php b/lib/functions/froxlor/function.createAWStatsConf.php index faa1d3b1..53444aee 100644 --- a/lib/functions/froxlor/function.createAWStatsConf.php +++ b/lib/functions/froxlor/function.createAWStatsConf.php @@ -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"; $awstats_dir = makeCorrectDir($customerDocroot.'/awstats/'.$siteDomain.'/'); - if(!is_dir($awstats_dir)) - { + if (!is_dir($awstats_dir)) { safe_exec('mkdir -p '.escapeshellarg($awstats_dir)); } // chown created folder, #258 makeChownWithNewStats($awstats_params); // 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'])); } @@ -68,36 +66,23 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot ); // File names - $domain_file = makeCorrectFile($settings['system']['awstats_conf'].'/awstats.' . $siteDomain . '.conf'); $model_file = dirname(dirname(dirname(dirname(__FILE__)))); - $model_file.= '/templates/misc/awstatsmodel/'; - - if($settings['system']['mod_log_sql'] == '1') - { - $model_file.= 'awstats.froxlor.model_log_sql.conf'; - } else { - $model_file.= 'awstats.froxlor.model.conf'; - } + $model_file.= '/templates/misc/awstatsmodel/awstats.froxlor.model.conf'; $model_file = makeCorrectFile($model_file); // 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 - $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); return; } // Close the file - fclose($awstats_domain_conf); } @@ -105,17 +90,14 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot $awstats_model_conf = fopen($model_file, 'r'); // Write the header - fwrite($awstats_domain_conf, $header); fwrite($awstats_domain_conf, preg_replace($regex, $replace, $header2)); // Write the configuration file - - while(($line = fgets($awstats_model_conf, 4096)) !== false) - { - if(!preg_match('/^#/', $line) - && trim($line) != '') - { + while (($line = fgets($awstats_model_conf, 4096)) !== false) { + if (!preg_match('/^#/', $line) + && trim($line) != '' + ) { fwrite($awstats_domain_conf, preg_replace($regex, $replace, $line)); } } diff --git a/lng/bulgarian.lng.php b/lng/bulgarian.lng.php index a57abd16..09e2fcba 100644 --- a/lng/bulgarian.lng.php +++ b/lng/bulgarian.lng.php @@ -520,9 +520,6 @@ $lng['serversettings']['ftpdomain']['title'] = 'FTP акаунти @домейн $lng['serversettings']['ftpdomain']['description'] = 'Клиентите могат да създават FTP акаунти: потребител@домейн?'; $lng['panel']['back'] = 'Назад'; -// ADDED IN 1.2.16-svn12 - -$lng['serversettings']['mod_log_sql']['title'] = 'Временно запиши логовете в базата данни'; $lng['customer']['tickets'] = 'Запитвания'; diff --git a/lng/czech.lng.php b/lng/czech.lng.php index c4a8b33b..4fcbf842 100644 --- a/lng/czech.lng.php +++ b/lng/czech.lng.php @@ -522,8 +522,6 @@ $lng['panel']['back'] = 'Back'; // 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 mod_log_sql pro doèasné uložení webrequestù
Toto vyžaduje speciální konfiguraci apache!'; $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.
toto vyžaduje speciální konfiguraci apache!'; $lng['serversettings']['sendalternativemail']['title'] = 'Použij alternativní e-mailovou adresu'; diff --git a/lng/dutch.lng.php b/lng/dutch.lng.php index 70209d90..d93105d6 100644 --- a/lng/dutch.lng.php +++ b/lng/dutch.lng.php @@ -500,8 +500,6 @@ $lng['panel']['back'] = 'Back'; // 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 mod_log_sql om toegangslogs tijdelijk in de database op te slaan
Dit vereist een speciale configuratie van Apache!'; $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.
Dit vereist een aangepaste configuratie van de webserver. Alle volgende optie\'s zijn alleen geldig wanneer deze module actief is.'; $lng['serversettings']['sendalternativemail']['title'] = 'Gebruik alternatief emailadres'; diff --git a/lng/english.lng.php b/lng/english.lng.php index aaab5cb5..f4b1a8be 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -545,8 +545,6 @@ $lng['panel']['back'] = 'Back'; // 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 mod_log_sql to save webrequests temporarily
This needs a special apache-configuration!'; $lng['serversettings']['mod_fcgid']['title'] = 'Enable FCGID'; $lng['serversettings']['mod_fcgid']['description'] = 'Use this to run PHP with the corresponding useraccount.

This needs a special webserver configuration for Apache, see FCGI - handbook'; $lng['serversettings']['sendalternativemail']['title'] = 'Use alternative email-address'; diff --git a/lng/french.lng.php b/lng/french.lng.php index 58aa79ab..9ebb9ac3 100644 --- a/lng/french.lng.php +++ b/lng/french.lng.php @@ -539,8 +539,6 @@ $lng['panel']['back'] = 'Retour'; // 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 mod_log_sql pour sauvegarder temporairement les requètes Web.
Cela à besoin d\'une configuration spécifique d\'Apache !'; $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 ?
Cela à besoin d\'une configuration spécifique d\'Apache !'; $lng['serversettings']['sendalternativemail']['title'] = 'Utiliser une adresse e-mail alternative'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 82c2ff8a..9ce12c3e 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -544,8 +544,6 @@ $lng['panel']['back'] = 'Zurück'; // ADDED IN 1.2.16-svn12 -$lng['serversettings']['mod_log_sql']['title'] = 'Logs in Datenbank zwischenspeichern'; -$lng['serversettings']['mod_log_sql']['description'] = 'mod_log_sql benutzen um die Webzugriffe temporär zu speichern
Dies benötigt eine spezielle Apache-Konfiguration'; $lng['serversettings']['mod_fcgid']['title'] = 'PHP über mod_fcgid/suexec einbinden'; $lng['serversettings']['mod_fcgid']['description'] = 'PHP unter dem jeweiligen Useraccount laufen lassen.

Dies benötigt eine spezielle Webserver-Konfiguration für Apache, siehe FCGID-Handbuch.'; $lng['serversettings']['sendalternativemail']['title'] = 'Alternative E-Mail-Adresse benutzen'; diff --git a/lng/italian.lng.php b/lng/italian.lng.php index 7a0b0c30..8b67667c 100644 --- a/lng/italian.lng.php +++ b/lng/italian.lng.php @@ -532,8 +532,6 @@ $lng['panel']['back'] = 'Indietro'; // 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 mod_log_sql per salvare temporaneamente le richieste web
Questo richiede una configurazione di apache particolare!'; $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.
Questo richiede una speciale configurazione del Webserver. Tutte le opzioni seguenti sono validi solo se il modulo è abilitato.'; $lng['serversettings']['sendalternativemail']['title'] = 'Usa un\'indirizzo email alternativo'; diff --git a/lng/portugues.lng.php b/lng/portugues.lng.php index 4b79b3e2..62c3af63 100644 --- a/lng/portugues.lng.php +++ b/lng/portugues.lng.php @@ -488,7 +488,6 @@ $lng['admin']['configfiles']['choosedaemon'] = 'Escolha um daemon'; $lng['serversettings']['ftpdomain']['title'] = 'Contas FTP @domínio'; $lng['serversettings']['ftpdomain']['description'] = 'Clientes podem criar contas de FTP user@domíniodocliente?'; $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']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.
This needs a special Apache configuration. All following options are only valid if the module is enabled.'; $lng['serversettings']['sendalternativemail']['title'] = 'Utilize endereço de e-mail alternativo'; diff --git a/lng/swedish.lng.php b/lng/swedish.lng.php index ce7287fc..83cfbb38 100644 --- a/lng/swedish.lng.php +++ b/lng/swedish.lng.php @@ -518,8 +518,6 @@ $lng['panel']['back'] = 'Tillbaka'; // 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 mod_log_sql för att spara webfrågor tillfälligt
Detta behöver en special apache-configuration!'; $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.
Denna inställning behöver en speciell apache-konfiguration!'; $lng['serversettings']['sendalternativemail']['title'] = 'Använd en alternativ E-postadress'; diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index 064bd086..dc59a65d 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -537,45 +537,31 @@ class apache { $stats_text = ''; - if($domain['speciallogfile'] == '1' - && $this->settings['system']['mod_log_sql'] != '1') - { - if($domain['parentdomainid'] == '0') - { - if($this->settings['system']['awstats_enabled'] == '1') - { + if($domain['speciallogfile'] == '1') { + + if ($domain['parentdomainid'] == '0') { + + if ($this->settings['system']['awstats_enabled'] == '1') { $stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['domain']) . '"' . "\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"; } - } - else - { - if($this->settings['system']['awstats_enabled'] == '1') - { + } else { + + if ($this->settings['system']['awstats_enabled'] == '1') { $stats_text.= ' Alias /awstats "' . makeCorrectFile($domain['customerroot'] . '/awstats/' . $domain['parentdomain']) . '"' . "\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"; } } - } - else - { - if($domain['customerroot'] != $domain['documentroot']) - { - if($this->settings['system']['awstats_enabled'] == '1') - { + } else { + 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-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n"; - } - else - { + } else { $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/ // also, the awstats-icons are someplace else too! // -> 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-icon "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '"' . "\n"; } @@ -596,99 +581,65 @@ class apache /* * Lets set the logfiles */ + protected function getLogfiles($domain) { - protected function getLogfiles($domain) - { $logfiles_text = ''; - if($domain['speciallogfile'] == '1' - && $this->settings['system']['mod_log_sql'] != '1') - { - if($domain['parentdomainid'] == '0') - { + if ($domain['speciallogfile'] == '1') { + if ($domain['parentdomainid'] == '0') { $speciallogfile = '-' . $domain['domain']; - } - else - { + } else { $speciallogfile = '-' . $domain['parentdomain']; } - } - else - { + } 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 + // 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']); - $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']); - $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"; - $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) - { + 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) - { + while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) { + $server_alias.= ' ' . $alias_domain['domain'] . ' '; - if($alias_domain['iswildcarddomain'] == '1') - { + if ($alias_domain['iswildcarddomain'] == '1') { $server_alias.= '*.' . $alias_domain['domain']; - } - else - { - if($alias_domain['wwwserveralias'] == '1') - { + } else { + if ($alias_domain['wwwserveralias'] == '1') { $server_alias.= 'www.' . $alias_domain['domain']; - } - else - { + } else { $server_alias.= ''; } } } - if($domain['iswildcarddomain'] == '1') - { + if ($domain['iswildcarddomain'] == '1') { $alias = '*.' . $domain['domain']; - } - else - { - if($domain['wwwserveralias'] == '1') - { + } else { + if ($domain['wwwserveralias'] == '1') { $alias = 'www.' . $domain['domain']; - } - else - { + } else { $alias = ''; } } diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index 049181fd..68bd6c1c 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -535,91 +535,63 @@ class lighttpd return $ssl_settings; } - protected function getLogFiles($domain) - { + protected function getLogFiles($domain) { + $logfiles_text = ''; - if($domain['speciallogfile'] == '1' - && $this->settings['system']['mod_log_sql'] != '1') - { - if($domain['parentdomainid'] == '0') - { + if($domain['speciallogfile'] == '1') { + + if ($domain['parentdomainid'] == '0') { $speciallogfile = '-' . $domain['domain']; - } - else - { + } else { $speciallogfile = '-' . $domain['parentdomain']; } - } - else - { + } 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 - } - else - { - // The normal access/error - logging is enabled - // error log cannot be set conditionally see - // https://redmine.lighttpd.net/issues/665 + // The normal access/error - logging is enabled + // error log cannot be set conditionally see + // https://redmine.lighttpd.net/issues/665 - $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']); + $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.= ' accesslog.filename = "' . $access_log . '"' . "\n"; - } + $logfiles_text.= ' accesslog.filename = "' . $access_log . '"' . "\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 - $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) - { + while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) { + $server_alias.= ' ' . $alias_domain['domain'] . ' '; - if($alias_domain['iswildcarddomain'] == '1') - { + if ($alias_domain['iswildcarddomain'] == '1') { $server_alias.= '*.' . $domain['domain']; - } - else - { - if($alias_domain['wwwserveralias'] == '1') - { + } else { + if ($alias_domain['wwwserveralias'] == '1') { $server_alias.= 'www.' . $alias_domain['domain']; - } - else - { + } else { $server_alias.= ''; } } } - if($domain['iswildcarddomain'] == '1') - { + if ($domain['iswildcarddomain'] == '1') { $alias = '*.' . $domain['domain']; - } - else - { - if($domain['wwwserveralias'] == '1') - { + } else { + if ($domain['wwwserveralias'] == '1') { $alias = 'www.' . $domain['domain']; - } - else - { + } else { $alias = ''; } } @@ -876,49 +848,33 @@ class lighttpd * Lets set the text part for the stats software */ - protected function getStats($domain) - { + protected function getStats($domain) { + $stats_text = ''; - if($domain['speciallogfile'] == '1' - && $this->settings['system']['mod_log_sql'] != '1') - { - if($domain['parentdomainid'] == '0') - { - if($this->settings['system']['awstats_enabled'] == '1') - { + if ($domain['speciallogfile'] == '1') { + + if ($domain['parentdomainid'] == '0') { + if ($this->settings['system']['awstats_enabled'] == '1') { $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"; - } - else - { + } else { $stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['domain']).'/" )' . "\n"; } - } - else - { - if($this->settings['system']['awstats_enabled'] == '1') - { + } else { + if ($this->settings['system']['awstats_enabled'] == '1') { $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"; - } - else - { + } else { $stats_text.= ' alias.url = ( "/webalizer/" => "'.makeCorrectFile($domain['customerroot'] . '/webalizer/' . $domain['parentdomain']).'/" )' . "\n"; } } - } - else - { - if($domain['customerroot'] != $domain['documentroot']) - { - if($this->settings['system']['awstats_enabled'] == '1') - { + } else { + 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-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n"; - } - else - { + } else { $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/ // also, the awstats-icons are someplace else too! // -> 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-icon" => "' . makeCorrectDir($this->settings['system']['awstats_icons']) . '" )' . "\n"; } diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index 60cd5422..cce2276a 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -735,27 +735,18 @@ class nginx return $stats_text; } - /** - * @TODO mod_log_sql - */ - protected function getLogFiles($domain) - { + protected function getLogFiles($domain) { + $logfiles_text = ''; - if($domain['speciallogfile'] == '1' - && $this->settings['system']['mod_log_sql'] != '1') - { - if($domain['parentdomainid'] == '0') - { + if ($domain['speciallogfile'] == '1') { + + if ($domain['parentdomainid'] == '0') { $speciallogfile = '-' . $domain['domain']; - } - else - { + } else { $speciallogfile = '-' . $domain['parentdomain']; } - } - else - { + } else { $speciallogfile = ''; } @@ -775,50 +766,34 @@ class nginx $logfiles_text.= "\t".'access_log ' . $access_log . ' combined;' . "\n"; $logfiles_text.= "\t".'error_log ' . $error_log . ' error;' . "\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 - $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) - { + while (($alias_domain = $this->db->fetch_array($alias_domains)) !== false) { $server_alias.= ' ' . $alias_domain['domain'] . ' '; - if($alias_domain['iswildcarddomain'] == '1') - { + if ($alias_domain['iswildcarddomain'] == '1') { $server_alias.= '*.' . $domain['domain']; - } - else - { - if($alias_domain['wwwserveralias'] == '1') - { + } else { + if ($alias_domain['wwwserveralias'] == '1') { $server_alias.= 'www.' . $alias_domain['domain']; - } - else - { + } else { $server_alias.= ''; } } } - if($domain['iswildcarddomain'] == '1') - { + if ($domain['iswildcarddomain'] == '1') { $alias = '*.' . $domain['domain']; - } - else - { - if($domain['wwwserveralias'] == '1') - { + } else { + if ($domain['wwwserveralias'] == '1') { $alias = 'www.' . $domain['domain']; - } - else - { + } else { $alias = ''; } } diff --git a/scripts/jobs/cron_traffic.inc.functions.php b/scripts/jobs/cron_traffic.inc.functions.php index 0847e52a..1934b437 100644 --- a/scripts/jobs/cron_traffic.inc.functions.php +++ b/scripts/jobs/cron_traffic.inc.functions.php @@ -291,80 +291,3 @@ function callWebalizerGetTraffic($logfile, $outputdir, $caption, $usersdomainlis 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 - */ - -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; -} diff --git a/scripts/jobs/cron_traffic.php b/scripts/jobs/cron_traffic.php index a307e60f..f935facf 100644 --- a/scripts/jobs/cron_traffic.php +++ b/scripts/jobs/cron_traffic.php @@ -153,16 +153,14 @@ while($row_database = $db->fetch_array($databases)) $db_root->close(); -# We are using the file-system quota, this will speed up the diskusage - collection -if ($settings['system']['diskquota_enabled']) -{ +// We are using the file-system quota, this will speed up the diskusage - collection +if ($settings['system']['diskquota_enabled']) { $usedquota = getFilesystemQuota(); } $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 */ @@ -170,31 +168,24 @@ while($row = $db->fetch_array($result)) fwrite($debugHandler, 'http traffic for ' . $row['loginname'] . ' started...' . "\n"); $httptraffic = 0; - if(isset($domainlist[$row['customerid']]) + if (isset($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... - - if($row['standardsubdomain'] != '0') - { + if ($row['standardsubdomain'] != '0') { // ... of course we'd prefer to use the standardsubdomain ... - $caption = $domainlist[$row['customerid']][$row['standardsubdomain']]; - } - else - { + } else { // ... but if there is no standardsubdomain, we have to use the 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 + 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; break; } @@ -204,38 +195,25 @@ while($row = $db->fetch_array($result)) $httptraffic = 0; reset($domainlist[$row['customerid']]); - if(isset($speciallogfile_domainlist[$row['customerid']]) + if (isset($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']]); - 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') - { + if ($settings['system']['awstats_enabled'] == '0') { + foreach ($speciallogfile_domainlist[$row['customerid']] as $domainid => $domain) { $httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']])); } } } // logrotate speciallogfiles - if(isset($speciallogfile_domainlist[$row['customerid']]) - && is_array($speciallogfile_domainlist[$row['customerid']]) - && count($speciallogfile_domainlist[$row['customerid']]) != 0) - { + if (isset($speciallogfile_domainlist[$row['customerid']]) + && is_array($speciallogfile_domainlist[$row['customerid']]) + && count($speciallogfile_domainlist[$row['customerid']]) != 0 + ) { 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'; $fh = fopen($logrotatefile, 'w'); @@ -264,21 +242,13 @@ while($row = $db->fetch_array($result)) reset($domainlist[$row['customerid']]); - if($settings['system']['mod_log_sql'] == 1) - { - safeSQLLogfile($domainlist[$row['customerid']], $row['loginname']); - } - // callAwstatsGetTraffic is called ONLY HERE and // *not* also in the special-logfiles-loop, because the function // will iterate through all customer-domains and the awstats-configs // 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']])); - } - else - { + } else { $httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'], $row['documentroot'] . '/webalizer/', $caption, $domainlist[$row['customerid']])); } @@ -286,8 +256,7 @@ while($row = $db->fetch_array($result)) makeChownWithNewStats($row); // logrotate - if($settings['system']['logrotate_enabled'] == '1') - { + if ($settings['system']['logrotate_enabled'] == '1') { fwrite($debugHandler, ' logrotate customers logs' . "\n"); $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 */ 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"); // just in case @@ -348,8 +317,7 @@ while($row = $db->fetch_array($result)) 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'] . "'"); - if(!is_array($ftptraffic)) - { + if (!is_array($ftptraffic)) { $ftptraffic = array( 'up_bytes_sum' => 0, 'down_bytes_sum' => 0