function hosting_quota_get_usage in Hosting 7.3
Same name and namespace in other branches
- 6.2 quota/hosting_quota.module \hosting_quota_get_usage()
- 7.4 quota/hosting_quota.module \hosting_quota_get_usage()
@todo Please document this function.
See also
2 calls to hosting_quota_get_usage()
- hosting_quota_admin_client_list in quota/
hosting_quota.admin.inc - Page callback for admin/hosting/quotas
- hosting_quota_get_all_info in quota/
hosting_quota.module - @todo Please document this function.
File
- quota/
hosting_quota.module, line 118 - Implement quota's for the resource used by client.
Code
function hosting_quota_get_usage($client, $resource, $start = NULL, $end = NULL) {
$quota_usage = 0;
// Set up some default dates for the last month if necessary
if (!$start || !$end) {
$end = date('Y-m-d', mktime(0, 0, 0, date("m"), 1, date("Y")));
$start = date('Y-m-d', mktime(0, 0, 0, date("m") - 1, 1, date("Y")));
}
// Get the resource info if necessary
if (!is_array($resource)) {
$resource = hosting_quota_get($resource);
}
$resource_name = key($resource);
$resource = $resource[$resource_name];
// We're finally ready to fetch the usage info!
if ($resource['module']) {
$quota_usage = module_invoke($resource['module'], 'hosting_quota_get_usage', $client, $resource_name, $start, $end);
}
return $quota_usage;
}