Make WordPress Core

Ticket #6481: 6481.6.diff

File 6481.6.diff, 2.4 KB (added by ericlewis, 10 years ago)
  • src/wp-admin/includes/schema.php

     
    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',
     
    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

     
    8787
    8888        wp_install_defaults($user_id);
    8989
     90        // Verify pretty permalinks work. Fall back to ugly permalinks if they don't.
     91        $pretty_permalinks_work = wp_install_verify_pretty_permalinks_work();
     92        if ( ! $pretty_permalinks_work ) {
     93                $wp_rewrite->set_permalink_structure('');
     94        }
     95
    9096        flush_rewrite_rules();
    9197
    9298        wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
     
    260266}
    261267endif;
    262268
     269/**
     270 * Verify whether the default pretty permalink structure works.
     271 *
     272 * @since 4.2.0
     273 *
     274 * @return bool
     275 */
     276function wp_install_verify_pretty_permalinks_work() {
     277        global $wp_rewrite;
     278        // Flush rules with the hard option to force refresh of the web-server's
     279        // rewrite config file (e.g. .htaccess or web.config).
     280        $wp_rewrite->flush_rules( true );
     281
     282        // Send a HEAD request to a random page on the site,
     283        // and check whether the 'x-pingback' header is returned as expected.
     284        $url = site_url( '/some-random-404-page/' );
     285        $response = wp_remote_get( $url );
     286        $x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' );
     287        if ( $x_pingback_header && $x_pingback_header === get_bloginfo('pingback_url') ) {
     288                return true;
     289        }
     290        else {
     291                return false;
     292        }
     293}
     294
    263295if ( !function_exists('wp_new_blog_notification') ) :
    264296/**
    265297 * {@internal Missing Short Description}}