root/alternc/tags/0.9.6.3/src/quota_delete

Revision 1798, 0.9 kB (checked in by nahuel, 2 years ago)

Comme php5 peut etre installé, nous utilisons le lien php qui pointe soit vers php5 soit vers php4 ( soit php6 ? ).
close: #1042

Line 
1 #!/usr/bin/php -q
2 <?php
3
4 /*
5  This script delete completely a quota from the quota managment system.
6  (this script may be used when removing an AlternC module)
7
8  $argv[1] = The named quota to create
9 */
10
11 if ($argc!=2) {
12     echo "Usage : ".$argv[0]." <quota name>
13  Delete completely a quota from the quota managment system.
14 ";
15     return 1;
16 }
17
18 $name=$argv[1];
19
20 include("/var/alternc/bureau/class/local.php");
21
22 if (!mysql_connect($L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD)) {
23     echo "Cannot connect to Mysql !\n";
24     return 1;
25 }
26
27 if (!mysql_select_db($L_MYSQL_DATABASE)) {
28     echo "Cannot connect to Mysql database $L_MYSQL_DATABASE !\n";
29     return 1;
30 }
31
32 $r=mysql_query("DELETE FROM defquotas WHERE quota='$name';");
33 if (mysql_errno()) {
34     echo "Mysql Error : ".mysql_error()."\n";
35     return 1;
36 }
37
38 $r=mysql_query("DELETE FROM quotas WHERE name='$name';");
39 if (mysql_errno()) {
40     echo "Mysql Error : ".mysql_error()."\n";
41     return 1;
42 }
43
44 return 0;
45
46 ?>
47
Note: See TracBrowser for help on using the browser.