WordPress.org

Make WordPress Core

Ticket #19822: patch.diff

File patch.diff, 1.4 KB (added by mohanjith, 6 years ago)
  • wp-includes/ms-blogs.php

    From 25bbdbf272ed0d7b4a4b23bcd83df781b99d1599 Mon Sep 17 00:00:00 2001
    From: moha <moha@844d07d2-d7f9-4290-a55f-1295d075e86f>
    Date: Fri, 13 Jan 2012 09:14:16 +0000
    Subject: [PATCH] Lets update blog option keys when update_option is called
    
    ---
     wp-includes/ms-blogs.php |   20 ++++++++++++++++++++
     1 files changed, 20 insertions(+), 0 deletions(-)
    
    diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php
    index 1c483e1..f97262b 100644
    a b function update_blog_details( $blog_id, $details = array() ) { 
    308308}
    309309
    310310/**
     311 * Update site options and refresh blog details when options are updated using
     312 * update_options();
     313 *
     314 * @since 3.3.1
     315 *
     316 * @param string $id The option key
     317 * @param mixed $old_value The old option value
     318 * @param mixed $newvalue The new option value
     319 */
     320function update_any_blog_option( $option, $old_value, $new_value ) {
     321        global $wpdb;
     322
     323        wp_cache_set($wpdb->blogid . '-' . $option . '-blog_option', $new_value, 'site-options');
     324        if (in_array($option, array('blogname','siteurl','post_count'))) {
     325                refresh_blog_details( $wpdb->blogid );
     326        }
     327}
     328add_action('updated_option', 'update_any_blog_option', 10, 3);
     329
     330/**
    311331 * Retrieve option value based on setting name and blog_id.
    312332 *
    313333 * If the option does not exist or does not have a value, then the return value