Changeset 58025 for trunk/src/wp-includes/class-wp-theme.php
- Timestamp:
- 04/19/2024 05:57:43 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-theme.php
r57847 r58025 1973 1973 * 1974 1974 * @since 6.4.0 1975 * @since 6.6.0 Uses transients to cache regardless of site environment. 1975 1976 * 1976 1977 * @return array|false Returns an array of patterns if cache is found, otherwise false. … … 1980 1981 return false; 1981 1982 } 1982 $pattern_data = wp_cache_get( 'wp_theme_patterns_' . $this->stylesheet, 'theme_files' ); 1983 1984 $pattern_data = get_site_transient( 'wp_theme_files_patterns-' . $this->cache_hash ); 1985 1983 1986 if ( is_array( $pattern_data ) && $pattern_data['version'] === $this->get( 'Version' ) ) { 1984 1987 return $pattern_data['patterns']; … … 1991 1994 * 1992 1995 * @since 6.4.0 1996 * @since 6.6.0 Uses transients to cache regardless of site environment. 1993 1997 * 1994 1998 * @param array $patterns Block patterns data to set in cache. … … 1999 2003 'patterns' => $patterns, 2000 2004 ); 2001 wp_cache_set( 'wp_theme_patterns_' . $this->stylesheet, $pattern_data, 'theme_files' ); 2005 2006 /** 2007 * Filters the cache expiration time for theme files. 2008 * 2009 * @since 6.6.0 2010 * 2011 * @param int $cache_expiration Cache expiration time in seconds. 2012 * @param string $cache_type Type of cache being set. 2013 */ 2014 $cache_expiration = (int) apply_filters( 'wp_theme_files_cache_ttl', self::$cache_expiration, 'theme_block_patterns' ); 2015 2016 // We don't want to cache patterns infinitely. 2017 if ( $cache_expiration <= 0 ) { 2018 _doing_it_wrong( 2019 __METHOD__, 2020 sprintf( 2021 /* translators: %1$s: The filter name.*/ 2022 __( 'The %1$s filter must return an integer value greater than 0.' ), 2023 '<code>wp_theme_files_cache_ttl</code>' 2024 ), 2025 '6.6.0' 2026 ); 2027 2028 $cache_expiration = self::$cache_expiration; 2029 } 2030 2031 set_site_transient( 'wp_theme_files_patterns-' . $this->cache_hash, $pattern_data, $cache_expiration ); 2002 2032 } 2003 2033 … … 2006 2036 * 2007 2037 * @since 6.4.0 2038 * @since 6.6.0 Uses transients to cache regardless of site environment. 2008 2039 */ 2009 2040 public function delete_pattern_cache() { 2010 wp_cache_delete( 'wp_theme_patterns_' . $this->stylesheet, 'theme_files');2041 delete_site_transient( 'wp_theme_files_patterns-' . $this->cache_hash ); 2011 2042 } 2012 2043
Note: See TracChangeset
for help on using the changeset viewer.