WordPress.org

Make WordPress Core

Ticket #42573: 42573.4.patch

File 42573.4.patch, 1.2 KB (added by mariovalney, 6 months ago)

Removing cache

  • wp-includes/class-wp-theme.php

    diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php
    index 171d8b6..8a3b021 100644
    a b final class WP_Theme implements ArrayAccess { 
    984984         *               being absolute paths.
    985985         */
    986986        public function get_files( $type = null, $depth = 0, $search_parent = false ) {
    987                 // get and cache all theme files to start with.
    988                 $label = sanitize_key( 'files_' . $this->cache_hash . '-' . $this->get( 'Version' ) );
    989                 $transient_key = substr( $label, 0, 29 ) . md5( $label );
     987                $all_files = (array) self::scandir( $this->get_stylesheet_directory(), null, -1 );
    990988
    991                 $all_files = get_transient( $transient_key );
    992                 if ( false === $all_files ) {
    993                         $all_files = (array) self::scandir( $this->get_stylesheet_directory(), null, -1 );
    994 
    995                         if ( $search_parent && $this->parent() ) {
    996                                 $all_files += (array) self::scandir( $this->get_template_directory(), null, -1 );
    997                         }
    998 
    999                         set_transient( $transient_key, $all_files, HOUR_IN_SECONDS );
     989                if ( $search_parent && $this->parent() ) {
     990                        $all_files += (array) self::scandir( $this->get_template_directory(), null, -1 );
    1000991                }
    1001992
    1002993                // Filter $all_files by $type & $depth.