Spécifier le bon chemin vers le accesslog

This commit is contained in:
Nahuel Angelinetti 2013-10-21 10:00:40 +00:00
parent c8f59de87a
commit f40811c559
2 changed files with 21 additions and 6 deletions

View File

@ -1,6 +1,7 @@
Include "/etc/alternc/awstats.alternc.generic.conf" Include "/etc/alternc/awstats.alternc.generic.conf"
Include "/etc/awstats/awstats.conf.local" Include "/etc/awstats/awstats.conf.local"
Include "/etc/alternc/awstats.log.alternc.conf" Include "/etc/alternc/awstats.log.alternc.conf"
LogFile="%%ALTERNC_LOGS%%/%%UID%%-%%USER%%/access.log"
SiteDomain="%%HOSTNAME%%" SiteDomain="%%HOSTNAME%%"
HostAliases="%%HOSTALIASES%%" HostAliases="%%HOSTALIASES%%"
DirData="/var/cache/awstats/%%HOSTNAME%%" DirData="/var/cache/awstats/%%HOSTNAME%%"

View File

@ -691,7 +691,7 @@ class m_aws {
* @access private * @access private
*/ */
function _createconf($id,$nochk=0) { function _createconf($id,$nochk=0) {
global $db,$err,$cuid; global $db,$err,$cuid,$L_ALTERNC_LOGS;
$s=@implode("",file($this->TEMPLATEFILE)); $s=@implode("",file($this->TEMPLATEFILE));
if (!$s) { if (!$s) {
$err->raise("aws",_("Problem to create the configuration")); $err->raise("aws",_("Problem to create the configuration"));
@ -707,23 +707,37 @@ class m_aws {
return false; return false;
} }
$db->next_record(); $db->next_record();
$uid = $db->f('uid');
$hostname=$db->f("hostname"); $hostname=$db->f("hostname");
$hostaliases=$db->f("hostaliases"); $hostaliases=$db->f("hostaliases");
$public=$db->f("public"); $public=$db->f("public");
$db->query("SELECT login FROM membres WHERE uid = '$uid'");
$db->next_record();
$username = $db->f('login');
$db->query("SELECT login FROM aws_access WHERE id='$id';"); $db->query("SELECT login FROM aws_access WHERE id='$id';");
$users=""; $users="";
while ($db->next_record()) { while ($db->next_record()) {
$users.=$db->f("login")." "; $users.=$db->f("login")." ";
} }
$s=str_replace("%%HOSTNAME%%",$hostname,$s);
$s=str_replace("%%PUBLIC%%",$public,$s); $replace_vars = array(
$s=str_replace("%%HOSTALIASES%%",$hostaliases,$s); '%%UID%%' => $uid,
$s=str_replace("%%USERS%%",$users,$s); '%%USER%%' => $username,
'%%ALTERNC_LOGS%%' => $L_ALTERNC_LOGS,
'%%PUBLIC%%' => $public,
'%%HOSTNAME%%' => $hostname,
'%%HOSTALIASES%%' => $hostaliases,
'%%USERS%%' => $users,
);
foreach ($replace_vars as $k=>$v){
$s=str_replace($k,$v,$s);
}
$f=fopen($this->CONFDIR."/awstats.".$hostname.".conf","wb"); $f=fopen($this->CONFDIR."/awstats.".$hostname.".conf","wb");
fputs($f,$s,strlen($s)); fputs($f,$s,strlen($s));
fclose($f); fclose($f);
return true; return true;
} }