Alternc  latest
Alternc logiel libre pour l'hébergement
quota_delete
Go to the documentation of this file.
1 #!/usr/bin/php -q
2 <?php
3 
4 /*
5  This script deletes completely a quota from the quota management 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("/usr/share/alternc/panel/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 ?>