Changeset 1046
- Timestamp:
- 09/08/04 22:12:06 (4 years ago)
- Files:
-
- trunk/alternc-awstats (modified) (4 diffs)
- trunk/awstats.template.conf (modified) (1 diff)
- trunk/bureau/admin/aws_pass.php (added)
- trunk/bureau/admin/aws_users.php (modified) (1 diff)
- trunk/bureau/class/m_aws.php (modified) (2 diffs)
- trunk/debian/postinst (modified) (3 diffs)
- trunk/debian/postrm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/alternc-awstats
r1037 r1046 2 2 . /etc/alternc/local.sh 3 3 4 #if [ -e /etc/alternc/webalizer.conf ] 5 #then 6 # . /etc/alternc/webalizer.conf 7 #fi 4 # This file specify a different ACCESSLOG when there is apachemerge in the server. 5 if [ -e /etc/alternc/webalizer.conf ] 6 then 7 . /etc/alternc/webalizer.conf 8 fi 8 9 9 10 if [ -z "$ACCESSLOG" ] … … 18 19 19 20 CACHEDIR="/var/cache/awstats" 20 TMPDNS=`mktemp -p /tmp` 21 TMPLOG=`mktemp -p /tmp` 21 TMPLOG=`/tmp/awstats.apache.log` 22 22 mkdir -p $CACHEDIR 23 23 trap cleanup 1 2 15 24 24 25 25 function cleanup { 26 rm -f $TMPDNS27 26 rm -f $TMPLOG 28 # rm -rf $CACHEDIR/*29 27 } 30 28 … … 33 31 while [ "$DOM" ] 34 32 do 35 #export LC_ALL="$LANG"36 #export LC_MESSAGES="$LANG"37 #export LANG38 33 echo "processing $DOM" 39 # first run: resolve IPs in cache 40 #grep -h " $DOM$" $ACCESSLOG | /usr/bin/webalizer -c $CACHEDIR/$DOM.conf -N 5 -D $TMPDNS - &>/dev/null 41 # second run: process the stats 34 grep -h " $DOM$" $ACCESSLOG >$TMPLOG 2>/dev/null 42 35 /usr/lib/cgi-bin/awstats.pl -config=$DOM 43 36 read DOM … … 45 38 } 46 39 47 # Clear the cache dir48 # DONT do it ! it looses all previously computed data !49 #rm -rf $CACHEDIR/*50 # Fill the cache dir (/etc dir)51 # not required: m_aws.php build it properly52 # /usr/lib/alternc/awstats.cache.php53 54 40 # Launch the stat 55 41 mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostat trunk/awstats.template.conf
r1035 r1046 34 34 # Example: "C:/WINNT/system32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log" 35 35 # 36 LogFile="/ var/log/apache/access.log"36 LogFile="/tmp/awstats.access.log" 37 37 38 38 # Put here your log format (Must match your web server config. See setup trunk/bureau/admin/aws_users.php
r1042 r1046 75 75 <tr class="lst<?php echo $col; ?>"> 76 76 <td align="center"><input type="checkbox" class="inc" id="del_<?php echo $val; ?>" name="del_<?php echo $val; ?>" value="<?php echo $val; ?>" /></td> 77 <td><a href="aws_pass ?login=<?php echo $val ?>"><?php __("Change password"); ?></a></td>77 <td><a href="aws_pass.php?login=<?php echo $val ?>"><?php __("Change password"); ?></a></td> 78 78 <td><label for="del_<?php echo $val; ?>"><?php echo $val ?></label></td> 79 79 </tr> trunk/bureau/class/m_aws.php
r1045 r1046 280 280 } 281 281 $this->_createconf($hostname); 282 mkdir($CACHEDIR."/".$hostname,0777); 282 283 return true; 283 284 } else { … … 353 354 } 354 355 if (!($this->login_exists($login,0))) { 355 $err->raise("aws",5); // Login does not exists 356 return false; 357 } 358 $db->query("SELECT login FROM aws_users WHERE login='$login';"); 359 if ($db->next_record()) { 360 $err->raise("aws",7); // Login already exists. 356 $err->raise("aws",7); // Login already not exists 361 357 return false; 362 358 } 363 359 $pass=_md5cr($pass); 364 360 $db->query("INSERT INTO aws_users (uid,login,pass) VALUES ('$cuid','$login','$pass');"); 361 return true; 362 } 363 364 /* ----------------------------------------------------------------- */ 365 function change_pass($login,$pass) { 366 global $db,$err,$cuid; 367 $err->log("aws","change_pass"); 368 369 if (!($login=$this->_check($login))) { 370 $err->raise("aws",6); // Login incorrect 371 return false; 372 } 373 if (!($this->login_exists($login))) { 374 $err->raise("aws",5); // Login does not exists 375 return false; 376 } 377 $pass=_md5cr($pass); 378 $db->query("UPDATE aws_users SET pass='$pass' WHERE login='$login';"); 365 379 return true; 366 380 } trunk/debian/postinst
r1041 r1046 3 3 # Debian alternc-awstats postinst 4 4 # Benjamin Sonntag <benjamin@alternc.org> 5 6 # Cette fonction regarde si un fichier de config ($1) a déjà reçu une modif 7 # de config, et sinon, lui ajoute la ligne voulue là où la balise le demande. 8 function configure { 9 if grep -vqs "\*\*\*AWSTATS\*\*\*" $1 10 then 11 # 1. on déplace le fichier 12 rm -f $1.alternc_awstats 13 sed -e "s/\*\*\*ALTERNC_ALIASES\*\*\*/&\\ 14 # ***AWSTATS*** \\ 15 Alias \/awstats-icons\/ \/usr\/share\/awstats\/icons\/ " <$1 >$1.alternc_awstats 16 mv -f $1.alternc_awstats $1 17 fi 18 } 19 20 5 21 6 22 # Uses debconf … … 24 40 25 41 # Compile the po files : 42 echo "Configuring apache" 43 configure /etc/apache/httpd.conf 44 echo "Configuring apache-ssl" 45 configure /etc/apache-ssl/httpd.conf 26 46 /usr/share/alternc/install/dopo.sh || true 27 47 /etc/init.d/apache reload || true … … 34 54 then 35 55 echo "menu_aws.php" >>/var/alternc/bureau/admin/menulist.txt 56 echo "you may move menu_aws.php to a better place in /var/alternc/bureau/admin/menulist.txt" 36 57 fi 37 58 trunk/debian/postrm
r1030 r1046 3 3 # Debian alternc-awstats prerm 4 4 # Benjamin Sonntag <benjamin@alternc.org> 5 # Cette fonction regarde si un fichier de config ($1) a déjà reçu une modif 6 # de config, et si oui, lui enleve les lignes voulues 7 function unconfigure { 8 if grep -qs "\*\*\*AWSTATS\*\*\*" $1 9 then 10 # 1. on déplace le fichier 11 rm -f $1.alternc_awstats 12 cat $1 | grep -v "\*\*\*AWSTATS\*\*\*" | grep -v " Alias /awstats-icon/" >$1.alternc_awstats 13 mv -f $1.alternc_awstats $1 14 fi 15 } 5 16 6 17 case "$1" in … … 14 25 # Remove any quota 15 26 /usr/lib/alternc/quota_delete aws 27 unconfigure /etc/apache/httpd.conf 28 unconfigure /etc/apache-ssl/httpd.conf 29 unconfigure /usr/share/alternc/1.0/install/etc/apache/httpd.conf 30 unconfigure /usr/share/alternc/1.0/install/etc/apache-ssl/httpd.conf 16 31 17 32 # Remove the config files
