Fix fatal error on IIS after r16797. props peaceablewhale. Limit variable string searching when possible. See #10187
git-svn-id: http://svn.automattic.com/wordpress/trunk@16904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ad6f2b2921
commit
20e1171ae8
|
@ -378,34 +378,6 @@ function wp_menu_unfold() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if IIS 7 supports pretty permalinks
|
|
||||||
*
|
|
||||||
* @since 2.8.0
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
function iis7_supports_permalinks() {
|
|
||||||
global $is_iis7;
|
|
||||||
|
|
||||||
$supports_permalinks = false;
|
|
||||||
if ( $is_iis7 ) {
|
|
||||||
/* First we check if the DOMDocument class exists. If it does not exist,
|
|
||||||
* which is the case for PHP 4.X, then we cannot easily update the xml configuration file,
|
|
||||||
* hence we just bail out and tell user that pretty permalinks cannot be used.
|
|
||||||
* This is not a big issue because PHP 4.X is going to be depricated and for IIS it
|
|
||||||
* is recommended to use PHP 5.X NTS.
|
|
||||||
* Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
|
|
||||||
* URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
|
|
||||||
* Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
|
|
||||||
* via ISAPI then pretty permalinks will not work.
|
|
||||||
*/
|
|
||||||
$supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );
|
|
||||||
}
|
|
||||||
|
|
||||||
return apply_filters('iis7_supports_permalinks', $supports_permalinks);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if rewrite rule for WordPress already exists in the IIS 7 configuration file
|
* Check if rewrite rule for WordPress already exists in the IIS 7 configuration file
|
||||||
*
|
*
|
||||||
|
|
|
@ -35,9 +35,9 @@
|
||||||
* not needed or the string of the URL
|
* not needed or the string of the URL
|
||||||
*/
|
*/
|
||||||
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
|
||||||
global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
|
global $wp_rewrite, $is_iis7, $wp_query, $wpdb;
|
||||||
|
|
||||||
if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) )
|
if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_iis7 && !iis7_supports_permalinks() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( !$requested_url ) {
|
if ( !$requested_url ) {
|
||||||
|
|
|
@ -3421,6 +3421,34 @@ function apache_mod_loaded($mod, $default = false) {
|
||||||
return $default;
|
return $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if IIS 7 supports pretty permalinks
|
||||||
|
*
|
||||||
|
* @since 2.8.0
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function iis7_supports_permalinks() {
|
||||||
|
global $is_iis7;
|
||||||
|
|
||||||
|
$supports_permalinks = false;
|
||||||
|
if ( $is_iis7 ) {
|
||||||
|
/* First we check if the DOMDocument class exists. If it does not exist,
|
||||||
|
* which is the case for PHP 4.X, then we cannot easily update the xml configuration file,
|
||||||
|
* hence we just bail out and tell user that pretty permalinks cannot be used.
|
||||||
|
* This is not a big issue because PHP 4.X is going to be depricated and for IIS it
|
||||||
|
* is recommended to use PHP 5.X NTS.
|
||||||
|
* Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
|
||||||
|
* URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
|
||||||
|
* Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
|
||||||
|
* via ISAPI then pretty permalinks will not work.
|
||||||
|
*/
|
||||||
|
$supports_permalinks = class_exists('DOMDocument') && isset($_SERVER['IIS_UrlRewriteModule']) && ( php_sapi_name() == 'cgi-fcgi' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return apply_filters('iis7_supports_permalinks', $supports_permalinks);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File validates against allowed set of defined rules.
|
* File validates against allowed set of defined rules.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue