URL alter with PURL beta 10 doesn't work anymore.

Comments

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

OK...why? I don't use PURL so someone would have to help figure out why.

socialnicheguru’s picture

Issue tags: +url alter, +purl

it doesn't work with purl 10.

purl rewrites urls to a new path by adding a prefix.

for example when I create an organic group i can specify http://myurl.com/

so instead of writing http://myurl.com/node/400 I can access the og at http://myurl.com/mygroup

With url alter, the prefix is never added.

Is there anyway to make these two modules compatible again?

I used to need this to have purl and url_alter work together: http://drupal.org/node/592324

This would allow me to use
global redirect
fb
purl
together on one site by way of url_alter

socialnicheguru’s picture

Status: Postponed (maintainer needs more info) » Active

added info above

haffmans’s picture

I've tried debugging this a little, and hit the same problem. It seems that in url_alter's custom_url_rewrite_inbound(), any other modules which may depend on it are not fully loaded yet. Thus the result of module_implements('url_inbound_alter') (at least the first time) returns an array with only 'url_alter' in it. This result is statically cached in the module_implements function.

Next, every call to module_implements('url_inbound_alter') will return exactly the same value, omitting any plugins you may actually have, because they were not loaded the first time the custom_url_rewrite_inbound() was called.

What works for me, although it is not a very clean solution I guess, is adding these three lines of code to purl.module, at line 161 (after the if (!function_exists('custom_url_rewrite_inbound')) block):

else {
  module_implements(NULL, FALSE, TRUE);
}

With that bit of code, the static cache is cleared when purl is loaded. The next time custom_url_rewrite_inbound() is called, the purl implementation of the hook is properly discovered.

dave reid’s picture

As shown in the documentation, modules that implement hook_url_inbound_alter() also need to have hook_boot() or hook_exit() to ensure they're loaded by Drupal before the full bootstrap happens.

haffmans’s picture

Project: URL alter » Persistent URL
Version: 6.x-1.x-dev » 6.x-1.0-beta10

Adding an empty hook_boot() to purl.module indeed seems to fix the problem as well (after clearing caches etc.).

Moving this one over to the Persistent URL module.

yhahn’s picture

Status: Active » Fixed

Confirmed and committed: http://drupal.org/cvs?commit=358682

Thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rbrandon’s picture

This is no longer a requirement for url_inbound alter. However purl needs to hang on to the unmodified querystring from before the first drupal_path_initialize() was run.