You are here

function hosting_quota_set_limit in Hostmaster (Aegir) 6

Set the hosting quota for a given resource.

Parameters

$client: The nid of the client node.

$resource: The machine name of the resource.

$value: The new value for the resource.

2 calls to hosting_quota_set_limit()
hosting_quota_admin_defaults_form_submit in modules/hosting/quota/hosting_quota.admin.inc
Submit function for hosting_quota_admin_defaults_form
hosting_quota_nodeapi in modules/hosting/quota/hosting_quota.module
Implements hook_nodeapi().

File

modules/hosting/quota/hosting_quota.module, line 151
Implement quota's for the resource used by client.

Code

function hosting_quota_set_limit($client, $resource, $value) {
  if (db_result(db_query("SELECT COUNT(*) FROM {hosting_client_quota} WHERE client = %d AND resource = '%s'", $client, $resource))) {
    db_query("UPDATE {hosting_client_quota} SET value = '%s' WHERE client = %d AND resource = '%s'", $value, $client, $resource);
  }
  else {
    db_query("INSERT INTO {hosting_client_quota} (client, resource, value) VALUES (%d, '%s', '%s')", $client, $resource, $value);
  }
}