diff --git a/actions/admin/settings/225.logrotate.php b/actions/admin/settings/225.logrotate.php deleted file mode 100644 index 9c6b8013..00000000 --- a/actions/admin/settings/225.logrotate.php +++ /dev/null @@ -1,67 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Settings - * - */ - -return array( -'groups' => array( - 'logrotate' => array( - 'title' => $lng['logrotate'], - 'fields' => array( - 'logrotate_enabled' => array( - 'label' => $lng['logrotate_enabled'], - 'settinggroup' => 'system', - 'varname' => 'logrotate_enabled', - 'type' => 'bool', - 'default' => false, - 'save_method' => 'storeSettingField', - 'overview_option' => true - ), - 'logrotate_binary' => array( - 'label' => $lng['logrotate_binary'], - 'settinggroup' => 'system', - 'varname' => 'logrotate_binary', - 'type' => 'string', - 'default' => '/usr/sbin/logrotate', - 'save_method' => 'storeSettingField', - 'overview_option' => false - ), - 'logrotate_interval' => array( - 'label' => $lng['logrotate_interval'], - 'settinggroup' => 'system', - 'varname' => 'logrotate_interval', - 'type' => 'option', - 'default' => 'weekly', - 'option_mode' => 'one', - 'option_options' => array('daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly'), - 'save_method' => 'storeSettingField', - 'overview_option' => false - ), - 'logrotate_keep' => array( - 'label' => $lng['logrotate_keep'], - 'settinggroup' => 'system', - 'varname' => 'logrotate_keep', - 'type' => 'string', - 'default' => '4', - 'save_method' => 'storeSettingField', - 'overview_option' => false - ), - ), - ), - ), - ); - -?> \ No newline at end of file diff --git a/admin_configfiles.php b/admin_configfiles.php index 54f4d8f6..dab2e3cf 100644 --- a/admin_configfiles.php +++ b/admin_configfiles.php @@ -98,7 +98,9 @@ if($userinfo['change_serversettings'] == '1') '' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : '', '' => ($settings['system']['mod_fcgid_tmpdir'] != '') ? makeCorrectDir($settings['system']['mod_fcgid_tmpdir']) : '/tmp/', '' => makeCorrectDir(dirname(__FILE__)), - '' => makeCorrectDir($settings['system']['bindconf_directory']) + '' => makeCorrectDir($settings['system']['bindconf_directory']), + '' => $settings['system']['apachereload_command'], + '' => makeCorrectDir($settings['system']['logfiles_directory']) ); $files = ''; $configpage = ''; diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index d51a8032..914b9c9d 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -2219,3 +2219,17 @@ if (isFroxlorVersion('0.9.29.1-dev1')) { updateToVersion('0.9.29.1-dev2'); } + +if (isFroxlorVersion('0.9.29.1-dev2')) { + showUpdateStep("Updating from 0.9.29.1-dev2 to 0.9.29.1-dev3", true); + lastStepStatus(0); + + showUpdateStep("Removing old logrotate settings"); + $db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_enabled';"); + $db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_binary';"); + $db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_interval';"); + $db->query("DELETE FROM `panel_settings` WHERE `varname` = 'logrotate_keep';"); + lastStepStatus(0); + + updateToVersion('0.9.29.1-dev3'); +} diff --git a/install/updates/preconfig/0.9/preconfig_0.9.inc.php b/install/updates/preconfig/0.9/preconfig_0.9.inc.php index e732a614..75ce4c82 100644 --- a/install/updates/preconfig/0.9/preconfig_0.9.inc.php +++ b/install/updates/preconfig/0.9/preconfig_0.9.inc.php @@ -541,4 +541,11 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version) $question.= ''; eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); } + + if (versionInUpdate($current_version, '0.9.29.1-dev3')) { + $has_preconfig = true; + $description = 'The build in logrotation-feature has been removed. Please follow the configuration-instructions for your system to enable logrotating again.'; + $question = ''; + eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";"); + } } diff --git a/lib/configfiles/freebsd.inc.php b/lib/configfiles/freebsd.inc.php index dd8aa0fa..73194d2a 100644 --- a/lib/configfiles/freebsd.inc.php +++ b/lib/configfiles/freebsd.inc.php @@ -384,6 +384,22 @@ return Array( 'restart' => Array( 'sh /etc/rc.d/nscd restart' ) + ), + 'logrotate' => array( + 'label' => 'Logrotate', + 'commands_1' => array( + 'cd /usr/ports/sysutils/logrotate/', + 'make install clean clean-depends', + 'touch /etc/logrotate.d/froxlor', + 'chmod 644 /etc/logrotate.d/froxlor' + ), + 'files' => array( + 'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor' + ), + 'commands_2' => array( + '# create cronjob-entry (daily-recommended)', + '0 2 * * * /usr/local/sbin/logrotate -f /etc/logrotate.d/froxlor' + ) ) ) ) diff --git a/lib/configfiles/gentoo.inc.php b/lib/configfiles/gentoo.inc.php index 0cfc671c..80f8b239 100644 --- a/lib/configfiles/gentoo.inc.php +++ b/lib/configfiles/gentoo.inc.php @@ -416,6 +416,21 @@ milter_default_action = accept" >> /etc/postfix/main.cf', 'restart' => Array( '/etc/init.d/nscd restart' ) + ), + 'logrotate' => array( + 'label' => 'Logrotate', + 'commands_1' => array( + 'emerge -av app-admin/logrotate', + 'touch /etc/logrotate.d/froxlor', + 'chmod 644 /etc/logrotate.d/froxlor' + ), + 'files' => array( + 'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor' + ), + 'commands_2' => array( + '# emerge automatically adds a daily cronjob for logrotate', + '# you do not have to do anything else :)' + ) ) ) ) diff --git a/lib/configfiles/lucid.inc.php b/lib/configfiles/lucid.inc.php index 34b72acd..fc92f2ea 100644 --- a/lib/configfiles/lucid.inc.php +++ b/lib/configfiles/lucid.inc.php @@ -395,6 +395,21 @@ return Array( 'restart' => Array( '/etc/init.d/nscd restart' ) + ), + 'logrotate' => array( + 'label' => 'Logrotate', + 'commands_1' => array( + 'apt-get install logrotate', + 'touch /etc/logrotate.d/froxlor', + 'chmod 644 /etc/logrotate.d/froxlor' + ), + 'files' => array( + 'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor' + ), + 'commands_2' => array( + '# apt automatically adds a daily cronjob for logrotate', + '# you do not have to do anything else :)' + ) ) ) ) diff --git a/lib/configfiles/precise.inc.php b/lib/configfiles/precise.inc.php index c349d178..3a606af2 100644 --- a/lib/configfiles/precise.inc.php +++ b/lib/configfiles/precise.inc.php @@ -397,6 +397,21 @@ return Array( 'restart' => Array( '/etc/init.d/nscd restart' ) + ), + 'logrotate' => array( + 'label' => 'Logrotate', + 'commands_1' => array( + 'apt-get install logrotate', + 'touch /etc/logrotate.d/froxlor', + 'chmod 644 /etc/logrotate.d/froxlor' + ), + 'files' => array( + 'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor' + ), + 'commands_2' => array( + '# apt automatically adds a daily cronjob for logrotate', + '# you do not have to do anything else :)' + ) ) ) ) diff --git a/lib/configfiles/squeeze.inc.php b/lib/configfiles/squeeze.inc.php index c39b72b2..fac01d02 100644 --- a/lib/configfiles/squeeze.inc.php +++ b/lib/configfiles/squeeze.inc.php @@ -394,6 +394,21 @@ return Array( 'restart' => Array( '/etc/init.d/nscd restart' ) + ), + 'logrotate' => array( + 'label' => 'Logrotate', + 'commands_1' => array( + 'apt-get install logrotate', + 'touch /etc/logrotate.d/froxlor', + 'chmod 644 /etc/logrotate.d/froxlor' + ), + 'files' => array( + 'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor' + ), + 'commands_2' => array( + '# apt automatically adds a daily cronjob for logrotate', + '# you do not have to do anything else :)' + ) ) ) ) diff --git a/lib/configfiles/wheezy.inc.php b/lib/configfiles/wheezy.inc.php index b90e0e2a..8da587b9 100644 --- a/lib/configfiles/wheezy.inc.php +++ b/lib/configfiles/wheezy.inc.php @@ -398,6 +398,21 @@ return Array( '/etc/init.d/nscd restart' ) ), + 'logrotate' => array( + 'label' => 'Logrotate', + 'commands_1' => array( + 'apt-get install logrotate', + 'touch /etc/logrotate.d/froxlor', + 'chmod 644 /etc/logrotate.d/froxlor' + ), + 'files' => array( + 'etc_logrotated_froxlor' => '/etc/logrotate.d/froxlor' + ), + 'commands_2' => array( + '# apt automatically adds a daily cronjob for logrotate', + '# you do not have to do anything else :)' + ) + ), 'fcgid' => array( 'label' => 'FCGID', 'commands' => array( diff --git a/lib/tables.inc.php b/lib/tables.inc.php index 32608d87..3e663c72 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -74,6 +74,6 @@ define('PACKAGE_LOCKED', 1); define('PACKAGE_ENABLED', 2); // VERSION INFO -$version = '0.9.29.1-dev2'; +$version = '0.9.29.1-dev3'; $dbversion = '2'; $branding = ''; diff --git a/lng/english.lng.php b/lng/english.lng.php index a58f3cb6..758baaef 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1874,11 +1874,6 @@ $lng['error']['session_timeout'] = 'Value too low'; $lng['error']['session_timeout_desc'] = 'You should not set the session timeout lower than 1 minute.'; // ADDED IN FROXLOR 0.9.24-svn1 -$lng['logrotate'] = 'Logrotate'; -$lng['logrotate_enabled'] = 'Enable logrotate?'; -$lng['logrotate_binary'] = 'Path to logrotate binary:'; -$lng['logrotate_interval'] = 'Interval?'; -$lng['logrotate_keep'] = 'How many logfiles should be kept?'; $lng['admin']['assignedmax'] = 'Assigned / Max'; $lng['admin']['usedmax'] = 'Used / Max'; $lng['admin']['used'] = 'Used'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 2c0080aa..c78c2b3a 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1600,11 +1600,6 @@ $lng['error']['session_timeout'] = 'Wert zu niedrig'; $lng['error']['session_timeout_desc'] = 'Der Wert der Session-Timeout sollte nicht unter einer Minute liegen.'; // ADDED IN FROXLOR 0.9.24-svn1 -$lng['logrotate'] = 'Logrotate'; -$lng['logrotate_enabled'] = 'Logrotate aktivieren?'; -$lng['logrotate_binary'] = 'Pfad zum logrotate-binary?'; -$lng['logrotate_interval'] = 'Intervall?'; -$lng['logrotate_keep'] = 'Wie viele Logdateien sollen aufbewahrt werden?'; $lng['admin']['assignedmax'] = 'Zugewiesen / Max.'; $lng['admin']['usedmax'] = 'Benutzt / Max.'; $lng['admin']['used'] = 'Benutzt'; diff --git a/lng/zh-cn.lng.php b/lng/zh-cn.lng.php index c1f745ff..8de32875 100644 --- a/lng/zh-cn.lng.php +++ b/lng/zh-cn.lng.php @@ -477,11 +477,6 @@ $lng['traffic']['sumftp'] = 'FTP流量合计 - '; $lng['traffic']['summail'] = '邮件流量合计 - '; // ADDED IN FROXLOR 0.9.24-svn1 -$lng['logrotate'] = '转储'; -$lng['logrotate_enabled'] = '开启转储?'; -$lng['logrotate_binary'] = '转储(Logrotate)二进制路径:'; -$lng['logrotate_interval'] = '间隔?'; -$lng['logrotate_keep'] = '保留多少日志文件?'; $lng['admin']['assignedmax'] = '已指派 / 上限'; $lng['admin']['usedmax'] = '已用 / 上限'; $lng['admin']['used'] = '已用'; diff --git a/scripts/jobs/cron_traffic.php b/scripts/jobs/cron_traffic.php index efbf52ce..5b075e4c 100644 --- a/scripts/jobs/cron_traffic.php +++ b/scripts/jobs/cron_traffic.php @@ -81,7 +81,7 @@ fwrite($debugHandler, 'Traffic run started...' . "\n"); $admin_traffic = array(); $domainlist = array(); $speciallogfile_domainlist = array(); -$result_domainlist = $db->query("SELECT `id`, `domain`, `customerid`, `parentdomainid`, `speciallogfile` FROM `" . TABLE_PANEL_DOMAINS . "` ;"); +$result_domainlist = $db->query("SELECT `id`, `domain`, `customerid`, `parentdomainid`, `speciallogfile` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `aliasdomain` IS NULL AND `email_only` <> '1' ;"); while($row_domainlist = $db->fetch_array($result_domainlist)) { @@ -206,39 +206,6 @@ while ($row = $db->fetch_array($result)) { } } - // logrotate speciallogfiles - 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) { - - $logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf'; - $fh = fopen($logrotatefile, 'w'); - - $logconf = '# ' . basename($logrotatefile) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . - $settings['system']['logfiles_directory'] . $row['loginname'] .'-' . $domain . '-access.log ' . - $settings['system']['logfiles_directory'] . $row['loginname'] .'-' . $domain . '-error.log {' . "\n" . - $settings['system']['logrotate_interval'] . "\n" . - 'missingok' . "\n" . - 'rotate ' . $settings['system']['logrotate_keep'] . "\n" . - 'compress' . "\n" . - 'delaycompress' . "\n" . - 'notifempty' . "\n" . - 'create' . "\n" . - '}' . "\n"; - - fwrite($fh, $logconf); - fclose($fh); - - safe_exec(escapeshellcmd($settings['system']['logrotate_binary']) . ' ' . $logrotatefile); - - fwrite($debugHandler, ' apache::reload: reloading apache' . "\n"); - safe_exec(escapeshellcmd($settings['system']['apachereload_command'])); - } - } - reset($domainlist[$row['customerid']]); // callAwstatsGetTraffic is called ONLY HERE and @@ -253,34 +220,6 @@ while ($row = $db->fetch_array($result)) { // make the stuff readable for the customer, #258 makeChownWithNewStats($row); - - // logrotate - if ($settings['system']['logrotate_enabled'] == '1') { - fwrite($debugHandler, ' logrotate customers logs' . "\n"); - - $logrotatefile = '/tmp/froxlor_logrotate_tmpfile.conf'; - $fh = fopen($logrotatefile, 'w'); - - $logconf = '# ' . basename($logrotatefile) . "\n" . '# Created ' . date('d.m.Y H:i') . "\n" . - $settings['system']['logfiles_directory'] . $row['loginname'] . '-access.log ' . - $settings['system']['logfiles_directory'] . $row['loginname'] . '-error.log {' . "\n" . - $settings['system']['logrotate_interval'] . "\n" . - 'missingok' . "\n" . - 'rotate ' . $settings['system']['logrotate_keep'] . "\n" . - 'compress' . "\n" . - 'delaycompress' . "\n" . - 'notifempty' . "\n" . - 'create' . "\n" . - '}' . "\n"; - - fwrite($fh, $logconf); - fclose($fh); - - safe_exec(escapeshellcmd($settings['system']['logrotate_binary']) . ' ' . $logrotatefile); - - fwrite($debugHandler, ' apache::reload: reloading apache' . "\n"); - safe_exec(escapeshellcmd($settings['system']['apachereload_command'])); - } /** * Webalizer/AWStats might run for some time, so we'd better check if our database is still present diff --git a/templates/misc/configfiles/debian_squeeze/logrotate/etc_logrotated_froxlor b/templates/misc/configfiles/debian_squeeze/logrotate/etc_logrotated_froxlor new file mode 100644 index 00000000..d7f7deeb --- /dev/null +++ b/templates/misc/configfiles/debian_squeeze/logrotate/etc_logrotated_froxlor @@ -0,0 +1,16 @@ +# +# Froxlor logrotate snipet +# +*.log { + missingok + weekly + rotate 4 + compress + delaycompress + notifempty + create + sharedscripts + postrotate + > /dev/null 2>&1 || true + endscript +} diff --git a/templates/misc/configfiles/debian_wheezy/logrotate/etc_logrotated_froxlor b/templates/misc/configfiles/debian_wheezy/logrotate/etc_logrotated_froxlor new file mode 100644 index 00000000..d7f7deeb --- /dev/null +++ b/templates/misc/configfiles/debian_wheezy/logrotate/etc_logrotated_froxlor @@ -0,0 +1,16 @@ +# +# Froxlor logrotate snipet +# +*.log { + missingok + weekly + rotate 4 + compress + delaycompress + notifempty + create + sharedscripts + postrotate + > /dev/null 2>&1 || true + endscript +} diff --git a/templates/misc/configfiles/freebsd/logrotate/etc_logrotated_froxlor b/templates/misc/configfiles/freebsd/logrotate/etc_logrotated_froxlor new file mode 100644 index 00000000..d7f7deeb --- /dev/null +++ b/templates/misc/configfiles/freebsd/logrotate/etc_logrotated_froxlor @@ -0,0 +1,16 @@ +# +# Froxlor logrotate snipet +# +*.log { + missingok + weekly + rotate 4 + compress + delaycompress + notifempty + create + sharedscripts + postrotate + > /dev/null 2>&1 || true + endscript +} diff --git a/templates/misc/configfiles/gentoo/logrotate/etc_logrotated_froxlor b/templates/misc/configfiles/gentoo/logrotate/etc_logrotated_froxlor new file mode 100644 index 00000000..d7f7deeb --- /dev/null +++ b/templates/misc/configfiles/gentoo/logrotate/etc_logrotated_froxlor @@ -0,0 +1,16 @@ +# +# Froxlor logrotate snipet +# +*.log { + missingok + weekly + rotate 4 + compress + delaycompress + notifempty + create + sharedscripts + postrotate + > /dev/null 2>&1 || true + endscript +} diff --git a/templates/misc/configfiles/ubuntu_lucid/logrotate/etc_logrotated_froxlor b/templates/misc/configfiles/ubuntu_lucid/logrotate/etc_logrotated_froxlor new file mode 100644 index 00000000..d7f7deeb --- /dev/null +++ b/templates/misc/configfiles/ubuntu_lucid/logrotate/etc_logrotated_froxlor @@ -0,0 +1,16 @@ +# +# Froxlor logrotate snipet +# +*.log { + missingok + weekly + rotate 4 + compress + delaycompress + notifempty + create + sharedscripts + postrotate + > /dev/null 2>&1 || true + endscript +} diff --git a/templates/misc/configfiles/ubuntu_precise/logrotate/etc_logrotated_froxlor b/templates/misc/configfiles/ubuntu_precise/logrotate/etc_logrotated_froxlor new file mode 100644 index 00000000..d7f7deeb --- /dev/null +++ b/templates/misc/configfiles/ubuntu_precise/logrotate/etc_logrotated_froxlor @@ -0,0 +1,16 @@ +# +# Froxlor logrotate snipet +# +*.log { + missingok + weekly + rotate 4 + compress + delaycompress + notifempty + create + sharedscripts + postrotate + > /dev/null 2>&1 || true + endscript +}