Marius Cramer
2013-11-14 7fe908c50c8dbc5cc05f571dbe11d66141caacd4
server/cron_daily.php
@@ -29,8 +29,8 @@
*/
define('SCRIPT_PATH', dirname($_SERVER["SCRIPT_FILENAME"]));
require(SCRIPT_PATH."/lib/config.inc.php");
require(SCRIPT_PATH."/lib/app.inc.php");
require SCRIPT_PATH."/lib/config.inc.php";
require SCRIPT_PATH."/lib/app.inc.php";
set_time_limit(0);
ini_set('error_reporting', E_ALL & ~E_NOTICE);
@@ -43,9 +43,9 @@
$app->uses('ini_parser,file,services,getconf,system');
#######################################################################################################
//######################################################################################################
// store the mailbox statistics in the database
#######################################################################################################
//######################################################################################################
$parse_mail_log = false;
$sql = "SELECT mailuser_id,maildir FROM mail_user WHERE server_id = ".$conf['server_id'];
@@ -244,9 +244,9 @@
    if($last_line) file_put_contents($state_file, $last_line);
}
#######################################################################################################
//######################################################################################################
// Create webalizer statistics
#######################################################################################################
//######################################################################################################
function setConfigVar( $filename, $varName, $varValue, $append = 0 ) {
   if($lines = @file($filename)) {
@@ -319,9 +319,9 @@
   exec("$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir $logfile");
}
#######################################################################################################
//######################################################################################################
// Create awstats statistics
#######################################################################################################
//######################################################################################################
$sql = "SELECT domain_id, domain, document_root, web_folder, type, system_user, system_group, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') and stats_type = 'awstats' AND server_id = ".$conf['server_id'];
$records = $app->db->queryAllRecords($sql);
@@ -437,15 +437,15 @@
}
#######################################################################################################
//######################################################################################################
// Make the web logfiles directories world readable to enable ftp access
#######################################################################################################
//######################################################################################################
if(is_dir('/var/log/ispconfig/httpd')) exec('chmod +r /var/log/ispconfig/httpd/*');
#######################################################################################################
//######################################################################################################
// Manage and compress web logfiles and create traffic statistics
#######################################################################################################
//######################################################################################################
$sql = "SELECT domain_id, domain, type, document_root, web_folder, parent_domain_id FROM web_domain WHERE (type = 'vhost' or type = 'vhostsubdomain') AND server_id = ".$conf['server_id'];
$records = $app->db->queryAllRecords($sql);
@@ -531,9 +531,9 @@
}
unset($tmp_hostname);
#######################################################################################################
//######################################################################################################
// Rotate the ispconfig.log file
#######################################################################################################
//######################################################################################################
// rotate the ispconfig.log when it exceeds a size of 10 MB
$logfile = $conf['ispconfig_log_dir'].'/ispconfig.log';
@@ -556,9 +556,9 @@
   exec("cat /dev/null > $logfile");
}
#######################################################################################################
//######################################################################################################
// Cleanup website tmp directories
#######################################################################################################
//######################################################################################################
$sql = "SELECT domain_id, domain, document_root, system_user FROM web_domain WHERE server_id = ".$conf['server_id'];
$records = $app->db->queryAllRecords($sql);
@@ -572,12 +572,14 @@
   }
}
#######################################################################################################
//######################################################################################################
// Cleanup logs in master database (only the "master-server")
#######################################################################################################
//######################################################################################################
if ($app->dbmaster == $app->db) {
   /** 7 days */
   $tstamp = time() - (60*60*24*7);
   /*
@@ -642,9 +644,9 @@
   }
}
#########
//########
// function for sending notification emails
#########
//########
function send_notification_email($template, $placeholders, $recipients) {
    global $conf;
    
@@ -700,9 +702,9 @@
}
#######################################################################################################
//######################################################################################################
// enforce traffic quota (run only on the "master-server")
#######################################################################################################
//######################################################################################################
if ($app->dbmaster == $app->db) {
@@ -780,9 +782,9 @@
}
#######################################################################################################
//######################################################################################################
// send website quota warnings by email
#######################################################################################################
//######################################################################################################
if ($app->dbmaster == $app->db) {
@@ -927,9 +929,9 @@
}
#######################################################################################################
//######################################################################################################
// send mail quota warnings by email
#######################################################################################################
//######################################################################################################
if ($app->dbmaster == $app->db) {
@@ -1057,9 +1059,9 @@
}
#######################################################################################################
//######################################################################################################
// deactivate virtual servers (run only on the "master-server")
#######################################################################################################
//######################################################################################################
if ($app->dbmaster == $app->db) {
   $current_date = date('Y-m-d');
@@ -1077,9 +1079,9 @@
}
#######################################################################################################
//######################################################################################################
// Create website backups
#######################################################################################################
//######################################################################################################
$server_config = $app->getconf->get_server_config($conf['server_id'], 'server');
$backup_dir = $server_config['backup_dir'];
@@ -1215,7 +1217,7 @@
   $records = $app->db->queryAllRecords($sql);
   if(is_array($records)) {
      include('lib/mysql_clientdb.conf');
      include 'lib/mysql_clientdb.conf';
      foreach($records as $rec) {