INTGRTNS-502: Replace local DB mailbox limit with live statistics API - #5
INTGRTNS-502: Replace local DB mailbox limit with live statistics API#5msiouti wants to merge 1 commit into
Conversation
… print_r line Replace stale local DB mailbox limit with live data from /v1beta/mailcow/statistics. - Use total_count (contracted licenses) and used_count from statistics API - Add graceful fallback to local DB if API call fails - Fix countMailBox template var to use live contracted count - Remove orphaned debug print_r/die() line in editMailbox handler Ref: INTGRTNS-502
YumeChaan
left a comment
There was a problem hiding this comment.
Please remove the unnecessary whitespace/empty lines in this file as well. It makes the actual changes a bit difficult to see.
|
|
||
| // [INTGRTNS-502] | ||
|
|
||
| 'countMailBox' => isset($statistics) && $statistics['httpcode'] == 200 ? (int)$statistics['result']->data->total_count : Capsule::table('mod_email_solution_product')->where('service_id', $params['serviceid'])->value('mailcow'), |
There was a problem hiding this comment.
$statistics is only defined inside the addMailbox POST block. Because of that, during normal ClientArea page loads this condition falls back to the local DB value instead of using the live statistics API value.
|
|
||
|
|
||
|
|
||
| function email_solution_AdminServicesTabFields(array $params) |
There was a problem hiding this comment.
AdminServicesTabFields is still using /v1beta/mailcow/orders and displaying data->total as "Total No Of Mailbox". According to the ticket, this should use /v1beta/mailcow/statistics and display total_count and used_count instead.
| { | ||
|
|
||
| try { | ||
|
|
There was a problem hiding this comment.
SuspendAccount and UnsuspendAccount are still empty stubs. The ticket asks to add a note or basic implementation, so this part is still pending.
| { | ||
|
|
||
| try { | ||
|
|
There was a problem hiding this comment.
SuspendAccount and UnsuspendAccount are still empty stubs. The ticket asks to add a note or basic implementation, so this part is still pending.
What
Replaces the stale local DB mailbox limit with live data from
GET /v1beta/mailcow/statistics.Changes
addMailboxhandler usestotal_count/used_countfrom statistics API instead of stale local DBcountMailBoxtemplate var uses live contracted countprint_r($_POST); die()debug line fromeditMailboxhandlerWhy
mod_email_solution_product.mailcowdrifts when orders are modified outside WHMCS.GET /v1beta/mailcow/statisticsalready exists and returns the correct live contracted count.Refs
Closes INTGRTNS-502 | Original: INTGRTNS-501 | Storage follow-up: INTGRTNS-503