Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r19654 r20952  
    5050 *
    5151 * @param int $blog_id Blog ID
    52  * @param bool $drop True if blog's table should be dropped.  Default is false.
     52 * @param bool $drop True if blog's table should be dropped. Default is false.
    5353 * @return void
    5454 */
    … …  
    9090                }
    9191
    92                 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id ) );
     92                $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) );
     93
    9394                $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id );
    9495                $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
    … …  
    116117                }
    117118
    118                 $stack = array_reverse( $stack );  // Last added dirs are deepest
     119                $stack = array_reverse( $stack ); // Last added dirs are deepest
    119120                foreach( (array) $stack as $dir ) {
    120121                        if ( $dir != $top_dir)
    … …  
    132133
    133134        $id = (int) $id;
     135        $user = new WP_User( $id );
    134136
    135137        do_action( 'wpmu_delete_user', $id );
    … …  
    159161        }
    160162
    161         $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->users WHERE ID = %d", $id ) );
    162         $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
    163 
    164         clean_user_cache( $id );
     163        $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
     164        foreach ( $meta as $mid )
     165                delete_metadata_by_mid( 'user', $mid );
     166
     167        $wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
     168
     169        clean_user_cache( $user );
    165170
    166171        // allow for commit transaction
    … …  
    168173
    169174        return true;
    170 }
    171 
    172 function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
    173         $themes = get_themes();
    174 
    175         if ( $blog_id != 0 )
    176                 switch_to_blog( $blog_id );
    177 
    178         $blog_allowed_themes = get_option( 'allowedthemes' );
    179         if ( !is_array( $blog_allowed_themes ) || empty( $blog_allowed_themes ) ) { // convert old allowed_themes to new allowedthemes
    180                 $blog_allowed_themes = get_option( 'allowed_themes' );
    181 
    182                 if ( is_array( $blog_allowed_themes ) ) {
    183                         foreach( (array) $themes as $key => $theme ) {
    184                                 $theme_key = esc_html( $theme['Stylesheet'] );
    185                                 if ( isset( $blog_allowed_themes[$key] ) == true ) {
    186                                         $blog_allowedthemes[$theme_key] = 1;
    187                                 }
    188                         }
    189                         $blog_allowed_themes = $blog_allowedthemes;
    190                         add_option( 'allowedthemes', $blog_allowed_themes );
    191                         delete_option( 'allowed_themes' );
    192                 }
    193         }
    194 
    195         if ( $blog_id != 0 )
    196                 restore_current_blog();
    197 
    198         return $blog_allowed_themes;
    199175}
    200176
    … …  
    296272}
    297273add_action( 'admin_notices', 'new_user_email_admin_notice' );
    298 
    299 function get_site_allowed_themes() {
    300         $themes = get_themes();
    301         $allowed_themes = get_site_option( 'allowedthemes' );
    302         if ( !is_array( $allowed_themes ) || empty( $allowed_themes ) ) {
    303                 $allowed_themes = get_site_option( 'allowed_themes' ); // convert old allowed_themes format
    304                 if ( !is_array( $allowed_themes ) ) {
    305                         $allowed_themes = array();
    306                 } else {
    307                         foreach( (array) $themes as $key => $theme ) {
    308                                 $theme_key = esc_html( $theme['Stylesheet'] );
    309                                 if ( isset( $allowed_themes[ $key ] ) == true ) {
    310                                         $allowedthemes[ $theme_key ] = 1;
    311                                 }
    312                         }
    313                         $allowed_themes = $allowedthemes;
    314                 }
    315         }
    316         return $allowed_themes;
    317 }
    318274
    319275/**
    … …  
    424380        <tr>
    425381                <th><?php _e( 'Site Upload Space Quota '); ?></th>
    426                 <td><input type="text" size="3" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e( 'MB (Leave blank for network default)' ); ?></td>
     382                <td><input type="number" step="1" min="0" style="width: 100px" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e( 'MB (Leave blank for network default)' ); ?></td>
    427383        </tr>
    428384        <?php
    … …  
    433389        global $wpdb;
    434390
    435         if ( null !== $deprecated  )
     391        if ( null !== $deprecated )
    436392                _deprecated_argument( __FUNCTION__, '3.1' );
    437393
    438394        $wpdb->update( $wpdb->users, array( $pref => $value ), array( 'ID' => $id ) );
    439395
    440         clean_user_cache( $id );
     396        $user = new WP_User( $id );
     397        clean_user_cache( $user );
    441398
    442399        if ( $pref == 'spam' ) {
    … …  
    456413                return false;
    457414
    458         clean_user_cache( $id );
     415        clean_user_cache( $user );
    459416
    460417        return $id;
    … …  
    552509                } else {
    553510                        $translated = format_code_lang( $code_lang );
    554                         $output[$translated] =  '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';
     511                        $output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';
    555512                }
    556513
    … …  
    637594                                        if ( $primary_blog == $blog->userblog_id )
    638595                                                $found = true;
    639                                         ?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog,  $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
     596                                        ?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
    640597                                } ?>
    641598                        </select>
    … …  
    774731 *
    775732 * The default criteria for a large network is either more than 10,000 users or more than 10,000 sites.
    776  * Plugins can alter this criteria  using the 'wp_is_large_network' filter.
     733 * Plugins can alter this criteria using the 'wp_is_large_network' filter.
    777734 *
    778735 * @since 3.3.0
    779  * @param string $using 'sites or 'users'.  Default is 'sites'.
     736 * @param string $using 'sites or 'users'. Default is 'sites'.
    780737 * @return bool True if the network meets the criteria for large. False otherwise.
    781738 */
    … …  
    789746        return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count );
    790747}
    791 ?>
Note: See TracChangeset for help on using the changeset viewer.