Closed (fixed)
Project:
CSS
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2009 at 07:16 UTC
Updated:
22 Jun 2011 at 09:11 UTC
Jump to comment: Most recent file
The current implementation does not support node versions at all. It needs to, as otherwise there is no way to roll back CSS changes along with a revision.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | adding_revisions_support-358605-1-fax8.patch | 5.9 KB | fax8 |
| #10 | revisions.patch | 5.53 KB | Crell |
| #2 | css.revisions.patch | 6.66 KB | fax8 |
Comments
Comment #1
fax8 commentedI agree. I'm working on this one.
Comment #2
fax8 commentedThe attached patch implements support for node revisions in css module.
Please test this patch. These are the tests I'm interested:
Comment #3
fax8 commentedThe above patch change the behaviour of using @import "?q=css/get/x"; to reference the CSS rules of other nodes.
Before x was the nid (node id) while it is now the vid (version id).
I'm not sure if it could be useful also a way to reference the latest CSS version of a css attached to a node.
With the implementation in the patch if one reference a CSS attached to a specified version of a node, and then a new version of the referenced css is available, nodes referencing the old version will be not updated with the new versions.
Probably the best workaround would be provide another hook (eg. css/get_nid/x) where x is now the nid. This hook would always returns the latest revision of the CSS.
Any other idea?
Comment #4
Crell commentedI'd actually argue that we should move away from the dynamic call, as that results in two hits against Drupal. Instead, do what imagecache does a and feed in a path to drupal_add_css() (that may need to be uncacheable) that points to $files_dir/nodecss/$nid, which in turn is a menu callback that generates a file at that location. That would avoid the second hit against Drupal itself on subsequent requests. That's probably a separate issue, though.
It probably does make sense to go by vid here, though. I'll try to test this patch when sometime soon.
Comment #5
whispero commentedHi,
Just chasing this up.. Has this patch been tested yet and if so what feedback if any is there?
- Whispero
Comment #6
Crell commentedUnfortunately I had a number of things explode on me in the past few weeks so I've not been able to do so. I'll let you know when I do. :-/
Comment #7
whispero commentedOk Crell,
No probs
- Whispero
Comment #8
fax8 commentedStill looking for feedback for the patch above. Anyone helps?
Comment #9
Crell commentedRight, well, the patch in #2 no longer applies anyway, so I can't test it.
Comment #10
Crell commentedRight, so it looks like the patch in #2 was written for Drupal 5 to begin with. Here's a new version for Drupal 6. I also did some documentation cleanup while I was in there to better match Drupal's documentation standards because my brain was having a parse error otherwise. :-)
Comment #11
fax8 commentedThanks Crell. Unfortunately there is a problem in the update routine. Same problem also on my D5 patch.
We both did a simple
While this works for nodes where revisions have never been used it fails if there is a revisions: it happens that nid != vid and thus data css is lost (it actually remains attached to the first revision, I think).
Comment #12
fax8 commentedOk Larry, I think I fixed the problems in your patch. Here are the changes I did on your code:
I modified it to be UPDATE css c SET vid = (SELECT vid FROM node n WHERE n.nid = c.nid) which should fix the problem I explained above
Attached patch against D6-dev with the above fixes. Users interested in getting this features into css module please carefully test this.
Thanks,
Fabio Varesano
Comment #13
jdipper commentedThe only 'bug' (if we want to call it that) that I could find is if the following has happened:
1. A revision for a node (with css) is created (i.e. rev 1 -> rev 2).
2. The patch is applied
3. The node is then reverted back to rev 1.
Rather than the CSS block not being reverted (i.e. the content remains the same as rev 2), it 'reverts' to an empty text box.
Effectively, you lose the CSS info if you revert to a version that was made prior to the patch was created.
Honestly, I am not sure if this is a bug that can be fixed. Perhaps a check could be added to see if a valid css historical revision exists - but that might get complicated.
Other than that, the patch seems to work.
Jack
Comment #14
fax8 commentedOf course it won't work doing that.. anyway, I don't think this is something we should take care of.
Thanks for testing the patch, I'm going to include it in the next revision.
Comment #15
jdipper commentedAgreed, it would be fairly hard to work out the logic. Although it's probably best we warn folks that reverting back to a node revision prior to installing the update will delete the css.
Jack
Comment #16
jdipper commentedQuick question... when can we expect a new revision?
Jack
Comment #17
Crell commentedI have committed #12 along with an update to the install.txt file regarding the edge case noted above. It should be in the 6.x-1.x branch as soon as it regenerates.
fax8, when do you want to roll a new release?
Comment #18
fax8 commentedI think we can roll out a release for 6.x right now.. the code has been under testing for quite some time now and I think it's ok for a stable 6.x version. You should have the permissions to roll out a release, please do that if you have time. Otherwise, I'll do that, just let me know.
Regarding 7.x, I think I do agree with the people asking for merging with Code Per Node.