Make WordPress Core


Ignore:
Timestamp:
02/05/2009 09:59:37 PM (18 years ago)
Author:
ryan
Message:

Cookie support for HTTP API. Props beaulebens. fixes #9049 #9037 #8727

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/rss.php

    r10508 r10512  
    715715                $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts';
    716716
    717                 // shouldn't these be using get_option() ?
    718                 if ( !$wpdb->get_var( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name = %s", $cache_option ) ) )
    719                         add_option($cache_option, '', '', 'no');
    720                 if ( !$wpdb->get_var( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name = %s", $cache_timestamp ) ) )
    721                         add_option($cache_timestamp, '', '', 'no');
    722 
    723                 update_option($cache_option, $rss);
    724                 update_option($cache_timestamp, time() );
     717                set_transient($cache_option, $rss);
     718                set_transient($cache_timestamp, time() );
    725719
    726720                return $cache_option;
    … …  
    737731                $cache_option = 'rss_' . $this->file_name( $url );
    738732
    739                 if ( ! get_option( $cache_option ) ) {
     733                if ( ! $rss = get_transient( $cache_option ) ) {
    740734                        $this->debug(
    741735                                "Cache doesn't contain: $url (cache option: $cache_option)"
    … …  
    743737                        return 0;
    744738                }
    745 
    746                 $rss = get_option( $cache_option );
    747739
    748740                return $rss;
    … …  
    761753                $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts';
    762754
    763                 if ( $mtime = get_option($cache_timestamp) ) {
     755                if ( $mtime = get_transient($cache_timestamp) ) {
    764756                        // find how long ago the file was added to the cache
    765757                        // and whether that is longer then MAX_AGE
Note: See TracChangeset for help on using the changeset viewer.