AlternC/src/quota_delete

47 lines
934 B
Plaintext
Raw Normal View History

#!/usr/bin/php -q
<?php
/*
2010-06-02 13:32:19 +00:00
This script deletes completely a quota from the quota management system.
(this script may be used when removing an AlternC module)
$argv[1] = The named quota to create
*/
if ($argc!=2) {
echo "Usage : ".$argv[0]." <quota name>
Delete completely a quota from the quota managment system.
";
return 1;
}
$name=$argv[1];
2013-02-18 13:54:00 +00:00
include("/usr/lib/alternc/panel/class/local.php");
if (!mysql_connect($L_MYSQL_HOST,$L_MYSQL_LOGIN,$L_MYSQL_PWD)) {
echo "Cannot connect to Mysql !\n";
return 1;
}
if (!mysql_select_db($L_MYSQL_DATABASE)) {
echo "Cannot connect to Mysql database $L_MYSQL_DATABASE !\n";
return 1;
}
$r=mysql_query("DELETE FROM defquotas WHERE quota='$name';");
if (mysql_errno()) {
echo "Mysql Error : ".mysql_error()."\n";
return 1;
}
$r=mysql_query("DELETE FROM quotas WHERE name='$name';");
if (mysql_errno()) {
echo "Mysql Error : ".mysql_error()."\n";
return 1;
}
return 0;
?>