Ticket #43357: #43357 2020-04-26.patch
| File #43357 2020-04-26.patch, 5.0 KB (added by , 6 years ago) |
|---|
-
wp-includes/class-wp-feed-cache-transient.php
12 12 * 13 13 * @since 2.8.0 14 14 */ 15 class WP_Feed_Cache_Transient {16 15 class WP_Feed_Cache_Transient implements SimplePie_Cache_Base 16 { 17 17 /** 18 18 * Holds the transient name. 19 19 * … … 31 31 public $mod_name; 32 32 33 33 /** 34 * Holds the cache duration in seconds.35 *36 * Defaults to 43200 seconds (12 hours).37 *38 * @since 2.8.039 * @var int40 */41 public $lifetime = 43200;42 43 /**44 34 * Constructor. 45 35 * 46 36 * @since 2.8.0 … … 50 40 * @param string $filename Unique identifier for cache object. 51 41 * @param string $extension 'spi' or 'spc'. 52 42 */ 53 public function __construct( $location, $filename, $extension ) { 54 $this->name = 'feed_' . $filename; 55 $this->mod_name = 'feed_mod_' . $filename; 43 public function __construct( $location, $name, $type ) { 56 44 57 $lifetime = $this->lifetime; 58 /** 59 * Filters the transient lifetime of the feed cache. 60 * 61 * @since 2.8.0 62 * 63 * @param int $lifetime Cache duration in seconds. Default is 43200 seconds (12 hours). 64 * @param string $filename Unique identifier for the cache object. 65 */ 66 $this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename ); 45 $options = SimplePie_Cache::parse_URL( $location ); 46 47 $this->lifetime = $options['extras']['lifetime']; 48 49 $this->name = 'feed_' . md5( "$name:$type" ); 50 $this->mod_name = 'feed_mod_' . md5( "$name:$type" ); 67 51 } 68 52 69 53 /** … … 129 113 delete_transient( $this->mod_name ); 130 114 return true; 131 115 } 132 } 116 } 117 No newline at end of file -
wp-includes/class-wp-feed-cache.php
1 <?php2 /**3 * Feed API: WP_Feed_Cache class4 *5 * @package WordPress6 * @subpackage Feed7 * @since 4.7.08 */9 10 /**11 * Core class used to implement a feed cache.12 *13 * @since 2.8.014 *15 * @see SimplePie_Cache16 */17 class WP_Feed_Cache extends SimplePie_Cache {18 19 /**20 * Creates a new SimplePie_Cache object.21 *22 * @since 2.8.023 *24 * @param string $location URL location (scheme is used to determine handler).25 * @param string $filename Unique identifier for cache object.26 * @param string $extension 'spi' or 'spc'.27 * @return WP_Feed_Cache_Transient Feed cache handler object that uses transients.28 */29 public function create( $location, $filename, $extension ) {30 return new WP_Feed_Cache_Transient( $location, $filename, $extension );31 }32 } -
wp-includes/feed.php
Property changes on: wp-includes/class-wp-feed-cache.php ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property
749 749 * @return SimplePie|WP_Error SimplePie object on success or WP_Error object on failure. 750 750 */ 751 751 function fetch_feed( $url ) { 752 753 /** 754 * Filters the transient lifetime of the feed cache. 755 * 756 * @since 2.8.0 757 * 758 * @param int $lifetime Cache duration in seconds. Default is 43200 seconds (12 hours). 759 * @param string $filename Unique identifier for the cache object. 760 */ 761 $lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ); 762 752 763 if ( ! class_exists( 'SimplePie', false ) ) { 753 764 require_once ABSPATH . WPINC . '/class-simplepie.php'; 754 765 } 755 766 756 require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';757 767 require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php'; 758 768 require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php'; 759 769 require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php'; … … 760 770 761 771 $feed = new SimplePie(); 762 772 763 $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' ); 764 // We must manually overwrite $feed->sanitize because SimplePie's 765 // constructor sets it before we have a chance to set the sanitization class. 766 $feed->sanitize = new WP_SimplePie_Sanitize_KSES(); 773 SimplePie_Cache::register( 'wordpress', 'WP_Feed_Cache_Transient'); 774 $feed->set_cache_duration( $lifetime ); 775 $feed->set_cache_location( 'wordpress://wordpress?&lifetime=' . $lifetime ); 767 776 768 $feed->set_cache_class( 'WP_Feed_Cache' ); 769 $feed->set_file_class( 'WP_SimplePie_File' ); 777 $feed->registry->register( 'File', 'WP_SimplePie_File', true ); 770 778 771 779 $feed->set_feed_url( $url ); 772 /** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */ 773 $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); 780 774 781 /** 775 782 * Fires just before processing the SimplePie feed object. 776 783 *