update_blog_details

The timeline below displays how wordpress function update_blog_details has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Updates the details for a blog and the blogs table for a given blog ID.
 *
 * @since MU (3.0.0)
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID.
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $site = wp_update_site($blog_id, $details);
    if (is_wp_error($site)) {
        return false;
    }
    return true;
}

WordPress Version: 5.5

/**
 * Update the details for a blog. Updates the blogs table for a given blog ID.
 *
 * @since MU (3.0.0)
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID.
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $site = wp_update_site($blog_id, $details);
    if (is_wp_error($site)) {
        return false;
    }
    return true;
}

WordPress Version: 5.3

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU (3.0.0)
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID.
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $site = wp_update_site($blog_id, $details);
    if (is_wp_error($site)) {
        return false;
    }
    return true;
}

WordPress Version: 5.1

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU (3.0.0)
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $site = wp_update_site($blog_id, $details);
    if (is_wp_error($site)) {
        return false;
    }
    return true;
}

WordPress Version: 4.9

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU (3.0.0)
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_site($blog_id);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        if ('path' === $field) {
            $details[$field] = trailingslashit('/' . trim($details[$field], '/'));
        }
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            /**
             * Fires when the 'spam' status is added to a blog.
             *
             * @since MU (3.0.0)
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_spam_blog', $blog_id);
        } else {
            /**
             * Fires when the 'spam' status is removed from a blog.
             *
             * @since MU (3.0.0)
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            /**
             * Fires when the 'mature' status is added to a blog.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('mature_blog', $blog_id);
        } else {
            /**
             * Fires when the 'mature' status is removed from a blog.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            /**
             * Fires when the 'archived' status is added to a blog.
             *
             * @since MU (3.0.0)
             *
             * @param int $blog_id Blog ID.
             */
            do_action('archive_blog', $blog_id);
        } else {
            /**
             * Fires when the 'archived' status is removed from a blog.
             *
             * @since MU (3.0.0)
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            /**
             * Fires when the 'deleted' status is added to a blog.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_delete_blog', $blog_id);
        } else {
            /**
             * Fires when the 'deleted' status is removed from a blog.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    clean_blog_cache($blog_id);
    return true;
}

WordPress Version: 4.8

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_site($blog_id);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        if ('path' === $field) {
            $details[$field] = trailingslashit('/' . trim($details[$field], '/'));
        }
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            /**
             * Fires when the 'spam' status is added to a blog.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_spam_blog', $blog_id);
        } else {
            /**
             * Fires when the 'spam' status is removed from a blog.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            /**
             * Fires when the 'mature' status is added to a blog.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('mature_blog', $blog_id);
        } else {
            /**
             * Fires when the 'mature' status is removed from a blog.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            /**
             * Fires when the 'archived' status is added to a blog.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('archive_blog', $blog_id);
        } else {
            /**
             * Fires when the 'archived' status is removed from a blog.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            /**
             * Fires when the 'deleted' status is added to a blog.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_delete_blog', $blog_id);
        } else {
            /**
             * Fires when the 'deleted' status is removed from a blog.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    refresh_blog_details($blog_id);
    return true;
}

WordPress Version: 4.7

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_site($blog_id);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        if ('path' === $field) {
            $details[$field] = trailingslashit('/' . trim($details[$field], '/'));
        }
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            /**
             * Fires when the blog status is changed to 'spam'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_spam_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'ham'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            /**
             * Fires when the blog status is changed to 'mature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('mature_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unmature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            /**
             * Fires when the blog status is changed to 'archived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('archive_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unarchived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            /**
             * Fires when the blog status is changed to 'deleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_delete_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'undeleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    refresh_blog_details($blog_id);
    return true;
}

WordPress Version: 4.4

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_blog_details($blog_id, false);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        if ('path' === $field) {
            $details[$field] = trailingslashit('/' . trim($details[$field], '/'));
        }
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            /**
             * Fires when the blog status is changed to 'spam'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_spam_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'ham'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            /**
             * Fires when the blog status is changed to 'mature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('mature_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unmature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            /**
             * Fires when the blog status is changed to 'archived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('archive_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unarchived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            /**
             * Fires when the blog status is changed to 'deleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_delete_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'undeleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    refresh_blog_details($blog_id);
    return true;
}

WordPress Version: 4.3

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU
 *
 * @global wpdb $wpdb
 *
 * @param int   $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_blog_details($blog_id, false);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        if ('path' === $field) {
            $details[$field] = trailingslashit('/' . trim($details[$field], '/'));
        }
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            /**
             * Fires when the blog status is changed to 'spam'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_spam_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'ham'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            /**
             * Fires when the blog status is changed to 'mature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('mature_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unmature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            /**
             * Fires when the blog status is changed to 'archived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('archive_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unarchived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            /**
             * Fires when the blog status is changed to 'deleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_delete_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'undeleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    refresh_blog_details($blog_id);
    return true;
}

WordPress Version: 4.2

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU
 *
 * @param int $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_blog_details($blog_id, false);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        if ('path' === $field) {
            $details[$field] = trailingslashit('/' . trim($details[$field], '/'));
        }
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            /**
             * Fires when the blog status is changed to 'spam'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_spam_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'ham'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            /**
             * Fires when the blog status is changed to 'mature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('mature_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unmature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            /**
             * Fires when the blog status is changed to 'archived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('archive_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unarchived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            /**
             * Fires when the blog status is changed to 'deleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_delete_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'undeleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    refresh_blog_details($blog_id);
    return true;
}

WordPress Version: 3.8

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU
 *
 * @param int $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_blog_details($blog_id, false);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            /**
             * Fires when the blog status is changed to 'spam'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_spam_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'ham'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            /**
             * Fires when the blog status is changed to 'mature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('mature_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unmature'.
             *
             * @since 3.1.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            /**
             * Fires when the blog status is changed to 'archived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('archive_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'unarchived'.
             *
             * @since MU
             *
             * @param int $blog_id Blog ID.
             */
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            /**
             * Fires when the blog status is changed to 'deleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_delete_blog', $blog_id);
        } else {
            /**
             * Fires when the blog status is changed to 'undeleted'.
             *
             * @since 3.5.0
             *
             * @param int $blog_id Blog ID.
             */
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    refresh_blog_details($blog_id);
    return true;
}

WordPress Version: 3.7

/**
 * Update the details for a blog. Updates the blogs table for a given blog id.
 *
 * @since MU
 *
 * @param int $blog_id Blog ID
 * @param array $details Array of details keyed by blogs table field names.
 * @return bool True if update succeeds, false otherwise.
 */
function update_blog_details($blog_id, $details = array())
{
    global $wpdb;
    if (empty($details)) {
        return false;
    }
    if (is_object($details)) {
        $details = get_object_vars($details);
    }
    $current_details = get_blog_details($blog_id, false);
    if (empty($current_details)) {
        return false;
    }
    $current_details = get_object_vars($current_details);
    $details = array_merge($current_details, $details);
    $details['last_updated'] = current_time('mysql', true);
    $update_details = array();
    $fields = array('site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    foreach (array_intersect(array_keys($details), $fields) as $field) {
        $update_details[$field] = $details[$field];
    }
    $result = $wpdb->update($wpdb->blogs, $update_details, array('blog_id' => $blog_id));
    if (false === $result) {
        return false;
    }
    // If spam status changed, issue actions.
    if ($details['spam'] != $current_details['spam']) {
        if ($details['spam'] == 1) {
            do_action('make_spam_blog', $blog_id);
        } else {
            do_action('make_ham_blog', $blog_id);
        }
    }
    // If mature status changed, issue actions.
    if ($details['mature'] != $current_details['mature']) {
        if ($details['mature'] == 1) {
            do_action('mature_blog', $blog_id);
        } else {
            do_action('unmature_blog', $blog_id);
        }
    }
    // If archived status changed, issue actions.
    if ($details['archived'] != $current_details['archived']) {
        if ($details['archived'] == 1) {
            do_action('archive_blog', $blog_id);
        } else {
            do_action('unarchive_blog', $blog_id);
        }
    }
    // If deleted status changed, issue actions.
    if ($details['deleted'] != $current_details['deleted']) {
        if ($details['deleted'] == 1) {
            do_action('make_delete_blog', $blog_id);
        } else {
            do_action('make_undelete_blog', $blog_id);
        }
    }
    if (isset($details['public'])) {
        switch_to_blog($blog_id);
        update_option('blog_public', $details['public']);
        restore_current_blog();
    }
    refresh_blog_details($blog_id);
    return true;
}