WordPress.org

Make WordPress Core

Ticket #13773: get_most_active_blogs.patch

File get_most_active_blogs.patch, 956 bytes (added by ocean90, 4 years ago)
  • wp-includes/ms-functions.php

     
    159159} 
    160160 
    161161function get_most_active_blogs( $num = 10, $display = true ) { 
    162         $most_active = get_site_option( 'most_active' ); 
     162        $most_active = get_site_transient( 'most_active' ); 
    163163        $update = false; 
    164         if ( is_array( $most_active ) ) { 
    165                 if ( ( $most_active['time'] + 60 ) < time() ) { // cache for 60 seconds. 
    166                         $update = true; 
    167                 } 
    168         } else { 
     164        if ( empty( $most_active ) || ! is_array( $most_active ) ) 
    169165                $update = true; 
    170         } 
    171166 
    172167        if ( $update == true ) { 
    173168                unset( $most_active ); 
     
    186181                        unset( $most_active ); 
    187182                        $most_active = $t; 
    188183                } 
    189                 update_site_option( 'most_active', $most_active ); 
     184                set_site_transient( 'most_active', $most_active, 60 ); // cache for 60 seconds. 
    190185        } 
    191186 
    192187        if ( $display == true ) {