Refresh dcc/pui status caches on plugin update

Since #1273 we started clearing these caches on plugin updates. But we are updating these caches only on some admin pages ( 583dea8d99/modules/ppcp-wc-gateway/src/WCGatewayModule.php (L421-L428) ) to avoid the API calls on every request in some cases, so DCC may become hidden if not visited these pages after update. Maybe we can do it more frequently now after 92ae16f99. But for now simply refreshing the caches during plugin update.
This commit is contained in:
Alex P 2023-06-25 12:50:55 +03:00
parent 583dea8d99
commit f4c3caedcf
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -278,6 +278,15 @@ class WCGatewayModule implements ModuleInterface {
$settings->set( 'products_dcc_enabled', false );
$settings->set( 'products_pui_enabled', false );
$settings->persist();
// Update caches.
$dcc_status = $c->get( 'wcgateway.helper.dcc-product-status' );
assert( $dcc_status instanceof DCCProductStatus );
$dcc_status->dcc_is_active();
$pui_status = $c->get( 'wcgateway.pay-upon-invoice-product-status' );
assert( $pui_status instanceof PayUponInvoiceProductStatus );
$pui_status->pui_is_active();
}
);