WordPress.org

Make WordPress Core

Ticket #6481: 6481.5.diff

File 6481.5.diff, 2.0 KB (added by valendesigns, 5 years ago)
  • src/wp-admin/includes/schema.php

    diff --git src/wp-admin/includes/schema.php src/wp-admin/includes/schema.php
    index 296a699..634f9a8 100644
    function populate_options() { 
    397397        'links_updated_date_format' => __('F j, Y g:i a'),
    398398        'comment_moderation' => 0,
    399399        'moderation_notify' => 1,
    400         'permalink_structure' => '',
     400        'permalink_structure' => '/%year%/%monthnum%/%day%/%postname%/',
    401401        'gzipcompression' => 0,
    402402        'hack_file' => 0,
    403403        'blog_charset' => 'UTF-8',
    function populate_options() { 
    495495        if ( is_multisite() ) {
    496496                /* translators: blog tagline */
    497497                $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_current_site()->site_name );
    498                 $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/';
    499498        }
    500499
    501500        // Set autoload to no for these options
  • src/wp-admin/includes/upgrade.php

    diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
    index b72303a..6912271 100644
    As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to d 
    241241        elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user', $user_id, 'show_welcome_panel' ) )
    242242                update_user_meta( $user_id, 'show_welcome_panel', 2 );
    243243
     244        // Verify pretty permalinks work, and fall back to ugly permalinks if they do not.
     245        if ( ! is_multisite() ) {
     246                // Hard flush rules and force .htaccess or web.config file refresh.
     247                $wp_rewrite->flush_rules( true );
     248
     249                // Send a HEAD request to the dummy post to smoke test pretty permalinks.
     250                $dummy_link = get_permalink( 1 );
     251                $dummy_response = wp_remote_head( $dummy_link );
     252                $pretty_permalinks = isset( $dummy_response['response']['code'] ) && 200 == $dummy_response['response']['code'];
     253
     254                // Fall back to ugly permalinks
     255                if ( ! $pretty_permalinks ) {
     256                        $wp_rewrite->set_permalink_structure( '' );
     257                        $wp_rewrite->flush_rules();
     258                }
     259        }
     260
    244261        if ( is_multisite() ) {
    245262                // Flush rules to pick up the new page.
    246263                $wp_rewrite->init();