Will PURL be ported to Drupal 7? When?
| Comment | File | Size | Author |
|---|---|---|---|
| #51 | port-purl-to-drupal7-1070222-51-D7.patch | 8.62 KB | webflo |
| #48 | port-purl-to-drupal7-1070222-48-D7.patch | 8.55 KB | webflo |
| #45 | d7-port-1070222-45.patch | 683 bytes | olofbokedal |
| #43 | purl-admin-warning-1070222-43.patch | 399 bytes | brenk28 |
| #34 | d7-port-1070222-34.patch | 6.66 KB | joelstein |
Comments
Comment #1
markwk commentedsubcribe
Comment #2
jpstrikesback commentedSub
Comment #3
mrsinguyen commentedsubcribe
Comment #4
paalj commentedsubscribe
Comment #5
ryan.armstrong commentedsub
Comment #6
jpstrikesback commentedHere's a first pass at this thanks to coder & coffee. I hope the coding standards upgrades were ok to throw in, the online coder upgrade tool didn't work when making a separate coding standards pass for some reason...so I mixed it in...
Things seem to work (or rather don't break everything), forms, tests sent some modifiers to the menu items...
TODO
- Implement the new Language API as needed???
- Find something that can use this or make more tests (Spaces anyone?)
- Sort out the tests (so Simpletest can see them)
- Use the new drupal_static where possible
- Make sure the _purl_form_alter() is looking in the correct spots for ['menu-name'] in menu_edit_menu & ['options'] in menu_edit_item
Cheers,
JP
Comment #7
jpstrikesback commentedOK second pass at this,
- Tests are fixed (they test things)
- Fixed some code style stuff & found another item to upgrade in purl_querystring.inc
- Tests show that adding a provider for anything other than Path modifiers is busted, don't know why yet, any insight appreciated
TODO
- Figure out if language_initialize still affects $_GET['q']
- Use the new drupal_static where possible
- Change any old DB methods to new API (db_delete @597)
Comment #8
tobby commented@jpstrikesback, I've applied your patch from #7 and created a 7.x-1.x branch from that. Most of the functionality (at least, the path-based stuff) is working. The tests still had some errors, but this is a really good start. Thanks for the patch.
Commit: http://drupalcode.org/project/purl.git/commit/411d79d
Comment #9
jpstrikesback commented@tobby, Awesome! I'll try and get more into the test failures as the weekend permits : )
Comment #10
henrijs.seso commentedsubscribing
Comment #11
jhedstromsubscribe
Comment #12
jpstrikesback commentedK
The first reason it's failing is that in purl_modifiers() when caching the modifiers it only caches the first method requested...which likely means the 6.x dev branch is having some fun there as well.
Once I removed the modifier cache then I needed to patch up the purl_querystring->rewrite() method to make any empty $options['query'] array a string and not touch it after that, i.e. I found an errant 6.x item (drupal_query_string_encode()) and was replacing with newer stuff (drupal_http_build_query()) but realized it actually wasn't required and was breaking stuff cause once it runs thru url() it get's treated.
Patch forthcoming with or without purl_modifier caching...
Comment #13
jpstrikesback commentedAnd the patch. All tests pass for me, I'm interested in why $_GET['q'] and $_REQUEST['q'] don't hold the same values at hook_init() in D7 but it works so whatever. This one is without the purl_modifier cache as that needs some work...
Cheers,
JP
EDIT: Note: This patch applies to the 7.x-1.x branch.
Comment #14
jpstrikesback commentedFound a new issue it seems:
- when using the Purl Test Module while under the influence (of say /foo), rewrites work great everywhere but when going to the front page by clicking the "Home" icon, this produces a 404 as it tries to send us to /foo/
<front>instead of /foo/node (which is set as front)Comment #15
glennpratt commented@jpstrikesback: This patch should apply (at least before your latest) to 7.x.
http://drupal.org/node/684572#comment-4276672
Comment #16
gadams commentedsubscribing
Comment #17
jpstrikesback commented@glennpratt, applied & tests pass, thanks! I've rolled a patch with the fixes from #13, from http://drupal.org/node/684572#comment-4276934 & fixes to issues with
<front>mentioned in #14.Regarding #14, the reason this was happening is that in D6 custom_url_rewrite_outbound() is called directly after
'<front>'is rewritten to '', in D7 this little rewrite happens after hook_url_outbound_alter() is invoked and so when a path modifier is present Purl changes the path and the'<front>'string in path is now something like'somepath/<front>'which of course get's missed by the little check for equality in url()...so I stuck the same thing inside purl_url_outbound_alter():which means that nothing can react to that special path string down the line, which is perhaps inelegant (but maybe no less than
'<front>'itself)...thoughts anyone?Comment #18
jpstrikesback commentedoh yeah...the patch...
Comment #19
jpstrikesback commentedcarp, one more time, and this time with the right patch...
Comment #20
pyrello commentedSubscribing
Comment #21
joelstein commentedFor anyone who was like me and didn't know where to find the D7 branch to which these recent patches apply, visit the following link and click "snapshot":
http://drupalcode.org/project/purl.git/tree/refs/heads/7.x-1.x
Okay, I applied the patch at #19, and then enabled the module, but all I get is a redirect loop on any page except the homepage. Any idea why?
Comment #22
jpstrikesback commented@joelstein - can you paste the contents of your purl_init()?
Comment #23
joelstein commentedSure:
Comment #24
jpstrikesback commentedhuh...looks like the patch applied...
1st see my question in #13.
This is the behaviour I noticed at the beginning and it was just that $_REQUEST['q'] was empty (strange that GET & REQUEST weren't the same?) so I put $_GET['q'] in it's place and all was well (i.e. the path requested was in $_GET['q']), try putting $_REQUEST['q'] back like so:
$_GET['q'] = $q = $_REQUEST['q'];See purl_get_normal_path() to see why it is deciding you get to go to the front for everything.
I'm very curious about this cause it is perhaps server related.
Comment #25
joelstein commentedI don't know much about how $_GET and $_REQUEST get set in D7.
I changed
$_GET['q'] = $q = $_GET['q'];to$_GET['q'] = $q = $_REQUEST['q'];, but now every page automatically redirects me to /node.I think you misread what I wrote. It wasn't taking me to the front page for every request. The front page loaded just fine. However, any other non-front page would just give me a redirect loop in my browser. Make sense?
Would you mind attaching the latest version of the module here as a zip, in case I patched something incorrectly?
Comment #26
jpstrikesback commentedAack I did misread, apologies.
My latest is attached, it should match 7.x with the patch from #19 applied.
If you are getting a endless redirect then I haven't experienced that yet. Try the version I've uploaded and if it's still happening try running the tests and let me know which ones fail.
Cheers,
JP
Comment #27
joelstein commentedThanks... I dropped your module in, re-enabled, and I'm still getting the redirect loop. Can't run the tests because... I'm getting a redirect loop. :(
However—I just created a fresh install of D7's latest dev, and then only installed your PURL module and Ctools (7.x-1.0-alpha4), and now I don't get the redirect loop.
So, it looks like it's something unique to my setup. I'll investigate further and share what I find.
Comment #28
jpstrikesback commentedInteresting, I'd love to know what caused it when you find out. By chance were there any modules in place using purl_goto()?
Comment #29
joelstein commentedNope. After more digging, it appears to be caused by having both Persistent URL and Global Redirect (7.x-1.x-dev) enabled. Either can be installed without the redirect loop. Install them both and the redirect loop appears. Can you take a look and see what would cause this integration problem? Is it possibly a module weight issue?
Possibly related:
Also, I got an error when using the purl_save() and purl_delete() functions, which are resolved by the attached patch.
Comment #30
jpstrikesback commentedhttp://drupal.org/node/900622 without getting into it too much it looks like this is the one to watch, from the description there it would seem that ATM the two are incompatible because of what Global Redirect does to $_GET_['q'], but maybe weighting it after PURL could help?
Comment #31
joelstein commentedPURL is already lighter than Global Redirect.
To address your question in #13 (from http://drupal.org/node/877696#comment-3401302):
Comment #32
joelstein commentedOne other thing I noticed is that URLs with path aliases aren't getting rewritten. Is this because hook_url_outbound_alter (where PURL rewrites the URL) happens before path aliasing does in url()?
http://api.drupal.org/api/drupal/includes--common.inc/function/url/7
Notice hook_url_outbound_alter() gets fired, then shortly after that the $path variable gets overwritten with the alias.
Perhaps another way to do this is to rewrite the $options (instead of the $path) by setting the $options['prefix'] value (see attached patch). Thoughts?
Comment #33
olofbokedal commentedThe purl_goto function shouldn't wrap the options array in another array when calling the url function. Submitting a patch for this small fix.
I've also noticed that purl_save makes a call to purl_load (line 598) with the $modifiers argument being NULL, causing the foreach loop to fail. I haven't fixed this yet, since I don't know exactly what $reset does.
Comment #34
joelstein commentedHere's a patch which applies to the D7 branch, and incorporates the patches from #19, #29, #32, and #33 above.
Comment #35
jpstrikesback commented@joelstein & ojohanssen, cool, I'll get a chance to play/test very soon! Do tests pass?
Comment #36
joelstein commentedI haven't run the tests. How do I do that?
Comment #37
jpstrikesback commentedTo run tests in D7 enable the core "Testing" module, then enable "Persistent Url Tests" and head to:
/admin/config/development/testing
Then check off the tests you want to run (i.e. Purl) and click "Run Tests" at the bottom.
Cheers,
JP
Comment #38
joelstein commentedPretty cool! You should probably make Testing a dependency of Persistent URL Tests.
The patch in #34 causes 9 tests to fail. However, if I remove the code added in #32, they all pass.
We really need something for the issue reported in #32. In D6, custom_url_outbound_rewrite() was called after the path alias was set. However, in D7, hook_url_outbound_alter() is called before the path alias is set. In other words, URLs which are rewritten by PURL will be rewritten again by url(), thus losing the path prefix.
That's why I think a good solution would be to put the path prefix in $options['prefix'], which works in my manual site testing, but somehow fails the automated tests.
Any ideas?
Comment #39
g8 commentedSubscribe
Comment #40
that0n3guy commentedsub..
Comment #41
tebb commentedFollowing.
Comment #42
m4oliveisubscribe
Comment #43
brenk28 commentedI was getting a notice from purl after editing and saving a menu item:
Undefined index: menu_name in purl_item_edit_submit() (line 311 of purl/purl.admin.inc).
This patch fixes that. The modifier does seem to be saved at all, so will need to address that.
(This patch was applied to code that had the patch in #34.)
Comment #44
ademarco commented+1
Comment #45
olofbokedal commentedI've created a fix for my other issue in comment #33:
"I've also noticed that purl_save makes a call to purl_load (line 598) with the $modifiers argument being NULL, causing the foreach loop to fail. I haven't fixed this yet, since I don't know exactly what $reset does."
I've studied the code, and I can't figure out why purl_load() is called from purl_save() and purl_delete() without specifying any modifiers. So what I've done, was simply to remove those calls. They aren't used anywhere else in the module.
Comment #46
joelstein commentedSomebody should merge the #43 and #45 patches into the comprehensive patch in #34.
Comment #47
jpstrikesback commentedI would but I'm waiting for the maintainers to weigh in here (no pressure or anything, just wondering on thoughts from P2 peoples on the direction they are taking this baby)
Comment #48
webflo commentedHi rerolled all patches. I had some problems with query strings in $options['query'] in purl_goto(). $options['query'] must be an array but some implementations pass an string.
Please review.
Comment #49
dgastudio commentedsub
Comment #50
jide commentedscribe.
Comment #51
webflo commentedFinally all tests pass. Reworked the patch. Development sandbox at http://drupal.org/sandbox/webflo/1179340
Comment #52
felipe commentedsubscribing
Comment #53
Geex2011 commentedsubscribe+
Comment #54
takki commentedI was testing the purl module on d7 but i'm getting a foreach error upon creating a new purl. In the purl_save function purl_load is called with NULL as $modifiers. If you look at the purl_load function, the function starts with a foreach of $modifiers. Don't really understand why purl_load function is in the purl_save function like this.
Comment #55
olofbokedal commented@Takki
There is an easy fix for this in #45. It has worked fine for me ever since.
Comment #56
takki commentedThanks ojohansson. I must have skipped your patch, all is fine now.
Comment #57
ddanier commentedsubscribing
Comment #58
likewhoa commentedsubscribing
Comment #59
wmostrey commentedThis patch for the D7 version doesn't place nice with the globalredirect module though, an issue PURL has had before in Drupal 6: #623886: Conflicts with globalredirect. Is there anything we can do on this side?
Comment #60
JGonzalez commentedI was unable to clone this with git, getting a "remote HEAD referes to nonexistent ref".
Any ideas?
Comment #61
webflo commentedMy sandbox has no master. Try
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/webflo/1179340.gitComment #62
NaX commentedIs there any reason why there has not been a 7.x-1.x-dev release yet. I see there is 7.x-1.x in git and webflo has done some work in his sandbox. I don't see any reason why we cant merge all the work done here and do a dev release and close this issue.
Comment #63
NaX commentedIs there any reason why there has not been a 7.x-1.x-dev release yet. I see there is 7.x-1.x in git and webflo has done some work in his sandbox. I don't see any reason why we cant merge all the work done here and do a dev release and close this issue.
Comment #64
timonweb commentedsubscribing
Comment #65
febbraro commentedI added a dev release so we can now file issue and patches against it. I would be happy to integrate the work webflo has done as a starting point.
Comment #66
glennpratt commentedWoohoo!
Comment #67
8thom commentedsub