Closed (fixed)
Project:
Cache Expiration
Version:
7.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Mar 2013 at 16:22 UTC
Updated:
10 Jul 2013 at 12:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
pjnes commentedThis seems to be caused by the way the base path part is generated:
It uses 2 separate url() function calls and joins them together. Both of those url calls are adding the /en/ part to the path.
Comment #2
buddaThis problem still occurs with the -dev release.
I can recreate it and the url() function double use seems to be the cause, but I can't quite get a 100% fix for it to work myself :-S
This problem may be related to the fix committed in #1471926: Invalid expire URLs when "Include base URL in expires" is enabled. ?
Comment #3
buddaIf I disable the include base_url option the output is:
Comment #4
buddaSo the problem of the language being added in to the path is caused by
$path_alias = url($path, array('absolute' => FALSE));In comment above example the path '[1] => en/node/3614' should not be valid as that's the french version of a node. The en version is node/3062.
Comment #5
buddaThis problem may be more deep rooted in the expire_node() module function.
If i update a node of the french translation (nid: 3614) - the $node being passed in to the function expire_node($node) is actually the french $node->tnid (node:3602), rather than the one I just edited (nid: 3614)!
My knowledge of Drupal's multilingual stuff is fading at this point.
Comment #6
ravencoder commentedHi Guys,
I have also looked into this issue. And I found a fix to the issue. Can you help check if it this works:
basically, it replaces the url() function with the drupal_lookup_path() instead.
Comment #7
buddaBy using drupal_lookup_path() we're now not seeing any country prefix in the url at all. Should the 3rd argument $path_language be used ?
Comment #8
ravencoder commentedHi,
I've checked the code again. I left out the fact that the module has option to exclude/include base_url's.
Basically, the issue is that url() function in D7 always adds the language prefix by default. and the function expire_cache_derivative() (in expire.module) is calling the url() function twice, leading to extra language prefixes on the output's URL.
Please have a look at my new patch this time:
I still havent tested this with domain access module enabled.
Comment #9
pjnes commentedI've tested the changes posted by ravencoder and they work for me.
Attaching a patch of those changes that applies to the 1.x-dev branch
Comment #10
jaydub commentedComment #11
buddaIs #1978642: Pass node language to determine alias something similar ?
Comment #12
ravencoder commentedHi,
the issue are not quite the same. But the solution is pretty similar to my first suggestion at #6. For this issue here, PJnes's patch (#9) combines both my suggestions which should not be the case, the problem with it is that we will not have country prefix at all.
I am attaching a patch version of comment #8. Please see if fixes the problem.
Comment #13
pobster commentedI figure I can probably hijack this thread as I'm having a similar problem to the title (which is generic enough that maybe it should be changed?) However my problem is a bit more nasty and I'm using domain language URLs...
$path_alias = url($path, array('absolute' => FALSE));In certain circumstances the 'absolute' *always* gets parsed as TRUE. In my case, because locale module eventually runs 'locale_language_url_rewrite_url' which when used with LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN enforces absolute URLs. The huge downside to this is that now expire module receives something its not expecting and so with this line;
$expire[] = substr($path_alias, strlen($base_path));Strips off the first character of the path!
Mine looks like this...
[0] =>
[1] => ttp://stage.xxx.com.au/%3Cnolink%3E
[2] => node/1183
[3] => ttp://stage.xxx.com.au/node/1183
[4] =>
[5] => rss.xml
[6] => node/424
[7] => ttp://stage.xxx.com.au/
[8] => taxonomy/term/137
[9] => ttp://stage.xxx.com.au/taxonomy/term/137
It looks even worse if expire_include_base_url isn't disabled!
If you think this is unrelated enough, I'll raise another ticket.
Here's what I'm currently doing (based on https://drupal.org/node/1936490#comment-7342340), although I feel dirty doing it;
Thanks,
Pobster
Comment #14
spleshkaPlease, check out new 7.x-2.x branch. This problem should gone.
Comment #15
spleshkaForgot to change version number.