WordPress.org

Make WordPress Core

Changeset 12326


Ignore:
Timestamp:
12/06/2009 05:40:36 PM (9 years ago)
Author:
ryan
Message:

Cleanup oembed caching. Props Viper007Bond. see #10337

File:
1 edited

Legend:

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

    r12280 r12326  
    10391039     */
    10401040    function shortcode( $attr, $url = '' ) {
    1041         global $post, $_wp_using_ext_object_cache;
     1041        global $post;
    10421042
    10431043        if ( empty($url) )
     
    10661066
    10671067            // Check for a cached result (stored in the post meta)
    1068             $cachekey = '_oembed_' . md5( $url . implode( '|', $attr ) );
     1068            $cachekey = '_oembed_' . md5( $url . serialize( $attr ) );
    10691069            if ( $this->usecache ) {
    1070                 $cache = ( $_wp_using_ext_object_cache ) ? wp_cache_get( "{$post_ID}_{$cachekey}", 'oembed' ) : get_post_meta( $post_ID, $cachekey, true );
     1070                $cache = get_post_meta( $post_ID, $cachekey, true );
    10711071
    10721072                // Failures are cached
     
    10841084            // Cache the result
    10851085            $cache = ( $html ) ? $html : '{{unknown}}';
    1086             if ( $_wp_using_ext_object_cache )
    1087                 wp_cache_set( "{$post_ID}_{$cachekey}", $cache, 'oembed' );
    1088             else
    1089                 update_post_meta( $post_ID, $cachekey, $cache );
     1086            update_post_meta( $post_ID, $cachekey, $cache );
    10901087
    10911088            // If there was a result, return it
     
    11071104        if ( empty($post_metas) )
    11081105            return;
    1109         foreach( (array) $post_metas as $post_meta_key ) {
     1106
     1107        foreach( $post_metas as $post_meta_key ) {
    11101108            if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) )
    11111109                delete_post_meta( $post_ID, $post_meta_key );
Note: See TracChangeset for help on using the changeset viewer.