REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 3.27 KB
Close
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/Internal/Caches/TaxRateVersionStringInvalidator.php
Text
Base64
<?php declare( strict_types=1 ); namespace Automattic\WooCommerce\Internal\Caches; /** * Tax rate version string invalidation handler. * * This class provides an 'invalidate' method that will invalidate * the version string for a given tax rate, which in turn invalidates * any cached REST API responses containing that tax rate. * * @since 10.6.0 */ class TaxRateVersionStringInvalidator { /** * Initialize the invalidator and register hooks. * * Hooks are only registered when both conditions are met: * - The REST API caching feature is enabled * - The backend caching setting is active * * @return void * * @since 10.6.0 * * @internal */ final public function init(): void { // We can't use FeaturesController::feature_is_enabled at this point // (before the 'init' action is triggered) because that would cause // "Translation loading for the woocommerce domain was triggered too early" warnings. if ( 'yes' !== get_option( 'woocommerce_feature_rest_api_caching_enabled' ) ) { return; } if ( 'yes' === get_option( 'woocommerce_rest_api_enable_backend_caching', 'no' ) ) { $this->register_hooks(); } } /** * Register all tax rate-related hooks. * * Registers hooks for tax rate CRUD operations fired by WC_Tax class. * * @return void */ private function register_hooks(): void { add_action( 'woocommerce_tax_rate_added', array( $this, 'handle_woocommerce_tax_rate_added' ), 10, 1 ); add_action( 'woocommerce_tax_rate_updated', array( $this, 'handle_woocommerce_tax_rate_updated' ), 10, 1 ); add_action( 'woocommerce_tax_rate_deleted', array( $this, 'handle_woocommerce_tax_rate_deleted' ), 10, 1 ); } /** * Handle the woocommerce_tax_rate_added hook. * * @param int $tax_rate_id The tax rate ID. * * @return void * * @since 10.6.0 * * @internal */ public function handle_woocommerce_tax_rate_added( $tax_rate_id ): void { $this->invalidate( (int) $tax_rate_id ); $this->invalidate_tax_rates_list(); } /** * Handle the woocommerce_tax_rate_updated hook. * * @param int $tax_rate_id The tax rate ID. * * @return void * * @since 10.6.0 * * @internal */ public function handle_woocommerce_tax_rate_updated( $tax_rate_id ): void { $this->invalidate( (int) $tax_rate_id ); $this->invalidate_tax_rates_list(); } /** * Handle the woocommerce_tax_rate_deleted hook. * * @param int $tax_rate_id The tax rate ID. * * @return void * * @since 10.6.0 * * @internal */ public function handle_woocommerce_tax_rate_deleted( $tax_rate_id ): void { $this->invalidate( (int) $tax_rate_id ); $this->invalidate_tax_rates_list(); } /** * Invalidate the tax rates list version string. * * Called when tax rates are added, updated, or deleted, * as these operations affect collection/list endpoints. * * @return void */ private function invalidate_tax_rates_list(): void { wc_get_container()->get( VersionStringGenerator::class )->delete_version( 'list_tax_rates' ); } /** * Invalidate a tax rate version string. * * @param int $tax_rate_id The tax rate ID. * * @return void * * @since 10.6.0 */ public function invalidate( int $tax_rate_id ): void { wc_get_container()->get( VersionStringGenerator::class )->delete_version( "tax_rate_{$tax_rate_id}" ); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 6
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
OrdersVersionStringInvalidator.php
9.47 KB
lrw-r--r--
2026-02-23 17:58:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ProductCache.php
3.75 KB
lrw-r--r--
2026-01-19 14:46:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ProductCacheController.php
5.11 KB
lrw-r--r--
2026-01-19 14:46:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ProductVersionStringInvalidator.php
20.41 KB
lrw-r--r--
2026-02-23 17:58:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TaxRateVersionStringInvalidator.php
3.27 KB
lrw-r--r--
2026-02-23 17:58:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
VersionStringGenerator.php
5.51 KB
lrw-r--r--
2026-02-23 17:58:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).