[wp-hackers] generate_page_rewrite_rules() and
save_mod_rewrite_rules()
Dennis Williamson
dennis at netstrata.com
Thu Oct 14 21:32:51 UTC 2004
I was looking in the CVS at options-permalink.php and admin-functions.php
and trying to follow the code flow. It looks to me like there may be some
redundancy. This is how I see the flow (showing only what is pertinent):
[In options-permalink.php]
set the value of $home_path
call generate_page_rewrite_rules()
[In admin-functions.php/generate_page_rewrite_rules()]
call save_mod_rewrite_rules() for each page
[In admin-functions.php/save_mod_rewrite_rules()]
set $home_path
set the values of $writable and $usingpi
[In options-permalink.php]
set the values of $writable and $usingpi
call save_mod_rewrite_rules()
[In admin-functions.php/save_mod_rewrite_rules()]
set the values of $writable and $usingpi
If I see this correctly, save_mod_rewrite_rules() gets executed once extra
and $home_path, $writable and $usingpi get set every time "save" is called,
plus in options-permalink.php itself. Am I wrong about this redundancy? Can
it be fixed by removing the extras and using globals? Thus:
[In options-permalink.php]
global $home_path, $writable, $usingpi;
set the value of $home_path
set the values of $writable and $usingpi
call generate_page_rewrite_rules()
[In admin-functions.php/generate_page_rewrite_rules()]
call save_mod_rewrite_rules() for each page
[In admin-functions.php/save_mod_rewrite_rules()]
global $home_path, $writable, $usingpi;
[In options-permalink.php]
continue...
Tell me what you think.
Dennis
More information about the hackers
mailing list