WordPress.org

Make WordPress Core

Ticket #3950: 3950.fetch-rss-timeout-addition.patch

File 3950.fetch-rss-timeout-addition.patch, 1023 bytes (added by DD32, 7 years ago)

fetch_rss add $timeout

  • wp-includes/rss.php

     
    375375} 
    376376require_once( dirname(__FILE__) . '/class-snoopy.php'); 
    377377 
    378 function fetch_rss ($url) { 
     378function fetch_rss ($url, $timeout = false ) { 
    379379        // initialize constants 
    380380        init(); 
    381381 
     
    385385        } 
    386386 
    387387        // if cache is disabled 
    388         if ( !MAGPIE_CACHE_ON ) { 
     388        if ( !MAGPIE_CACHE_ON || $timeout === 0) { 
    389389                // fetch file, and parse it 
    390390                $resp = _fetch_remote_file( $url ); 
    391391                if ( is_success( $resp->status ) ) { 
     
    404404                // 3. if cached obj fails freshness check, fetch remote 
    405405                // 4. if remote fails, return stale object, or error 
    406406 
    407                 $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE ); 
     407                $cache = new RSSCache( MAGPIE_CACHE_DIR, ( $timeout === false ? MAGPIE_CACHE_AGE : $timeout ) ); 
    408408 
    409409                if (MAGPIE_DEBUG and $cache->ERROR) { 
    410410                        debug($cache->ERROR, E_USER_WARNING);