WordPress.org

Make WordPress Core

Ticket #22090: 22090.diff

File 22090.diff, 5.7 KB (added by ryan, 6 years ago)
  • wp-includes/functions.php

     
    31213121 * @return bool True if not multisite or $blog_id is main site
    31223122 */
    31233123function is_main_site( $blog_id = '' ) {
    3124         global $current_site, $current_blog;
     3124        global $current_site;
    31253125
    3126         if ( !is_multisite() )
     3126        if ( ! is_multisite() )
    31273127                return true;
    31283128
    3129         if ( !$blog_id )
    3130                 $blog_id = $current_blog->blog_id;
     3129        if ( ! $blog_id )
     3130                $blog_id = get_current_blog_id();
    31313131
    31323132        return $blog_id == $current_site->blog_id;
    31333133}
  • wp-includes/ms-blogs.php

     
    118118 *
    119119 * @since MU
    120120 *
    121  * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against.
     121 * @param int|string|array $fields A blog ID, a blog slug, or an array of fields to query against. Optional. If not specified the current blog ID is used.
    122122 * @param bool $get_all Whether to retrieve all details or only the details in the blogs table. Default is true.
    123123 * @return object Blog details.
    124124 */
    125 function get_blog_details( $fields, $get_all = true ) {
     125function get_blog_details( $fields = null, $get_all = true ) {
    126126        global $wpdb;
    127127
    128128        if ( is_array($fields ) ) {
     
    166166                        return false;
    167167                }
    168168        } else {
    169                 if ( !is_numeric( $fields ) )
     169                if ( ! $fields )
     170                        $blog_id = get_current_blog_id();
     171                elseif ( ! is_numeric( $fields ) )
    170172                        $blog_id = get_id_from_blogname( $fields );
    171173                else
    172174                        $blog_id = $fields;
  • wp-includes/class-wp-xmlrpc-server.php

     
    36603660         * @access protected
    36613661         */
    36623662        function _multisite_getUsersBlogs($args) {
    3663                 global $current_blog;
     3663                $current_blog = get_blog_details();
     3664
    36643665                $domain = $current_blog->domain;
    36653666                $path = $current_blog->path . 'xmlrpc.php';
    36663667
  • wp-includes/ms-load.php

     
    6969 * @return bool|string Returns true on success, or drop-in file to include.
    7070 */
    7171function ms_site_check() {
    72         global $wpdb, $current_blog;
     72        global $wpdb;
    7373
     74        $blog = get_blog_details();
     75
    7476        // Allow short-circuiting
    7577        $check = apply_filters('ms_site_check', null);
    7678        if ( null !== $check )
     
    8082        if ( is_super_admin() )
    8183                return true;
    8284
    83         if ( '1' == $current_blog->deleted ) {
     85        if ( '1' == $blog->deleted ) {
    8486                if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
    8587                        return WP_CONTENT_DIR . '/blog-deleted.php';
    8688                else
    8789                        wp_die( __( 'This user has elected to delete their account and the content is no longer available.' ), '', array( 'response' => 410 ) );
    8890        }
    8991
    90         if ( '2' == $current_blog->deleted ) {
     92        if ( '2' == $blog->deleted ) {
    9193                if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) )
    9294                        return WP_CONTENT_DIR . '/blog-inactive.php';
    9395                else
    9496                        wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) );
    9597        }
    9698
    97         if ( $current_blog->archived == '1' || $current_blog->spam == '1' ) {
     99        if ( $blog->archived == '1' || $blog->spam == '1' ) {
    98100                if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
    99101                        return WP_CONTENT_DIR . '/blog-suspended.php';
    100102                else
  • wp-admin/includes/class-wp-importer.php

     
    132132                                exit();
    133133                        }
    134134                        $blog_id = (int) $blog->blog_id;
    135                         // Restore global $current_blog
    136                         global $current_blog;
    137                         $current_blog = $blog;
    138135                }
    139136
    140137                if ( function_exists( 'is_multisite' ) ) {
     
    212209         * @return bool
    213210         */
    214211        function is_user_over_quota() {
    215                 global $current_blog;
    216 
    217212                if ( function_exists( 'upload_is_user_over_quota' ) ) {
    218213                        if ( upload_is_user_over_quota( 1 ) ) {
    219214                                echo "Sorry, you have used your upload quota.\n";
  • wp-admin/ms-delete-site.php

     
    2525        }
    2626}
    2727
     28$blog = get_blog_details();
     29
    2830$title = __( 'Delete Site' );
    2931$parent_file = 'tools.php';
    3032require_once( './admin-header.php' );
     
    7274        <form method="post" name="deletedirect">
    7375                <?php wp_nonce_field( 'delete-blog' ) ?>
    7476                <input type="hidden" name="action" value="deleteblog" />
    75                 <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $current_blog->domain : $current_blog->domain . $current_blog->path ); ?></strong></label></p>
     77                <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $blog->domain : $blog->domain . $blog->path ); ?></strong></label></p>
    7678                <?php submit_button( __( 'Delete My Site Permanently' ) ); ?>
    7779        </form>
    7880        <?php