| | |
| | | */ |
| | | |
| | | 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); |
| | |
| | | $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']; |
| | |
| | | if($last_line) file_put_contents($state_file, $last_line); |
| | | } |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // Create webalizer statistics |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | |
| | | function setConfigVar( $filename, $varName, $varValue, $append = 0 ) { |
| | | if($lines = @file($filename)) { |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // 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); |
| | |
| | | } |
| | | 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'; |
| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // Cleanup logs in master database (only the "master-server") |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | |
| | | if ($app->dbmaster == $app->db) { |
| | | /** 7 days */ |
| | | |
| | | |
| | | $tstamp = time() - (60*60*24*7); |
| | | |
| | | /* |
| | |
| | | } |
| | | } |
| | | |
| | | ######### |
| | | //######## |
| | | // function for sending notification emails |
| | | ######### |
| | | //######## |
| | | function send_notification_email($template, $placeholders, $recipients) { |
| | | global $conf; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // enforce traffic quota (run only on the "master-server") |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | |
| | | if ($app->dbmaster == $app->db) { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // send website quota warnings by email |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | |
| | | if ($app->dbmaster == $app->db) { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // send mail quota warnings by email |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | |
| | | if ($app->dbmaster == $app->db) { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // deactivate virtual servers (run only on the "master-server") |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | |
| | | if ($app->dbmaster == $app->db) { |
| | | $current_date = date('Y-m-d'); |
| | |
| | | |
| | | } |
| | | |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | // Create website backups |
| | | ####################################################################################################### |
| | | //###################################################################################################### |
| | | |
| | | $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); |
| | | $backup_dir = $server_config['backup_dir']; |
| | |
| | | $records = $app->db->queryAllRecords($sql); |
| | | if(is_array($records)) { |
| | | |
| | | include('lib/mysql_clientdb.conf'); |
| | | include 'lib/mysql_clientdb.conf'; |
| | | |
| | | foreach($records as $rec) { |
| | | |