Make WordPress Core

Ticket #29204: 29204.4.diff

File 29204.4.diff, 1.8 KB (added by SergeyBiryukov, 4 years ago)
  • src/wp-includes/class-wp-feed-cache.php

     
    55 * @package WordPress
    66 * @subpackage Feed
    77 * @since 4.7.0
     8 * @deprecated 5.6.0
    89 */
    910
     11_deprecated_file(
     12        basename( __FILE__ ),
     13        '5.6.0',
     14        '',
     15        __( 'This file is only loaded for backward compatibility with SimplePie 1.2.x. Please consider switching to a recent SimplePie version.' )
     16);
     17
    1018/**
    1119 * Core class used to implement a feed cache.
    1220 *
  • src/wp-includes/feed.php

     
    789789                require_once ABSPATH . WPINC . '/class-simplepie.php';
    790790        }
    791791
    792         require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
    793792        require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php';
    794793        require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php';
    795794        require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php';
     
    801800        // constructor sets it before we have a chance to set the sanitization class.
    802801        $feed->sanitize = new WP_SimplePie_Sanitize_KSES();
    803802
    804         $feed->set_cache_class( 'WP_Feed_Cache' );
     803        // Register the cache handler using the recommended method for SimplePie 1.3 or later.
     804        if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
     805                SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
     806                $feed->set_cache_location( 'wp_transient' );
     807        } else {
     808                // Back-compat for SimplePie 1.2.x.
     809                require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
     810                $feed->set_cache_class( 'WP_Feed_Cache' );
     811        }
     812
    805813        $feed->set_file_class( 'WP_SimplePie_File' );
    806814
    807815        $feed->set_feed_url( $url );