Make WordPress Core

Ticket #28273: 28273-2.patch

File 28273-2.patch, 1.9 KB (added by JPry, 10 years ago)

A more comprehensive patch

  • src/wp-admin/includes/upgrade.php

    diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
    index 558b88e..e846bce 100644
    function upgrade_network() { 
    13631363                        update_site_option( 'illegal_names', $illegal_names );
    13641364                }
    13651365        }
     1366
     1367        // 4.0.0
     1368        if ( $wp_current_db_version < 30000 ) {
     1369                $wpdb->update( $wpdb->blogs, array( 'path' => '/' ), array( 'path' => '' ) );
     1370        }
     1371
    13661372}
    13671373
    13681374// The functions we use to actually do stuff
  • src/wp-includes/ms-blogs.php

    diff --git src/wp-includes/ms-blogs.php src/wp-includes/ms-blogs.php
    index 16a4918..46e36e8 100644
    function update_blog_details( $blog_id, $details = array() ) { 
    290290        $details = array_merge($current_details, $details);
    291291        $details['last_updated'] = current_time('mysql', true);
    292292
     293        // Ensure that the path always has a slash
     294        if ( isset( $details['path'] ) ) {
     295                $details['path'] = trailingslashit( $details['path'] );
     296        }
     297
    293298        $update_details = array();
    294299        $fields = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id');
    295300        foreach ( array_intersect( array_keys( $details ), $fields ) as $field )
  • src/wp-includes/ms-load.php

    diff --git src/wp-includes/ms-load.php src/wp-includes/ms-load.php
    index 02224bd..95db548 100644
    function get_site_by_path( $domain, $path, $segments = null ) { 
    374374                $site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domains[0], $paths[0] ) );
    375375        }
    376376
     377        // One last attempt, in case the path column is empty for the site. Addresses #28273
     378        if ( ! $site ) {
     379                $site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = ''", $domains[0] ) );
     380        }
     381
    377382        if ( $site ) {
    378383                // @todo get_blog_details()
    379384                return $site;