You are here

function hosting_quota_admin_defaults_form_submit in Hostmaster (Aegir) 6

Submit function for hosting_quota_admin_defaults_form

File

modules/hosting/quota/hosting_quota.admin.inc, line 75

Code

function hosting_quota_admin_defaults_form_submit($form, &$form_state) {
  foreach ($form_state['values']['quota'] as $resource => $quota) {

    // Set the default quota
    variable_set("hosting_quota_default_{$resource}", $quota);

    // Set quotas for clients that don't already have them
    $client_result = db_query('SELECT nid FROM {hosting_client} WHERE nid not in (SELECT client FROM {hosting_client_quota})');
    while ($row = db_fetch_object($client_result)) {
      hosting_quota_set_limit($row->nid, $resource, $quota);
    }
  }
}