Changeset 3339259
- Timestamp:
- 08/04/2025 08:32:40 PM (8 months ago)
- Location:
- prodigy-commerce
- Files:
-
- 14 edited
- 1 copied
-
tags/3.2.2 (copied) (copied from prodigy-commerce/trunk)
-
tags/3.2.2/README.txt (modified) (2 diffs)
-
tags/3.2.2/includes/api/v1/class-prodigy-api-product.php (modified) (3 diffs)
-
tags/3.2.2/includes/class-prodigy-cache.php (modified) (7 diffs)
-
tags/3.2.2/includes/class-prodigy.php (modified) (1 diff)
-
tags/3.2.2/includes/content/class-prodigy-request-maker.php (modified) (3 diffs)
-
tags/3.2.2/includes/models/class-prodigy-products.php (modified) (1 diff)
-
tags/3.2.2/prodigy-commerce.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/includes/api/v1/class-prodigy-api-product.php (modified) (3 diffs)
-
trunk/includes/class-prodigy-cache.php (modified) (7 diffs)
-
trunk/includes/class-prodigy.php (modified) (1 diff)
-
trunk/includes/content/class-prodigy-request-maker.php (modified) (3 diffs)
-
trunk/includes/models/class-prodigy-products.php (modified) (1 diff)
-
trunk/prodigy-commerce.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
prodigy-commerce/tags/3.2.2/README.txt
r3330343 r3339259 4 4 Requires at least: 4.6 5 5 Tested up to: 6.8 6 Stable tag: 3.2. 16 Stable tag: 3.2.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 183 183 == Changelog == 184 184 185 = 3.2.2 - 2025-08-03 = 186 * Fix product cache 187 185 188 = 3.2.1 - 2025-07-18 = 186 189 * Fix option images bug -
prodigy-commerce/tags/3.2.2/includes/api/v1/class-prodigy-api-product.php
r3302422 r3339259 3 3 namespace Prodigy\Includes\Api\V1; 4 4 5 use Prodigy\Includes\Frontend\Mappers\Prodigy_Related_Products_Data_Mapper;6 use Prodigy\Includes\Frontend\Prodigy_Product_Template_Builder;7 5 use Prodigy\Includes\Models\Prodigy_Products; 8 6 use Prodigy\Includes\Prodigy; … … 131 129 if ( isset( $product['id'] ) ) { 132 130 $this->cache->reset_product( $product['id'] ); 133 }134 $this->cache->reset_catalog();131 $this->cache->reset_catalog(); 132 } 135 133 } 136 134 … … 200 198 $response['data']['success'] = true; 201 199 $response['data']['id'] = $id_remote_product; 200 $this->cache->reset_product( $id_remote_product ); 201 $this->cache->reset_catalog(); 202 202 203 return new WP_REST_Response( $response ); 203 204 } -
prodigy-commerce/tags/3.2.2/includes/class-prodigy-cache.php
r3325128 r3339259 13 13 14 14 const PLUGIN_TAG = 'prodigy'; 15 const PRODUCT_TAG = ' product';16 const CATALOG_FILTERS_TAG = ' catalog_filters';15 const PRODUCT_TAG = '_prodigy_product_'; 16 const CATALOG_FILTERS_TAG = '_prodigy_catalog_filters_'; 17 17 const CATALOG_PRODUCTS_TAG = 'catalog_products'; 18 const ORDER_TAG = 'order'; 19 const RELATED_PRODUCT_TAG = 'related_product'; 20 const ANALYTICS_TAG = 'analytics'; 21 const PRODUCTS_SHORTCODE_TAG = 'products_shortcode'; 22 const CATEGORIES_SHORTCODE_TAG = 'categories_shortcode'; 23 const BRANDS_SHORTCODE_TAG = 'brands_shortcode'; 24 const SETTINGS_TAG = 'hosted_system_settings'; 18 const ORDER_TAG = '_prodigy_order_'; 19 const RELATED_PRODUCT_TAG = '_prodigy_related_products_'; 20 const PRODUCTS_SHORTCODE_TAG = '_prodigy_products_shortcode_'; 21 const CATEGORIES_SHORTCODE_TAG = '_prodigy_categories_shortcode_'; 22 const BRANDS_SHORTCODE_TAG = '_prodigy_brands_shortcode_'; 23 const SETTINGS_TAG = '_prodigy_hosted_system_settings_'; 25 24 const DEFAULT_EXPIRATION_TIME = 900; 26 25 const EXPIRATION_TIME_OPTION = 'pg_cache_expiration_time'; … … 55 54 56 55 /** 57 * @param string$id58 * 59 * @return string 60 */ 61 private function get_product_key( string$id ): string {56 * @param int $id 57 * 58 * @return string 59 */ 60 private function get_product_key( int $id ): string { 62 61 return $this->prefix . self::PRODUCT_TAG . md5( $id ); 63 62 } … … 95 94 * @return string 96 95 */ 97 private function get_catalog_products_key( string $filter = '' ): string {98 return $this->get_catalog_products_prefix() . md5( $filter );99 }100 101 /**102 * @param string $filter103 *104 * @return string105 */106 96 private function get_product_shortcode_key( string $filter = '' ): string { 107 97 return $this->get_products_shortcode_prefix() . md5( $filter ); … … 161 151 162 152 /** 163 * @return string 164 */ 165 private function get_catalog_products_prefix(): string { 166 return $this->prefix . self::CATALOG_PRODUCTS_TAG; 167 } 168 169 /** 170 * @param string $id 171 * 172 * @return mixed 173 */ 174 public function get_product( string $id ) { 153 * @param int $id 154 * 155 * @return mixed 156 */ 157 public function get_product( int $id ) { 175 158 return get_transient( $this->get_product_key( $id ) ); 176 159 } … … 226 209 227 210 /** 228 * @param string$id229 * @param array $product_data230 * 231 * @return bool 232 */ 233 public function set_product( string$id, array $product_data ): bool {211 * @param int $id 212 * @param array $product_data 213 * 214 * @return bool 215 */ 216 public function set_product( int $id, array $product_data ): bool { 234 217 return $this->set_cache( $this->get_product_key( $id ), $product_data, $this->set_expiration_time() ); 235 218 } … … 366 349 */ 367 350 public function reset_catalog() { 368 $this->clear( $this->get_catalog_products_prefix() );369 351 $this->clear( $this->get_catalog_filters_prefix() ); 352 $this->clear( $this->get_products_shortcode_prefix() ); 370 353 } 371 354 … … 389 372 if ( empty( $prefix ) ) { 390 373 $prefix = esc_sql( $this->prefix ); 391 $t = esc_sql( "_transient_ $prefix%" );374 $t = esc_sql( "_transient_%$prefix%" ); 392 375 } else { 393 376 $t = "%_transient_$prefix" . '%'; -
prodigy-commerce/tags/3.2.2/includes/class-prodigy.php
r3325128 r3339259 193 193 add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_prodigy_redirect_urls' ) ); 194 194 195 $this->init_wp_rocket_compatibility(); 196 } 195 $this->init_wp_rocket_compatibility();} 197 196 198 197 /** -
prodigy-commerce/tags/3.2.2/includes/content/class-prodigy-request-maker.php
r3330343 r3339259 258 258 */ 259 259 public function do_catalog_filters_request( string $query = '' ): array { 260 $hash = md5( $query ); 261 if ( ! isset( $this->catalog_filter_result[ $hash ] ) ) { 262 $filters = $this->cache->get_catalog_filters( $query ); 263 if ( isset( $filters ) && ! empty( $filters['data'] ) ) { 264 $this->catalog_filter_result[ $hash ] = $filters; 265 } else { 266 $relations_query = 'categories.children,categories.parent,tags,properties.options'; 267 $string_query = '?include=' . $relations_query . '&' . $query; 268 $filter_result = $this->cache->get_catalog_filters( $string_query ); 269 if ( ! $filter_result ) { 270 $catalog_url = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $string_query; 271 $response = $this->api_client->get_remote_content( $catalog_url ); 272 $filter_result = $this->do_process_response( $response, $catalog_url ); 273 if ( isset( $this->catalog_filter_result[ $hash ] ) && ! empty( $this->catalog_filter_result[ $hash ]['data'] ) ) { 274 $this->cache->set_catalog_filters( $this->catalog_filter_result[ $hash ], $string_query ); 275 } 276 } 277 $this->catalog_filter_result[ $hash ] = $filter_result; 278 } 279 } 280 281 return $this->catalog_filter_result[ $hash ]; 260 $cache_key = md5( $query ); 261 262 if ( isset( $this->catalog_filter_result[ $cache_key ] ) ) { 263 return $this->catalog_filter_result[ $cache_key ]; 264 } 265 266 $cached_filters = $this->cache->get_catalog_filters( $query ); 267 if ( isset( $cached_filters ) && ! empty( $cached_filters['data'] ) ) { 268 $this->catalog_filter_result[ $cache_key ] = $cached_filters; 269 return $this->catalog_filter_result[ $cache_key ]; 270 } 271 272 $relations_query = 'categories.children,categories.parent,tags,properties.options'; 273 $enhanced_query = '?include=' . $relations_query . '&' . $query; 274 $filter_result = $this->cache->get_catalog_filters( $enhanced_query ); 275 276 if ( ! $filter_result ) { 277 $catalog_url = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $enhanced_query; 278 $response = $this->api_client->get_remote_content( $catalog_url ); 279 $filter_result = $this->do_process_response( $response, $catalog_url ); 280 281 if ( isset( $filter_result ) && ! empty( $filter_result['data'] ) ) { 282 $this->cache->set_catalog_filters( $filter_result, $enhanced_query ); 283 } 284 } 285 286 $this->catalog_filter_result[ $cache_key ] = $filter_result; 287 return $this->catalog_filter_result[ $cache_key ]; 282 288 } 283 289 … … 317 323 } 318 324 319 $product_result = $this->cache->get_product( $product_url);325 $product_result = $this->cache->get_product( (int) $id_remote_product ); 320 326 if ( ! $product_result ) { 321 327 $includes = $includes ?? $this->get_default_product_includes(); … … 338 344 339 345 if ( ! empty( $product_result ) ) { 340 $this->cache->set_product( $product_url, $product_result );346 $this->cache->set_product( (int) $id_remote_product, $product_result ); 341 347 } 342 348 -
prodigy-commerce/tags/3.2.2/includes/models/class-prodigy-products.php
r3302422 r3339259 99 99 $this->set_product_relations( $post_id, $remote_id, $meta_title ); 100 100 $this->set_product_taxonomies( $post_id, $categoriesIds ); 101 $this->reset_product_cache( $post_id );102 101 } 103 102 -
prodigy-commerce/tags/3.2.2/prodigy-commerce.php
r3330343 r3339259 5 5 * Plugin URI: https://prodigycommerce.com 6 6 * Description: Provides a comprehensive set of tools to build unparalleled eCommerce experiences on WordPress. 7 * Version: 3.2. 17 * Version: 3.2.2 8 8 * Author: Prodigy Commerce 9 9 * License: GPL-2.0+ … … 17 17 use Prodigy\Includes\Prodigy_Deactivator; 18 18 19 const PRODIGY_VERSION = '3.2. 1';19 const PRODIGY_VERSION = '3.2.2'; 20 20 21 21 if ( file_exists( plugin_dir_path( __FILE__ ) . 'env.ini' ) ) { -
prodigy-commerce/trunk/README.txt
r3330343 r3339259 4 4 Requires at least: 4.6 5 5 Tested up to: 6.8 6 Stable tag: 3.2. 16 Stable tag: 3.2.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 183 183 == Changelog == 184 184 185 = 3.2.2 - 2025-08-03 = 186 * Fix product cache 187 185 188 = 3.2.1 - 2025-07-18 = 186 189 * Fix option images bug -
prodigy-commerce/trunk/includes/api/v1/class-prodigy-api-product.php
r3302422 r3339259 3 3 namespace Prodigy\Includes\Api\V1; 4 4 5 use Prodigy\Includes\Frontend\Mappers\Prodigy_Related_Products_Data_Mapper;6 use Prodigy\Includes\Frontend\Prodigy_Product_Template_Builder;7 5 use Prodigy\Includes\Models\Prodigy_Products; 8 6 use Prodigy\Includes\Prodigy; … … 131 129 if ( isset( $product['id'] ) ) { 132 130 $this->cache->reset_product( $product['id'] ); 133 }134 $this->cache->reset_catalog();131 $this->cache->reset_catalog(); 132 } 135 133 } 136 134 … … 200 198 $response['data']['success'] = true; 201 199 $response['data']['id'] = $id_remote_product; 200 $this->cache->reset_product( $id_remote_product ); 201 $this->cache->reset_catalog(); 202 202 203 return new WP_REST_Response( $response ); 203 204 } -
prodigy-commerce/trunk/includes/class-prodigy-cache.php
r3325128 r3339259 13 13 14 14 const PLUGIN_TAG = 'prodigy'; 15 const PRODUCT_TAG = ' product';16 const CATALOG_FILTERS_TAG = ' catalog_filters';15 const PRODUCT_TAG = '_prodigy_product_'; 16 const CATALOG_FILTERS_TAG = '_prodigy_catalog_filters_'; 17 17 const CATALOG_PRODUCTS_TAG = 'catalog_products'; 18 const ORDER_TAG = 'order'; 19 const RELATED_PRODUCT_TAG = 'related_product'; 20 const ANALYTICS_TAG = 'analytics'; 21 const PRODUCTS_SHORTCODE_TAG = 'products_shortcode'; 22 const CATEGORIES_SHORTCODE_TAG = 'categories_shortcode'; 23 const BRANDS_SHORTCODE_TAG = 'brands_shortcode'; 24 const SETTINGS_TAG = 'hosted_system_settings'; 18 const ORDER_TAG = '_prodigy_order_'; 19 const RELATED_PRODUCT_TAG = '_prodigy_related_products_'; 20 const PRODUCTS_SHORTCODE_TAG = '_prodigy_products_shortcode_'; 21 const CATEGORIES_SHORTCODE_TAG = '_prodigy_categories_shortcode_'; 22 const BRANDS_SHORTCODE_TAG = '_prodigy_brands_shortcode_'; 23 const SETTINGS_TAG = '_prodigy_hosted_system_settings_'; 25 24 const DEFAULT_EXPIRATION_TIME = 900; 26 25 const EXPIRATION_TIME_OPTION = 'pg_cache_expiration_time'; … … 55 54 56 55 /** 57 * @param string$id58 * 59 * @return string 60 */ 61 private function get_product_key( string$id ): string {56 * @param int $id 57 * 58 * @return string 59 */ 60 private function get_product_key( int $id ): string { 62 61 return $this->prefix . self::PRODUCT_TAG . md5( $id ); 63 62 } … … 95 94 * @return string 96 95 */ 97 private function get_catalog_products_key( string $filter = '' ): string {98 return $this->get_catalog_products_prefix() . md5( $filter );99 }100 101 /**102 * @param string $filter103 *104 * @return string105 */106 96 private function get_product_shortcode_key( string $filter = '' ): string { 107 97 return $this->get_products_shortcode_prefix() . md5( $filter ); … … 161 151 162 152 /** 163 * @return string 164 */ 165 private function get_catalog_products_prefix(): string { 166 return $this->prefix . self::CATALOG_PRODUCTS_TAG; 167 } 168 169 /** 170 * @param string $id 171 * 172 * @return mixed 173 */ 174 public function get_product( string $id ) { 153 * @param int $id 154 * 155 * @return mixed 156 */ 157 public function get_product( int $id ) { 175 158 return get_transient( $this->get_product_key( $id ) ); 176 159 } … … 226 209 227 210 /** 228 * @param string$id229 * @param array $product_data230 * 231 * @return bool 232 */ 233 public function set_product( string$id, array $product_data ): bool {211 * @param int $id 212 * @param array $product_data 213 * 214 * @return bool 215 */ 216 public function set_product( int $id, array $product_data ): bool { 234 217 return $this->set_cache( $this->get_product_key( $id ), $product_data, $this->set_expiration_time() ); 235 218 } … … 366 349 */ 367 350 public function reset_catalog() { 368 $this->clear( $this->get_catalog_products_prefix() );369 351 $this->clear( $this->get_catalog_filters_prefix() ); 352 $this->clear( $this->get_products_shortcode_prefix() ); 370 353 } 371 354 … … 389 372 if ( empty( $prefix ) ) { 390 373 $prefix = esc_sql( $this->prefix ); 391 $t = esc_sql( "_transient_ $prefix%" );374 $t = esc_sql( "_transient_%$prefix%" ); 392 375 } else { 393 376 $t = "%_transient_$prefix" . '%'; -
prodigy-commerce/trunk/includes/class-prodigy.php
r3325128 r3339259 193 193 add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_prodigy_redirect_urls' ) ); 194 194 195 $this->init_wp_rocket_compatibility(); 196 } 195 $this->init_wp_rocket_compatibility();} 197 196 198 197 /** -
prodigy-commerce/trunk/includes/content/class-prodigy-request-maker.php
r3330343 r3339259 258 258 */ 259 259 public function do_catalog_filters_request( string $query = '' ): array { 260 $hash = md5( $query ); 261 if ( ! isset( $this->catalog_filter_result[ $hash ] ) ) { 262 $filters = $this->cache->get_catalog_filters( $query ); 263 if ( isset( $filters ) && ! empty( $filters['data'] ) ) { 264 $this->catalog_filter_result[ $hash ] = $filters; 265 } else { 266 $relations_query = 'categories.children,categories.parent,tags,properties.options'; 267 $string_query = '?include=' . $relations_query . '&' . $query; 268 $filter_result = $this->cache->get_catalog_filters( $string_query ); 269 if ( ! $filter_result ) { 270 $catalog_url = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $string_query; 271 $response = $this->api_client->get_remote_content( $catalog_url ); 272 $filter_result = $this->do_process_response( $response, $catalog_url ); 273 if ( isset( $this->catalog_filter_result[ $hash ] ) && ! empty( $this->catalog_filter_result[ $hash ]['data'] ) ) { 274 $this->cache->set_catalog_filters( $this->catalog_filter_result[ $hash ], $string_query ); 275 } 276 } 277 $this->catalog_filter_result[ $hash ] = $filter_result; 278 } 279 } 280 281 return $this->catalog_filter_result[ $hash ]; 260 $cache_key = md5( $query ); 261 262 if ( isset( $this->catalog_filter_result[ $cache_key ] ) ) { 263 return $this->catalog_filter_result[ $cache_key ]; 264 } 265 266 $cached_filters = $this->cache->get_catalog_filters( $query ); 267 if ( isset( $cached_filters ) && ! empty( $cached_filters['data'] ) ) { 268 $this->catalog_filter_result[ $cache_key ] = $cached_filters; 269 return $this->catalog_filter_result[ $cache_key ]; 270 } 271 272 $relations_query = 'categories.children,categories.parent,tags,properties.options'; 273 $enhanced_query = '?include=' . $relations_query . '&' . $query; 274 $filter_result = $this->cache->get_catalog_filters( $enhanced_query ); 275 276 if ( ! $filter_result ) { 277 $catalog_url = Prodigy_Api_Client::API_PROTOCOL . PRODIGY_API_DOMAIN . Prodigy_Api_Client::CATALOG_URL . $enhanced_query; 278 $response = $this->api_client->get_remote_content( $catalog_url ); 279 $filter_result = $this->do_process_response( $response, $catalog_url ); 280 281 if ( isset( $filter_result ) && ! empty( $filter_result['data'] ) ) { 282 $this->cache->set_catalog_filters( $filter_result, $enhanced_query ); 283 } 284 } 285 286 $this->catalog_filter_result[ $cache_key ] = $filter_result; 287 return $this->catalog_filter_result[ $cache_key ]; 282 288 } 283 289 … … 317 323 } 318 324 319 $product_result = $this->cache->get_product( $product_url);325 $product_result = $this->cache->get_product( (int) $id_remote_product ); 320 326 if ( ! $product_result ) { 321 327 $includes = $includes ?? $this->get_default_product_includes(); … … 338 344 339 345 if ( ! empty( $product_result ) ) { 340 $this->cache->set_product( $product_url, $product_result );346 $this->cache->set_product( (int) $id_remote_product, $product_result ); 341 347 } 342 348 -
prodigy-commerce/trunk/includes/models/class-prodigy-products.php
r3302422 r3339259 99 99 $this->set_product_relations( $post_id, $remote_id, $meta_title ); 100 100 $this->set_product_taxonomies( $post_id, $categoriesIds ); 101 $this->reset_product_cache( $post_id );102 101 } 103 102 -
prodigy-commerce/trunk/prodigy-commerce.php
r3330343 r3339259 5 5 * Plugin URI: https://prodigycommerce.com 6 6 * Description: Provides a comprehensive set of tools to build unparalleled eCommerce experiences on WordPress. 7 * Version: 3.2. 17 * Version: 3.2.2 8 8 * Author: Prodigy Commerce 9 9 * License: GPL-2.0+ … … 17 17 use Prodigy\Includes\Prodigy_Deactivator; 18 18 19 const PRODIGY_VERSION = '3.2. 1';19 const PRODIGY_VERSION = '3.2.2'; 20 20 21 21 if ( file_exists( plugin_dir_path( __FILE__ ) . 'env.ini' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.