| @@ -30,8 +30,9 @@ | ||
| 30 | 30 | public static function clear_all_cache() { |
| 31 | 31 | self::clear_data_cache(); |
| 32 | 32 | self::clear_template_cache(); |
| 33 | 33 | self::clear_plugins_cache(); |
| 34 | + self::clear_transient_cache(); | |
| 34 | 35 | } |
| 35 | 36 | /** |
| 36 | 37 | * Clear the template cache. |
| 37 | 38 | * |
| @@ -158,9 +159,9 @@ | ||
| 158 | 159 | * @param String|Null $url |
| 159 | 160 | */ |
| 160 | 161 | public static function godaddy_request( $method, $url = null ) { |
| 161 | 162 | $url = empty( $url ) ? home_url() : $url; |
| 162 | - $host = parse_url( $url, PHP_URL_HOST ); | |
| 163 | + $host = wp_parse_url( $url, PHP_URL_HOST ); | |
| 163 | 164 | $url = set_url_scheme( str_replace( $host, \WPaas\Plugin::vip(), $url ), 'http' ); |
| 164 | 165 | wp_cache_flush(); |
| 165 | 166 | update_option( 'gd_system_last_cache_flush', time() ); // purge apc. |
| 166 | 167 | wp_remote_request( |
| @@ -231,7 +232,40 @@ | ||
| 231 | 232 | foreach ( $cached_templates as $cache_key ) { |
| 232 | 233 | wp_cache_delete( $cache_key, 'shopbuilder' ); |
| 233 | 234 | } |
| 234 | 235 | wp_cache_delete( 'shopbuilder_cached_data', 'shopbuilder' ); |
| 236 | + } | |
| 237 | + } | |
| 238 | + | |
| 239 | + | |
| 240 | + /** | |
| 241 | + * Added data cache. | |
| 242 | + * | |
| 243 | + * @since 4.3.0 | |
| 244 | + * @param string $cache_key Transient cache key. | |
| 245 | + */ | |
| 246 | + public static function set_transient_cache_key( $cache_key ) { | |
| 247 | + $cached_data = get_transient( 'shopbuilder_transient_cached_data' ); | |
| 248 | + if ( is_array( $cached_data ) ) { | |
| 249 | + $cached_data[] = $cache_key; | |
| 250 | + } else { | |
| 251 | + $cached_data = [ $cache_key ]; | |
| 252 | + } | |
| 253 | + | |
| 254 | + set_transient( 'shopbuilder_transient_cached_data', array_unique( $cached_data ) ); | |
| 255 | + } | |
| 256 | + | |
| 257 | + /** | |
| 258 | + * Clear data cache. | |
| 259 | + * | |
| 260 | + * @since 4.3.0 | |
| 261 | + */ | |
| 262 | + public static function clear_transient_cache() { | |
| 263 | + $cached_templates = get_transient( 'shopbuilder_transient_cached_data' ); | |
| 264 | + if ( is_array( $cached_templates ) ) { | |
| 265 | + foreach ( $cached_templates as $cache_key ) { | |
| 266 | + delete_transient( $cache_key ); | |
| 267 | + } | |
| 268 | + delete_transient( 'shopbuilder_transient_cached_data' ); | |
| 235 | 269 | } |
| 236 | 270 | } |
| 237 | 271 | } |