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

Revision 1552, 1.4 kB (checked in by remi, 3 years ago)

do not forget to commit your final work in order to not have a broken version in the repository

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 db accounts\n\n";
18 $r=mysql_query("SELECT db FROM db;");
19 while ($c=mysql_fetch_array($r)) {
20   echo $c["db"]; flush();
21   $size=$mysql->get_db_size($c["db"]);
22   mysql_query("REPLACE INTO size_db SET db='".addslashes($c["db"])."',size='$size';");
23   echo " done ($size KB) \n"; flush();
24 }
25
26 echo "---------------------------\n Generating size-cache for web accounts\n\n";
27 $r=mysql_query("SELECT uid,login FROM membres;");
28 while ($c=mysql_fetch_array($r)) {
29   echo $c["login"]; flush();
30   $size=exec("/usr/lib/alternc/du.pl /var/alternc/html/".substr($c["login"],0,1)."/".$c["login"]);
31   mysql_query("REPLACE INTO size_web SET uid='".$c["uid"]."',size='$size';");
32   echo " done ($size KB) \n"; flush();
33 }
34
35 // On relocke le bureau pour éviter un msg d'erreur.
36 sem_acquire( $alternc_sem );
37
38 ?>
39
Note: See TracBrowser for help on using the browser.