root/alternc/tags/0.9.7/src/spoolsize.php

Revision 1865, 1.0 kB (checked in by anarcat, 1 year ago)

remove the size_db cache, it wasn't used in the code and is fully accessible from the PHP/MySQL API

Line 
1 #!/usr/bin/php -q
2 <?php
3
4 require_once("/var/alternc/bureau/class/config_nochk.php");
5 // On déverrouile le bureau AlternC :)
6 alternc_shutdown();
7
8 echo "---------------------------\n Generating size-cache for mail accounts\n\n";
9 $r=mysql_query("SELECT * FROM mail_users WHERE alias NOT LIKE '%@%' AND alias LIKE '%\_%';");
10 while ($c=mysql_fetch_array($r)) {
11   echo $c["alias"]; flush();
12   $size=exec("/usr/lib/alternc/du.pl ".$c["path"]);
13   mysql_query("REPLACE INTO size_mail SET alias='".addslashes($c["alias"])."',size='$size';");
14   echo " done ($size KB)\n"flush();
15 }
16
17 echo "---------------------------\n Generating size-cache for web accounts\n\n";
18 $r=mysql_query("SELECT uid,login FROM membres;");
19 while ($c=mysql_fetch_array($r)) {
20   echo $c["login"]; flush();
21   $size=exec("/usr/lib/alternc/du.pl /var/alternc/html/".substr($c["login"],0,1)."/".$c["login"]);
22   mysql_query("REPLACE INTO size_web SET uid='".$c["uid"]."',size='$size';");
23   echo " done ($size KB) \n"; flush();
24 }
25
26 // On relocke le bureau pour éviter un msg d'erreur.
27 sem_acquire( $alternc_sem );
28
29 ?>
30
Note: See TracBrowser for help on using the browser.