First let me say that Content Distribution is a great module and exactly what I was looking for.
Content Distribution works great with all CCK-fields EXCEPT Imagefield-fields. If I try to send a node with a image (in a imagefield), the newly created node on the receiving drupal portal has no image (but all the other data). The send image can also not be found in the file-directory of the receiving drupal portal.
I looked in the code of the content_retriever_module and found a problem:
function _content_retriever_save_file
...
case 'cck':
...
The data of $content_table is wrong for imagefields. Imagefields are not stored in 'content_type_'.$node_type but 'content_'.$field
But it does not work even if I change that line.
With the original code I get an error on the receiving side, that a column does not exist.
With the changes above, this error is gone. But with both ways, I see no image in the nodes of the receiving side :(
Perhaps someone can give me a tip where I must search for the problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | content_retriever_process_filefield.content_retriever_node_processCCKMultiField.patch | 1.98 KB | luketsimmons |
| #4 | content_distribution-683480-4.patch | 1.27 KB | agileware |
Comments
Comment #1
vaafri2 commentedOK solved the problem:
1. content_retriever.module
I had to change
$content_table = 'content_type_'.$node_type;to$content_table = 'content_'.$fieldin line 447 (V 6.x-1.2).2. To get images, I had to change the permissions on the distributor site. I had to give "anonymous user" the right to "get any binary files".
Now, I am able to distribute nodes with imagefields.
Comment #2
joachim commented> I had to change $content_table = 'content_type_'.$node_type; to $content_table = 'content_'.$field in line 447 (V 6.x-1.2).
That looks like a difference between a single-valued field (where it's stored as extra columns on a table for the node type) and a multi-valued field (which gets its own table).
If the module doesn't take that into account, that's a serious problem.
Comment #3
joachim commentedIndeed, it does not. The code assumes that it's a single-value, single type field:
We need to either use the CCK API to get this information, or just check the db_storage key on the field array:
Bumping the version to 6--2, as it'll get fixed here first.
Comment #4
agileware commentedHere is a patch for the second solution in #3.
The CCK API could also be used but would be more overhead.
The second solution seems better seeing as we already have the required information available.
Fixed the errors I was getting. Which for the record were unknown column sql errors.
Comment #5
joachim commentedSince this issue was filed I came across this problem working on another module.
The CCK API for this is actually quite simple:
I think we should use that as it's easier to read and more robust in the event anything changes in CCK's internals.
Comment #6
luketsimmonsHi,
Thanks to joachim's idea, I've created a patch that appears to work with the use of content_database_info().
I've tested it with a content type that has both a single use imagefield and a shared imagefield and it works.
Let me know if there are any problems.
Thanks,
Luke
Comment #7
joachim commentedGreat work, thanks!
I've not tested this with a multivalued field, just a single, but it all looks fine.
Do remember to roll your patches from the base directory of the project another time though -- ie from /modules/foobar, not any deeper.
Committed: #683480 by luketsimmons, Agileware: Fixed filefield processing to work with multivalued fields.
Comment #8
luketsimmonsHi joachim,
OK cool, no worries about the patching paths, I'm used to doing them more locally but it makes sense to roll them from base.
Thanks again,
Luke