Spaces/PURL has an annoying "bug" at the moment (at the very least, unexpected behavior). I recently converted my OG-based site to spaces/features/context. After doing that, I noticed that spaces tend to "drift" to unexpected places. Once a space is set, it stays set until another space takes over or the purl preset is disabled. This is a /good/ thing most of the time (that's what it's designed to do) but in a few contexts it's really annoying namely searching and user pages.
This bug is easy to see on Open Atrium. Go to a user profile page and then click on a link, say to a book page. When you go there, spaces/purl thinks you're still in the user space instead of where you're actually at, a group space where the book page was created.
What I did was add this snipped of code to purl.module
function purl_url_rewrite(&$path, &$options, $original) {
static $global_elements;
$user_page = strpos($_GET['q'], 'user');
$search_page = strpos($_GET['q'], 'search');
($user_page === false) ? "" : $options['purl']['disabled'] = true;
($search_page === false) ? "" : $options['purl']['disabled'] = true;
It'd be nice though if there was an admin page where we could set these variables.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | 608916.28-purl-disable-path.patch | 9.64 KB | mrfelton |
| #27 | 608916.27-purl-disable-patth.patch | 9.25 KB | mrfelton |
| #18 | purl_608916_20100917.patch | 11.19 KB | dtarc |
| #15 | purl-608916-20100617.patch | 8.96 KB | owen barton |
| #5 | 608916_20100423_2.patch | 11.12 KB | yhahn |
Comments
Comment #1
marcushenningsen commentedI'd also like to know if this is intended behaviour, and I'd probably prefer a more generic solution. I'm also not sure if this is related to purl of spaces.
Another very simple example of this annoying behaviour is when trying to reach a page outside a space from within a space. Say our viewing some content inside the group "employees" and want to go to the regular page /contact through a primary menu link, purl automatically renames the url /employees/contact.
Shouldn't purl only rewrite url's within spaces?
Marcus
Comment #2
yhahn commentedWill look into this. I think it's a good idea (to exclude PURL rewriting by path) but I need to figure out how it will work -- a set of paths per provider perhaps?
Comment #3
webflo commentedThis patch is a first very raw version. You have to create a new table called purl_rules with 2 colums.
1. mode [type: tinyint (4)]
2. urls [type: text]
With this patch it is possible to excude path from rewriting (like admin/*). This hole path-matching is inspired/copied from block module. Please review and comment. This patch is for DRUPAL-6--1-0-BETA10
Comment #4
kyle_mathews commentedSeems like a reasonable approach. It'd be great to get this in as it's a fairly common source of bugs / inconsistencies. I'll try to find time to test this next week.
Comment #5
yhahn commentedI've done some work on this patch and refactored it quite a bit.
Summary
admin/settings/purl/disabledand determine which providers each applies to granularly.drupal_alter()forpurl_disabled_pathso providers can programmatically exclude paths.Would love some testing.
Comment #6
kyle_mathews commentedThe patch isn't applying cleanly. What version of PURL is the patch from?
Comment #7
yhahn commentedCVS checkout of DRUPAL-6--1 ?
Comment #8
kyle_mathews commentedFigured it out. Patching noob error. Used
patch < file.patchinstead ofpatch -p0 < path/file.patch.Anyways, it's working as billed! I added
users/*and now the purl prefixes are being removed from links to user pages.Is it possible for the paths to match against the system paths not path aliases? I entered
user/*first but that didn't work. I had to use my pathauto aliases instead.Comment #9
vaartio commentedWhy does the latest release (beta11) not include this patch?
Comment #10
yhahn commentedWe're still testing and looking for feedback on this feature, as it's quite a significant change (and introduces a slight performance hit).
Let me know if you have some feedback on it!
Comment #11
kyle_mathews commentedWas going to re-roll the patch but it applies cleanly still against beta12.
Also, I've been using this patch in production for the past month without any known problems.
Comment #12
kyle_mathews commentedAnother thought -- would it be possible to use Context to disable purl? That'd allow for more sophisticated purl disabling.
Comment #13
penguininja commentedI'm still wrapping my head around PURL+Context, but it seems like having a Context reaction to disable PURL rewriting could add a lot of flexibility. Unfortunately I'm not able to contribute code, but I'd be happy to test and give feedback if this is something that makes sense to pursue.
Comment #14
mxtSubscribing
Comment #15
owen barton commentedReroll of #5
Comment #16
cwaring commentedSubscribing
Comment #17
kyle_mathews commentedTested this patch and it applies cleanly still to beta13.
Any reason why this hasn't gone in yet? Young, are you thinking about meeting this need in a different way?
Comment #18
dtarc commentedI couldn't get the patch in #15 to apply cleanly to beta13 (purl_subdomain.inc failed)
I have rerolled that patch in #5 here.
Paths are getting properly excluded, no ill effects so far.
Comment #19
nenad.scekic commentedYES it helps and work like charm that ;)
/admin/build/menu-customize/navigation/edit
Persistant URL behavior:
"Discard" doesn't work
5x clean install with diferent order of setup. but every time when i have instaled og, spaces_og,menu og , purl (path, subdomain...)... when i try /admin/build/context/add or /admin/build/features/create i get redirection loop.
1. I patched purl.
2. /admin/settings/purl/disabled add entry admin/* ()
and now it' working !!!
P.S. is there other way to fix problem with purl beside of patch ?
Comment #20
ukrdrupal commented...subscribing
...I find this whole issue really annoying, right out of the box. I *had* to install PURL, just to use Spaces, which is required by yet another module. Doesn't make sense to me at all. I already use pathauto, which is very powerful.
I am having a real problem now. I had already set-up the creation of my organic groups to have their names (paths) automatically created, based on the title of the group that the user chooses. Now PURL is totally messing that up and is REQUIRING me to enter another path.
I tried to *uncheck* "Path" from here: admin/settings/purl/types
The little asterisk, which signifies being required goes away on the group's creation page node, but yet it is STILL required! Can someone help?! What am I not getting here?
Thanks!
Comment #21
ukrdrupal commentedI did take the time to watch this great presentation:
http://www.archive.org/details/TheHeartOfOpenAtriumContextPurlAndSpaces_782
I do see the *need* for PURL. ...But how to get everything to play nicely. This is breaking my brain right now. And it does seem that there is a real conflict in play here.
Comment #22
ukrdrupal commentedI have been experimenting with the PURL and the use of the Query String and setting a key. Things seem to go smoother. However, it seems like this PURL is more like a spider web you get caught in, rather than a persistent URL that is beneficial. Once you get in to the PURL of a group, the whole site then takes on this group PURL. I don't like this at all and I think it will not be intuitive for my users one bit. What I need to know is how to get it to work when I want it to work, but have it off 99% of the time. Again, I only installed PURL, because I was *required* to, not because I actually want to use it. Please help.
Comment #23
dtarc commentedAccording to the Spaces module page PURL is only recommended, not required
Comment #24
owen barton commentedI think ukrdrupal was meaning spaces_og, where purl is indeed required:
http://drupalcode.org/viewvc/drupal/contributions/modules/spaces/spaces_...
Comment #25
ukrdrupal commentedThe module that I actually was needing to install was views_gallery, which has a module for og. So, this is where the spaces_og would come in, I think, and then therefore the PURL. Regardless, I think there is a conflict, as described in this thread. I see practical problems, where PURL just takes over the site, once you enter into a group area (space).
Comment #26
designtodigital commentedI've got this patch from #18 running on a live site. Works great. I highly recommend that this be committed to the main trunk.
Comment #27
mrfelton commentedHere is the same patch as #18, rerolled to apply cleanly to code in git.
Comment #28
mrfelton commentedPrevious patch didn't include the new files. Revised patch attached.
Comment #29
mrfelton commentedSo I gather this thread is about not rewriting the URL on output in certain situations, to help ease the process of switching out of purl context. It seems to be kind of linked to a problem that I'm facing, but not quite as the problem I'm facing is with URL's being written on incoming requests when thy shouldn't be. For example, if a system path happens to contain the purl path prefix in it's path, it becomes impossible to access that url, since the path prefix gets stripped off and you end up getting sent to a non-existant path (the original path minus the purl prefix), resulting in a 404.
Would it make expand the scope of this patch so that you could also disable paths from being rewritten on incoming requests (rewrite_inbound) as well as in rewrite_outbound?
Comment #30
foredoc commentedI have a similar "drift" problem here.
I am using spaces og, and have a block "my groups" enabled. If I try to navigate to another group(B) from current group(A) context by clicking the link in "my groups" block, spaces/purl will still keep me in the group(A) space.
Looks to me that EXCLUDE URL is not the proper solution for my problem.
Any ideas?
Thanks.
Comment #31
foredoc commented@kyle_mathews, I did not experience the "drift" problem on :
https://community.openatrium.com
Basically, in my user page, when I hover to one issue that I created, the link looks like:
https://community.openatrium.com/node/[nid]
When I click it, it tooks me to:
https://community.openatrium.com/issues/node/[nid]
Any ideas how to accomplish this?
Thanks.
Comment #32
fuzzy76 commentedNumerous people have run this in production now, for all intents and purposes this patch has been ready for years.
Comment #33
liquidcms commentedD7?
Comment #34
liquidcms commenteddoesn't seem like this is ever going to be committed to D6 so figured it might be ok to change version over to D7 and see if we can get it done there. i'll likely look at doing up a patch for this in the next couple days.