From dba68fcdf2d3e25ad1f3301fcb128edfb3da745b Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 22 Sep 2011 08:14:04 -0400
Subject: [PATCH] Bugfixes in installer and apache plugin.
---
server/cron_daily.php | 46 ++++++++++++++++++++++++++++++++--------------
1 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/server/cron_daily.php b/server/cron_daily.php
index 571a02b..7198b95 100644
--- a/server/cron_daily.php
+++ b/server/cron_daily.php
@@ -200,15 +200,15 @@
if(is_link('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log')) unlink('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
symlink($logfile,'/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
- $awmonth = date("m");
- if (date("d") == 1) {
- $awmonth = date("m")-1;
- }
-
+ $awmonth = date("n");
$awyear = date("Y");
- if (date("m") == 1) {
- $awyear = date("Y")-1;
- $awmonth = "12";
+
+ if (date("d") == 1) {
+ $awmonth = date("m")-1;
+ if (date("m") == 1) {
+ $awyear = date("Y")-1;
+ $awmonth = "12";
+ }
}
// awstats_buildstaticpages.pl -update -config=mydomain.com -lang=en -dir=/var/www/domain.com/web/stats -awstatsprog=/path/to/awstats.pl
@@ -280,6 +280,15 @@
if(@is_file($logfile)) {
unlink($logfile);
}
+
+ //* Delete older Log files, in case that we missed them before due to serverdowntimes.
+ $datepart = date('Ym',time() - 86400 * 31 * 2);
+
+ $logfile = escapeshellcmd($rec['document_root']).'/log/'.$datepart.'*-access.log.gz';
+ exec('rm -f '.$logfile);
+
+ $logfile = escapeshellcmd($rec['document_root']).'/log/'.$datepart.'*-access.log';
+ exec('rm -f '.$logfile);
}
#######################################################################################################
@@ -492,12 +501,19 @@
$web_group = $rec['system_group'];
$web_id = $rec['domain_id'];
$web_backup_dir = $backup_dir.'/web'.$web_id;
- if(!is_dir($web_backup_dir)) mkdir($web_backup_dir, 0755);
-
- chmod($web_backup_dir, 0755);
- chown($web_backup_dir, 'root');
- chgrp($web_backup_dir, 'root');
+ if(!is_dir($web_backup_dir)) mkdir($web_backup_dir, 0750);
+ chmod($web_backup_dir, 0750);
+ if(isset($server_config['backup_dir_ftpread']) && $server_config['backup_dir_ftpread'] == 'y') {
+ chown($web_backup_dir, $rec['system_user']);
+ chgrp($web_backup_dir, $rec['system_group']);
+ } else {
+ chown($web_backup_dir, 'root');
+ chgrp($web_backup_dir, 'root');
+ }
exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -group '.escapeshellarg($web_group).' -print | zip -y '.escapeshellarg($web_backup_dir.'/web.zip').' -@');
+ chown($web_backup_dir.'/web.zip', $rec['system_user']);
+ chgrp($web_backup_dir.'/web.zip', $rec['system_group']);
+ chmod($web_backup_dir.'/web.zip', 0750);
// Rename or remove old backups
$backup_copies = intval($rec['backup_copies']);
@@ -518,7 +534,9 @@
// Create backupdir symlink
if(is_link($web_path.'/backup')) unlink($web_path.'/backup');
symlink($web_backup_dir,$web_path.'/backup');
- chmod($web_path.'/backup', 0755);
+ // chmod($web_path.'/backup', 0755);
+ chown($web_path.'/backup', $rec['system_user']);
+ chgrp($web_path.'/backup', $rec['system_group']);
}
--
Gitblit v1.9.1