[wp-trac] [WordPress Trac] #36628: install.php failed to create permanent link rewrite rules on percona cluster

WordPress Trac noreply at wordpress.org
Thu Apr 21 21:21:13 UTC 2016


#36628: install.php failed to create permanent link rewrite rules on percona
cluster
--------------------------+-----------------------------
 Reporter:  mmpower       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When wordpress is installed on a multi-master galera cluster ( like
 percona xtradb cluster), the post id in wp_posts table may not start from
 1.
 [[BR]]

 but wp-admin/install.php has the following code logic when trying to
 generate rewrite rules for permanent links in function
 wp_install_maybe_enable_pretty_permalinks():


 {{{#!php
 <?php
 ...
                 $test_url = get_permalink( 1 );

                 if ( ! $test_url ) {
                         $test_url = home_url( '/wordpress-check-for-
 rewrites/' );
                 }

                 /*
                  * Send a request to the site, and check whether
                  * the 'x-pingback' header is returned as expected.
                  *
                  * Uses wp_remote_get() instead of wp_remote_head()
 because web servers
                  * can block head requests.
                  */
                 $response          = wp_remote_get( $test_url, array(
 'timeout' => 5 ) );

                 $x_pingback_header = wp_remote_retrieve_header( $response,
 'x-pingback' );
                 $pretty_permalinks = $x_pingback_header &&
 $x_pingback_header === get_bloginfo( 'pingback_url' );
 ...

 }}}
 [[BR]]

 basically it assumes there is a post id "1" and used that to test the
 permanent link. if no such post if then use a non-existed page to test;
 and then compare the x-pingback response header.
 [[BR]]

 however, since there is no such post id "1" in this case, it 's using a
 non-existed url "/wordpress-check-for-rewrites/" for the etsting and
 current versions of wordpress does not return a "x-pingback" header for
 404 pages. thus it failed the permanent link tests and empty the empty the
 rewrite rules, and generates a empty htaccess file like the following:

 [[BR]]
 {{{

 # BEGIN WordPress

 # END WordPress
 }}}



 [[BR]]
 please fix it so that it uses the smallest post id available in wp_posts
 table instead of hardcoding  " $test_url = get_permalink( 1 );"

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36628>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list