Add nginx detection to the Permalink Settings screen.

Introduces got_url_rewrite() and a corresponding filter, which should now be used in lieu of the got_rewrite filter in got_mod_rewrite().

This does not write or even suggest nginx configuration; rather, it prevents nginx from being considered as either Apache or as an unrecognized server.

props johnbillion.
fixes #25098.


git-svn-id: https://develop.svn.wordpress.org/trunk@25456 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-09-16 20:06:27 +00:00
parent 17c772d95b
commit c89f2e38a8
3 changed files with 50 additions and 7 deletions

View File

@@ -7,17 +7,50 @@
*/
/**
* {@internal Missing Short Description}}
* Returns whether the server is running Apache with the mod_rewrite module loaded.
*
* @since 2.0.0
*
* @return unknown
* @return bool
*/
function got_mod_rewrite() {
$got_rewrite = apache_mod_loaded('mod_rewrite', true);
/**
* Filter whether Apache and mod_rewrite are present.
*
* This filter was previously used to force URL rewriting for other servers,
* like nginx. Use the got_url_rewrite filter in got_url_rewrite() instead.
*
* @see got_url_rewrite()
*
* @since 2.5.0
* @param bool $got_rewrite Whether Apache and mod_rewrite are present.
*/
return apply_filters('got_rewrite', $got_rewrite);
}
/**
* Returns whether the server supports URL rewriting.
*
* Detects Apache's mod_rewrite, IIS 7.0+ permalink support, and nginx.
*
* @since 3.7.0
*
* @return bool Whether the server supports URL rewriting.
*/
function got_url_rewrite() {
$got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
/**
* Filter whether URL rewriting is available.
*
* @since 3.7.0
* @param bool $got_url_rewrite Whether URL rewriting is available.
*/
return apply_filters( 'got_url_rewrite', $got_url_rewrite );
}
/**
* {@internal Missing Short Description}}
*