Rewrite Rules: After [36953], correctly replace existing rules on IIS when updating them.

Props WiZZarD_.
Fixes #36506 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@37273 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2016-04-21 09:32:42 +00:00
parent eec3f16b24
commit c52f851308

View File

@ -491,7 +491,7 @@ function iis7_rewrite_rule_exists($filename) {
if ( $doc->load($filename) === false ) if ( $doc->load($filename) === false )
return false; return false;
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]'); $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]');
if ( $rules->length == 0 ) if ( $rules->length == 0 )
return false; return false;
else else
@ -521,7 +521,7 @@ function iis7_delete_rewrite_rule($filename) {
if ( $doc -> load($filename) === false ) if ( $doc -> load($filename) === false )
return false; return false;
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
$rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]'); $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]');
if ( $rules->length > 0 ) { if ( $rules->length > 0 ) {
$child = $rules->item(0); $child = $rules->item(0);
$parent = $child->parentNode; $parent = $child->parentNode;
@ -562,7 +562,7 @@ function iis7_add_rewrite_rule($filename, $rewrite_rule) {
$xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
// First check if the rule already exists as in that case there is no need to re-add it // First check if the rule already exists as in that case there is no need to re-add it
$wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]'); $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]');
if ( $wordpress_rules->length > 0 ) if ( $wordpress_rules->length > 0 )
return true; return true;