Make WordPress Core

Changeset 22110


Ignore:
Timestamp:
10/04/2012 01:25:58 PM (12 years ago)
Author:
ryan
Message:

If wp_cache_incr() is not available fallback to get()/set(). fixes #22024

File:
1 edited

Legend:

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

    r22090 r22110  
    12911291    do_action('wp_insert_comment', $id, $comment);
    12921292
    1293     wp_cache_incr( 'last_changed', 1, 'comment' );
     1293    if ( function_exists( 'wp_cache_incr' ) ) {
     1294        wp_cache_incr( 'last_changed', 1, 'comment' );
     1295    } else {
     1296        $last_changed = wp_cache_get( 'last_changed', 'comment' );
     1297        wp_cache_set( 'last_changed', $last_changed + 1, 'comment' );
     1298    }
    12941299
    12951300    return $id;
     
    19641969        wp_cache_delete($id, 'comment');
    19651970
    1966     wp_cache_incr( 'last_changed', 1, 'comment' );
     1971    if ( function_exists( 'wp_cache_incr' ) ) {
     1972        wp_cache_incr( 'last_changed', 1, 'comment' );
     1973    } else {
     1974        $last_changed = wp_cache_get( 'last_changed', 'comment' );
     1975        wp_cache_set( 'last_changed', $last_changed + 1, 'comment' );
     1976    }
    19671977}
    19681978
Note: See TracChangeset for help on using the changeset viewer.