Posted by joachim on July 15, 2009 at 2:31pm
Jump to:
| Project: | Module Builder |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
translation_link_alter
custom_url_rewrite_outbound is not a hook, it's a function you can add to settings.php to alter all links generated by Drupal. This function is called from url(). This function is called very frequently (100+ times per page) so performance is critical.
Comments
#1
*sigh*
This is because we now have non-hooks in core.php and so the regexp will need rewriting to be a bit more robust.
While I'm at it, the way it gets called could do with tidying up too.
#2
Changed the regexp to check the function begins with 'hook' and make sure we get the comments that belong to the function:
$pattern = '[/ \* \* \n # start phpdoc
( \ \* .* ) \n # first line of phpdoc: capture
(?: \ \* .* \n )* # lines of phpdoc
\ \* / \n # end phpdoc
( function \ ( hook_\w* ) .* ) \ { # function declaration: capture both entire declaration and name
]mx';
Added whitespace and comments for better maintainability.
Subsequent commits will refactor the code around this.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.