Alternc
3.2
Alternc logiel libre pour l'hébergement
|
Class for hosting quotas management. More...
Public Member Functions | |
m_quota () | |
Constructor. | |
hook_menu () | |
cancreate ($ressource="") | |
Check if a user can use a ressource. | |
qlist () | |
List the quota-managed services in the server array the quota names and description (translated) | |
synchronise_user_profile () | |
Synchronise the quotas of the users with the quota of the user's profile. | |
create_missing_quota_profile () | |
getquota ($ressource="", $recheck=false) | |
Return a ressource usage (u) and total quota (t) | |
setquota ($ressource, $size) | |
Set the quota for a user (and for a ressource) | |
delquotas () | |
Erase all quota information about the user. | |
getdefaults () | |
Get the default quotas as an associative array. | |
setdefaults ($newq) | |
Set the default quotas. | |
addtype ($type) | |
Add an account type for quotas. | |
listtype () | |
List for quotas. | |
deltype ($type) | |
Delete an account type for quotas. | |
addquotas () | |
Create default quotas entries for a new user. | |
display_val ($type, $value) | |
Return a quota value with its unit (when it is a space quota) in MB, GB, TB ... | |
_get_sum_sql ($sql) | |
_get_count_sql ($sql) | |
_get_size_and_record_sql ($sql) | |
get_size_web_sum_all () | |
get_size_web_sum_user ($u) | |
get_size_mail_sum_all () | |
get_size_mail_sum_domain ($dom) | |
get_size_mail_count_all () | |
get_size_mail_count_domain ($dom) | |
get_size_mail_details_domain ($dom) | |
get_size_mailman_sum_all () | |
get_size_mailman_sum_domain ($dom) | |
get_size_mailman_sum_user ($u) | |
get_size_mailman_count_all () | |
get_size_mailman_count_user ($u) | |
get_size_mailman_details_user ($u) | |
get_size_db_sum_all () | |
get_size_db_sum_user ($u) | |
get_size_db_count_all () | |
get_size_db_count_user ($u) | |
get_size_db_details_user ($u) | |
get_size_unit ($size) | |
quota_displaybar ($usage, $color_type=1) | |
hook_admin_del_member () | |
Hook function call when a user is deleted AlternC's standard function called when a user is deleted globals $cuid is the appropriate user. | |
hook_admin_add_member () | |
Hook function called when a user is created This function initialize the user's quotas. | |
alternc_export_conf () | |
Exports all the quota related information for an account. |
Data Fields | |
$disk = Array() | |
$disk_quota_enable | |
$quotas | |
$clquota |
Private Member Functions | |
dummy_for_translation () |
Class for hosting quotas management.
This class manages services' quotas for each user of AlternC. The available quotas for each service is stored in the system.quotas mysql table. The used value is computed by the class using a callback function alternc_quota_check($uid)
that may by exported by each service class.
each class may also export a function alternc_quota_names()
that returns an array with the quotas names managed by this class.
Definition at line 38 of file m_quota.php.
_get_count_sql | ( | $sql | ) |
Definition at line 419 of file m_quota.php.
References $cuid, $db, $err, and $r.
Referenced by get_size_db_count_all(), get_size_db_count_user(), get_size_mail_count_all(), get_size_mail_count_domain(), get_size_mailman_count_all(), and get_size_mailman_count_user().
_get_size_and_record_sql | ( | $sql | ) |
Definition at line 431 of file m_quota.php.
References $cuid, $db, and $err.
Referenced by get_size_db_details_user(), get_size_mail_details_domain(), and get_size_mailman_details_user().
_get_sum_sql | ( | $sql | ) |
Definition at line 407 of file m_quota.php.
References $cuid, $db, $err, and $r.
Referenced by get_size_db_sum_all(), get_size_db_sum_user(), get_size_mail_sum_all(), get_size_mailman_sum_all(), get_size_mailman_sum_domain(), get_size_mailman_sum_user(), get_size_web_sum_all(), and get_size_web_sum_user().
addquotas | ( | ) |
Create default quotas entries for a new user.
The user we are talking about is in the global $cuid.
Definition at line 364 of file m_quota.php.
References $cuid, $db, $err, $q, $res, $t, $val, addtype(), qlist(), and setquota().
Referenced by hook_admin_add_member().
addtype | ( | $type | ) |
Add an account type for quotas.
string | $type | account type to be added |
Definition at line 309 of file m_quota.php.
References $db, $err, $key, $qlist, $val, and qlist().
Referenced by addquotas(), and getdefaults().
alternc_export_conf | ( | ) |
Exports all the quota related information for an account.
private EXPERIMENTAL function ;)
Definition at line 599 of file m_quota.php.
References $db, $err, $q, and getquota().
cancreate | ( | $ressource = "" | ) |
Check if a user can use a ressource.
string | $ressource | the ressource name (a named quota) TRUE if the user can create a ressource (= is there any quota left ?) |
Definition at line 90 of file m_quota.php.
References $t, and getquota().
create_missing_quota_profile | ( | ) |
Definition at line 137 of file m_quota.php.
delquotas | ( | ) |
Erase all quota information about the user.
Definition at line 255 of file m_quota.php.
References $cuid, $db, and $err.
Referenced by hook_admin_del_member().
deltype | ( | $type | ) |
Delete an account type for quotas.
string | $type | account type to be deleted |
Definition at line 347 of file m_quota.php.
display_val | ( | $type, | |
$value | |||
) |
Return a quota value with its unit (when it is a space quota) in MB, GB, TB ...
string | $type | The quota type |
integer | $value | The quota value |
Definition at line 394 of file m_quota.php.
References $value, and format_size().
|
private |
Definition at line 59 of file m_quota.php.
get_size_db_count_all | ( | ) |
Definition at line 522 of file m_quota.php.
References _get_count_sql().
get_size_db_count_user | ( | $u | ) |
Definition at line 527 of file m_quota.php.
References _get_count_sql().
get_size_db_details_user | ( | $u | ) |
Definition at line 532 of file m_quota.php.
References _get_size_and_record_sql().
get_size_db_sum_all | ( | ) |
Definition at line 512 of file m_quota.php.
References _get_sum_sql().
get_size_db_sum_user | ( | $u | ) |
Definition at line 517 of file m_quota.php.
References _get_sum_sql().
get_size_mail_count_all | ( | ) |
Definition at line 467 of file m_quota.php.
References _get_count_sql().
get_size_mail_count_domain | ( | $dom | ) |
Definition at line 472 of file m_quota.php.
References _get_count_sql().
get_size_mail_details_domain | ( | $dom | ) |
Definition at line 477 of file m_quota.php.
References _get_size_and_record_sql().
get_size_mail_sum_all | ( | ) |
Definition at line 456 of file m_quota.php.
References _get_sum_sql().
get_size_mail_sum_domain | ( | $dom | ) |
Definition at line 461 of file m_quota.php.
References $dom.
get_size_mailman_count_all | ( | ) |
Definition at line 497 of file m_quota.php.
References _get_count_sql().
get_size_mailman_count_user | ( | $u | ) |
Definition at line 502 of file m_quota.php.
References _get_count_sql().
get_size_mailman_details_user | ( | $u | ) |
Definition at line 507 of file m_quota.php.
References _get_size_and_record_sql().
get_size_mailman_sum_all | ( | ) |
Definition at line 482 of file m_quota.php.
References _get_sum_sql().
get_size_mailman_sum_domain | ( | $dom | ) |
get_size_mailman_sum_user | ( | $u | ) |
Definition at line 492 of file m_quota.php.
References _get_sum_sql().
get_size_unit | ( | $size | ) |
Definition at line 537 of file m_quota.php.
get_size_web_sum_all | ( | ) |
Definition at line 446 of file m_quota.php.
References _get_sum_sql().
get_size_web_sum_user | ( | $u | ) |
Definition at line 451 of file m_quota.php.
References _get_sum_sql().
getdefaults | ( | ) |
Get the default quotas as an associative array.
Definition at line 267 of file m_quota.php.
getquota | ( | $ressource = "" , |
|
$recheck = false |
|||
) |
Return a ressource usage (u) and total quota (t)
string | $ressource | ressource to get quota of array the quota used and total for this ressource (or for all ressource if unspecified) |
Definition at line 155 of file m_quota.php.
References $cuid, $db, $err, $hooks, $key, $mem, $quotas, $r, $res, $val, and isset.
Referenced by alternc_export_conf(), cancreate(), hook_admin_add_member(), hook_menu(), and qlist().
hook_admin_add_member | ( | ) |
Hook function called when a user is created This function initialize the user's quotas.
globals $cuid is the appropriate user
Definition at line 586 of file m_quota.php.
References $err, addquotas(), and getquota().
hook_admin_del_member | ( | ) |
Hook function call when a user is deleted AlternC's standard function called when a user is deleted globals $cuid is the appropriate user.
Definition at line 576 of file m_quota.php.
References delquotas().
hook_menu | ( | ) |
Definition at line 63 of file m_quota.php.
References $key, $q, format_size(), getquota(), and isset.
listtype | ( | ) |
m_quota | ( | ) |
Constructor.
Definition at line 51 of file m_quota.php.
References variable_get().
qlist | ( | ) |
List the quota-managed services in the server array the quota names and description (translated)
Definition at line 100 of file m_quota.php.
References $classes, $hooks, $key, $qlist, $val, getquota(), and isset.
Referenced by addquotas(), addtype(), deltype(), and setdefaults().
quota_displaybar | ( | $usage, | |
$color_type = 1 |
|||
) |
Definition at line 552 of file m_quota.php.
setdefaults | ( | $newq | ) |
Set the default quotas.
array | associative array of quota (key=>val) |
Definition at line 288 of file m_quota.php.
setquota | ( | $ressource, | |
$size | |||
) |
Set the quota for a user (and for a ressource)
string | $ressource | ressource to set quota of |
integer | size of the quota (available or used) |
Definition at line 226 of file m_quota.php.
References $cuid, $db, $err, and isset.
Referenced by addquotas().
synchronise_user_profile | ( | ) |
Synchronise the quotas of the users with the quota of the user's profile.
If the user have a greater quota than the profile, no change. If the quota entry doesn't exist for the user, create it with the defaults value.
Definition at line 124 of file m_quota.php.
$clquota |
Definition at line 44 of file m_quota.php.
$disk = Array() |
Definition at line 40 of file m_quota.php.
$disk_quota_enable |
Definition at line 42 of file m_quota.php.
$quotas |
Definition at line 43 of file m_quota.php.
Referenced by getquota(), and setdefaults().