#!/usr/bin/php5 * @copyright Copyright (C) 2005 Egressive Limited (www.egressive.com) * @version $Id: egawstats.php 0 2005-08-18 08:07:26Z dave $ * @package egawstats */ class Domain { /** * @var array $domain a mixed array of "name" and "values" * for the current domain. * @access private */ private $domain = array(); /** * @var array $domain_array two dimensional array containing arrays * of parsed domains. * @access private */ private $domain_array = array(); private $logger = null; public function __construct($logger) { $this->logger = $logger; $this->logger->log(__CLASS__.'->'.__FUNCTION__,PEAR_LOG_DEBUG); // domain info $this->domain_array[0]["NAME"] = "far.org.nz"; $this->domain_array[0]["ALIASES"] = array('www.far.org.nz', 'far.egressive.com'); $this->domain_array[0]["SKIP_HOST"] = "REGEX[^192\.168\.] 203.97.50.115 203.97.51.110"; // source information $this->domain_array[0]["SRC_HOST"] = "warhol.kc"; $this->domain_array[0]["SRC_PATH"] = "/home/far/logs"; $this->domain_array[0]["SRC_FILE"] = "access_log"; $this->domain_array[0]["SRC_USER"] = "root"; // destination information $this->domain_array[0]["DST_HOST"] = ""; // leave blank for localhost $this->domain_array[0]["DST_PATH"] = "/home/sites/logs/far"; $this->domain_array[0]["DST_FILE"] = "access_log"; $this->domain_array[0]["DST_USER"] = "sites"; $this->domain_array[0]["DST_GROUP"] = "sites"; } /** * print the state of the current class */ /*public function print() { }*/ /** * run the rsync that synchronises the logs on the main machine to the * copy on the machine running awstats */ private function sync_logs() { $this->logger->log(__CLASS__.'->'.__FUNCTION__,PEAR_LOG_DEBUG); //$this->domain[] /*if ($this->logger->log('testing logger',PEAR_LOG_NOTICE)) { echo "logging worked\n"; } else { echo "logging folded\n"; }*/ } /** * run the whole process... */ public function run() { $this->logger->log(__CLASS__.'->'.__FUNCTION__,PEAR_LOG_DEBUG); foreach ($this->domain_array as $this->domain) { $this->sync_logs(); } } } /* PHP ini set to local PEAR library */ ini_set('include_path', PEAR_LIB_DIR); /* Require main PEAR class and PLUM classes. */ require_once('PEAR.php'); /* include the logging functionality */ require_once('Log.php'); /* include file reading/writing functionality */ require_once('File.php'); $logger = &Log::singleton('console','','egawstats.php'); $logger->log("***** Starting egawstats.php *****",PEAR_LOG_DEBUG); $conf_filename=""; $domain = new Domain($logger); $domain->run(); $logger->log("===== Finishing egawstats.php =====",PEAR_LOG_DEBUG); ?>