From 740d141e1d8c56ea2b1518a9f0362a2b46bf360b Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 8 Jul 2013 20:27:06 +0000 Subject: [PATCH] Support IIS 8 and above. props hurtige for initial patch. fixes #23533. git-svn-id: http://core.svn.wordpress.org/trunk@24594 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/misc.php | 4 ++-- wp-includes/canonical.php | 2 +- wp-includes/functions.php | 11 +++++------ wp-includes/vars.php | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index 7cb68dd6e2..4b0ace0579 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -370,7 +370,7 @@ function set_screen_options() { } /** - * 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 * * @since 2.8.0 * @@ -428,7 +428,7 @@ function iis7_delete_rewrite_rule($filename) { } /** - * Add WordPress rewrite rule to the IIS 7 configuration file. + * Add WordPress rewrite rule to the IIS 7+ configuration file. * * @since 2.8.0 * diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index e9d8448348..423dcc6366 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -18,7 +18,7 @@ * one or the other. * * Prevents redirection for feeds, trackbacks, searches, comment popup, and - * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7, + * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+, * page/post previews, WP admin, Trackbacks, robots.txt, searches, or on POST * requests. * diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 15cd8cd47b..eb9715d463 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3038,7 +3038,7 @@ function apache_mod_loaded($mod, $default = false) { } /** - * Check if IIS 7 supports pretty permalinks. + * Check if IIS 7+ supports pretty permalinks. * * @since 2.8.0 * @@ -3049,11 +3049,10 @@ function iis7_supports_permalinks() { $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 deprecated and for IIS it - * is recommended to use PHP 5.X NTS. + /* First we check if the DOMDocument class exists. If it does not exist, then we cannot + * easily update the xml configuration file, hence we just bail out and tell user that + * pretty permalinks cannot be used. + * * 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 diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 23e0e5804f..f55cdbd9fd 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -93,10 +93,10 @@ $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos( $is_IIS = !$is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false); /** - * Whether the server software is IIS 7.X + * Whether the server software is IIS 7.X or greater * @global bool $is_iis7 */ -$is_iis7 = $is_IIS && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false); +$is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7; /** * Test if the current browser runs on a mobile device (smart phone, tablet, etc.)