[wp-trac] [WordPress Trac] #25194: Filtered IIS rewrite rules not added to web.config
WordPress Trac
noreply at wordpress.org
Mon Jan 27 23:52:58 UTC 2014
#25194: Filtered IIS rewrite rules not added to web.config
-------------------------------------+------------------------------
Reporter: pat@… | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 3.6
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+------------------------------
Changes (by pat@…):
* keywords: => has-patch needs-testing
Comment:
Okay, I've created checked out the trunk, made my changes, tested and have
a document + plugin that illustrates the bug before the patch, and how it
works after. There's no UI for the plugin, just edit the file to see what
I'm doing, there's some comments in there as well. Here are some notes I
took while patching.
Changes:
/wp-admin/includes/misc.php
- changed function iis7_add_rewrite_rule to
'iis7_add_rewrite_rules'
- allow filtering of rewrite rule text after 'wordpress'
rule already in web.config
- added $wp_rewrite->non_wp_rules to content generated by
WP to be written to web.config
- take $rewrite_rules text param (filtered by
'iis7_url_rewrite_rules'), parse it as a doc to get a collection of user
filtered rules
- check existing wp and non_wp_rules against filtered
rules, determine which rules to include, which to remove from web.config
- changed function iis7_delete_rewrite_rule to
'iis7_delete_rewrite_rules'
- instead of deleting just the wordpress rule, also delete
all non_wp_rules
- this is only triggered when the filtered rules_text is
empty (will clear all wp rules)
- changed function iis7_save_url_rewrite_rules
- changed function calls to pluralized versions.
- removed un-neccessary params from call to
iis7_url_rewrite_rules()
/wp-includes/rewrite.php
- changed function iis7_url_rewrite_rules
- dependencies: called by wp-admin/options-permalink.php
and wp-admin/includes/misc.php
- this was being called from options-permalink.php with additional
empty string params that didn't seem to be used
- made a 2nd param of $format, which helps output the content for
the options-permalink.php
- instead of just adding the single wordpress rule, nclude
$wp_rewrite->non_wp_rules in generated rules content
- Influencing the non_wp_rules array is the best way to
get rules into the web.config
- Filtering the text directly with '' will still work, but
non_wp_rules are already written to the .htaccess, so makes sense to do it
here as well
/wp-admin/options-permalink.php
- line 263 (update call to pluralized function, modify params to
include $format=true)
- line 270 (update call to pluralized function, modify params to
include $format=true)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25194#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list