With the Persistent URL module enabled (http://drupal.org/project/purl), this module does not work at all. All the URLs it changes are 404's.

PURL is needed for modules such as http://drupal.org/project/mobile_tools.

I tracked it down to the fact that hook_url_inbound_alter() is getting called multiple times. After the first time $original_path is set to "user" so that makes if (preg_match('|^user(?![^/])|', $original_path)) evaluate to true.

I'm not sure which module would need changed to make them compatible. I don't really use the PURL module. I was just testing out Mobile Tools and had it enabled. So, I can't help you much in the way of info on what it's supposed to do. But it may have to do with the module's custom_url_rewrite_outbound().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Raphael Apard’s picture

cwithout’s picture

Status: Fixed » Active

Thanks for committing the fix to the other issue.

I'm not sure why you marked this fixed though. That issue isn't related. I'm sure there are ways both could be fixed at the same time, but it would need a bigger rewrite than the patch in that issue.

I tried out the current dev to be sure, and enabling purl still causes all the renamed admin paths to result in 404's.

Raphael Apard’s picture

Status: Active » Needs work

Thx for reporting.

SolomonGifford’s picture

The following needs to be added to the beginning of rename_admin_paths_url_inbound_alter. The root problem may be with purl, however. Ultimately, the problem is the purl module causes url_inbound_alter to be invoked twice. I think the second time through, original_path is set to the modified path of the first time through.

function rename_admin_paths_url_inbound_alter(&$path, $original_path, $path_language) {
   if (module_exists('purl') && purl_inited()) {
     return;
   }
SolomonGifford’s picture

Actually, I found a better solution that doesn't depend on purl. See attached patch. I've borrowed ideas used in the purl module to make sure this happens only once but early in the process.

Raphael Apard’s picture

Thx,

#4 and #5 are both working ?
Just looking on code, #4 looks simpliest and not imlements hook_init().
I don't now how much module can causes url_inbound_alter to be invoked twice.
I prefer take the solution #4 for now and we'll see.

Thank again for you help on it.

Raphael Apard’s picture

Status: Needs work » Fixed

Commited.

cwithout’s picture

Tested and working.

Thanks, solomongifford. I'm currently using the Context Mobile Detect mobile for mobile needs, but if I ever need Mobile Tools or another module that requires PURL, it's nice to know this Rename Admin Paths will be compatible.

SolomonGifford’s picture

Raphael,

#4 only fixes the problem for people with PURL enabled. The reason PURL invokes url_inbound_alter twice is because it calls drupal_path_initialize() from its init function.

The reason I think #5 is the better solution is because this module will have the same incompatibility with any other module that invokes drupal_path_initialize(). #5 solves this problem generically in the same way the PURL module solves the problem.

If your primary aversion is the implementation of hook_init, simply remove it from the patch in #5 - the reason I added it was to model PURL's solution and invoke much earlier in the process.

Either way, thanks for committing.

Solomon

cwithout’s picture

Oh. I didn't look at the code. I assumed the patch in #5 was what got committed. I agree with solomongifford. That's a better solution.

Status: Fixed » Closed (fixed)

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

Raphael Apard’s picture

Status: Closed (fixed) » Needs work

re-open for a better solution.

Raphael Apard’s picture

Status: Needs work » Needs review
FileSize
788 bytes

Here the #5 solution (light). If somenone can test it with purl ;).

cwithout’s picture

Status: Needs review » Reviewed & tested by the community

#13 tested and works with the current 7.x-1.0-beta1 of PURL.

Raphael Apard’s picture

thx. commited to dev.

Raphael Apard’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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