Changeset 31160
- Timestamp:
- 01/12/2015 04:32:35 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r31159 r31160 264 264 265 265 /** 266 * Enable pretty permalinks if available. 267 * 268 * This function will enable pretty permalinks if it can verify they work. 269 * If all pretty permalinks formats fail to work, WordPress will fall back 270 * to ugly permalinks by setting an empty permalink structure. 266 * Enable pretty permalinks. 267 * 268 * If after enabling pretty permalinks don't work, fallback to query-string permalinks. 271 269 * 272 270 * @since 4.2.0 … … 277 275 global $wp_rewrite; 278 276 279 // Bail if we alredy have permalinks enabled (Multisite)277 // Bail if a permalink structure is already enabled. 280 278 if ( get_option( 'permalink_structure' ) ) { 281 279 return; … … 283 281 284 282 /* 285 * The Permalink structures which WordPress should attempt to use. 283 * The Permalink structures to attempt. 284 * 286 285 * The first is designed for mod_rewrite or nginx rewriting. 287 * The second is PATHINFO based permalinks offered under configurations 288 * without rewrites enabled. 286 * 287 * The second is PATHINFO-based permalinks for web server configurations 288 * without a true rewrite module enabled. 289 289 */ 290 290 $permalink_structures = array( … … 294 294 295 295 foreach ( (array) $permalink_structures as $permalink_structure ) { 296 // Set the desired Permalink structure to try297 296 $wp_rewrite->set_permalink_structure( $permalink_structure ); 298 297 … … 303 302 $wp_rewrite->flush_rules( true ); 304 303 305 // Test against a real WordPress Post, or if none were created, a Page URI304 // Test against a real WordPress Post, or if none were created, a random 404 page. 306 305 $test_url = get_permalink( 1 ); 307 306 if ( ! $test_url ) { … … 310 309 311 310 /* 312 * Send a HEAD request to a random page onthe site, and check whether311 * Send a request to the site, and check whether 313 312 * the 'x-pingback' header is returned as expected. 313 * 314 * Uses wp_remote_get() instead of wp_remote_head() because web servers 315 * can block head requests. 314 316 */ 315 317 $response = wp_remote_get( $test_url, array( 'timeout' => 5 ) ); … … 323 325 324 326 /* 325 * If it makes it this far, Pretty Permalinks failed to activate.326 * Reset and allow the user to select it themselves.327 * If it makes it this far, pretty permalinks failed. 328 * Fallback to query-string permalinks. 327 329 */ 328 330 $wp_rewrite->set_permalink_structure( '' );
Note: See TracChangeset
for help on using the changeset viewer.