I wanted to create a view that lists all live nodes. I selected the filter "Node Revision: Content Moderation state" and the value "live". None of the live nodes showed up. I set the value to "none" and then some of the live nodes showed up... I'm guessing this has something to do with me enabling the module after some nodes were already created
Problem 1 - I had a look at the database: seems like the live state for nodes/revisions is not saved in the table "content_moderation_revision_state". And views uses this table for the filter. I haven't looked at the code to try and fix this as I'm not sure if this is a bug, or by design...
Problem 2 - Nodes created before enabling the content moderation module never show up in the view. Even after editing them.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | content_moderation_i18n_tnid_sync_fix.patch | 950 bytes | weseze |
Comments
Comment #1
eugenmayer commentedThe live state is saved in the content_moderation_revision state. Existing nodes, which existed, when the module has been activated, have no entry in the live table, thats correct. That rather a feature request
i have the filter working on my installation but only used it for non-live states, so maybe there is a problem.
- Ususaly when a node is in the transaction aprove->live a entry will be created in the content_moderation_revision_state table. if that does not happen (did happen for me), this is a bug
- for existing nodes, which do not yet have been moderated and set to live (eventhough they are live already, but no transaction happened) this state is not yet there.
AFAIK this is a feature request:
Create live state for all exisiting nodes when activitatin content_moderation.
Please confirm if i got that right :)
Comment #2
weseze commentedyes and no :)
scenario 1:
node created before installing the module is not in the table: there should indeed be a feature request for this
scenario 2:
node created before installing the module and then edited and set to live afterwards. These nodes have the status "none" in the table "content_moderation_revision_state" instead of "live".
scenario 3:
node created after installing the module and set to live. These nodes also have the status "none" in the table "content_moderation_revision_state".
So I think there is a bug in my install. Or can I safely use "none" as "live"?
Comment #3
eugenmayer commentedWell, only the last "live" version has the "live" state in that table, not all yet "live" versions. Those informations are then saved in the history table. I can see a fairly good point in list "all live revisions of a node". But this sounds more like a feature request once again.
scenarion 1:
Please open a feature request :)
scenario 2:
Iam confused because you talk about nodes, not revisions of those. Please rephrase so i can better follow you. In general the _last_ live-revision has the "live" state in that table. "old live" versions have the "none" state actually, but see my first sentences for this issue.
scenario 3: same here, could you use "revision" and redeclare? :)
Thanks for the input!
Comment #4
weseze commentedboth scenario 2 and 3 I'm talking about revisions of the node. Sorry for the confusion :)
So if I have a look at the table, none of the revisions listed there have a live state, even if they really are live revisions.
Comment #5
eugenmayer commentedWell that needs some investagation. Did you try this on a clean D6.16 installation with content_moderation installed?
What kind of DB do use? Mysql or postgresql? do you have any errors in the watchdog
Comment #6
weseze commentedit is a clean install of Drupal 6.16 on a mysql database. The watchdog doesn't contain any errors...
Can I debug (put some print_r() or something) somewhere to determine what is going wrong?
Comment #7
eugenmayer commentedWell now its time for me to get some more debug details. Guess you have to wait until i have fixed it, maybe next week, pretty busy this one.
Anyway thanks for all the informations
Comment #8
senthil.na commentedHi i got a small hint, the INSERT query is not used for tables content_moderation_node_history, Browse content_moderation_revision_state
May it will be useful to debug..
Comment #9
weseze commentedsorry, posted in wrong topic. Can I delete my post?
Comment #10
eugenmayer commentedI guess not :) dont worry, happens
Comment #11
weseze commentedI changed the query in the function _content_moderation_set_live($vid, $nid) and it seems to be storing the live state correctly now. I don't know if there are going to be other problems with this change.
Changed line 139 in content_moderation.workflow.inc from
to
Comment #12
eugenmayer commentedYour fix is perfectly correct.
The problem was
Here, first the new revision is set live and then after that, ALL live revisions are set to none, including our new revisions. So your login included "remove all live states except the current new created one", which is identified by the vid.
Thanks for the contribution. That fix will be inlcuded in 1.3
Comment #13
eugenmayer commented