Converting back to core comments fails with the following error:
An error occurred. /batch?id=44&op=do
Fatal error: Cannot use object of type stdClass as array in /sites/all/modules/comment_upload/comment_upload.module on line 387
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | nodecomment_convert_files_20090811.patch | 3 KB | iva2k |
Comments
Comment #1
sjtout commentedI'm seeing this as well. I've got Mailhandler, Listhandler, MailSave and Comment Upload trying to work together. I see this error when I attempt to receive an email through Mailhandler that Listhandler will be adding as a comment to an already created forum node. The email does get processed, but if it has an attachment, the attachment is lost.
This is with Comment Upload 6.x-1.0-alpha5
Also:
Mailhandler 6.x-1.8
Listhandler 6.x-1.0
Mailsave 6.x-1.3
Comment #2
merlinofchaos commentedCan you disable comment_upload.module and then try it? When the conversion is completely you can re-enable comment_upload. It's possible that it's expecting data that's not there when the comment is saved. I'm not sure there is much we can do to fix it. =(
Comment #3
iva2k commented@merlinofchaos
Your suggestion helps - the conversion goes OK with disabled comment_upload.module. It is not a very robust solution though. In addition, conversion process looses all files attached to the comments, which is very destructive.
I will use this issue to track my progress on it, since I have few ideas on how to make it work.
First, I dug a little bit into the code, and made progress on plugging the error without disabling comment_upload.module. I figured that comment_upload.module stores files info as arrays, while upload.module stores files info as objects. I fixed that within the conversion process with two small pieces of code. (No patch yet - this code is not complete. just for illustration)
in function nodecomment_convert_batch_process() / file nodecomment.convert.inc add this:
before this:
and add this:
before this:
Next, I will need to figure out how to deal with:
and
so that the files are not erased but transferred to new comment format.
But that's for a later session...
Comment #4
iva2k commentedI rolled a patch against latest -dev from CVS.
It works with the attached patch: file attachments are carried over from core comments/comment_upload.module to nodecomments/upload.module and back.
Please review for committing to 6.x.-2.x-dev.
Comment #5
iva2k commentednag nag
Any chance of this being reviewed?
Comment #6
merlinofchaos commentedSorry, not one of my higher priorities. I'm keeping this on my radar, not sure when I will be able to get to it.
Comment #7
iva2k commentednag nag. Happy New Year!
Comment #8
sjtout commentedI'm going to link to this issue: http://drupal.org/node/531690
Because it deals with what appears to be the same error, and has a potential way of addressing the error. I'm hoping someone with a better understanding of this code than I have will be able to opine on whether what's proposed in that thread makes sense. Thanks.
Comment #9
crea commentedI'll try to review this later. Problem is I use neither upload nor comment upload so it will take some effort to setup test environment.
Comment #10
crea commentedComment upload is still alpha...Why do you mark this as critical bug ? This could be even feature request, because you are not supposed to be able to magically transfer all metadata contrib modules could add.
Comment #11
iva2k commented"Problem is I use neither upload nor comment upload so it will take some effort to setup test environment"
I feel your lack of enthusiasm, and appreciate the time you will spend with this.
My reasons for critical:
1. comment_upload is "alpha" since 1 year ago, with almost 5000 reported users (http://drupal.org/project/usage/comment_upload)... I don't think it is an alpha - looks like very stable module. The only critical open bugs are PHP5.3 and Views2 integration (both with patches in review). There are many "released" modules out there with tons of critical bugs (check out pages full of views critical issues: http://drupal.org/project/issues/search/views?text=&assigned=&submitted=...).
2. Looses data without any warning. It is critical to everyone affected. Even with backups. If I remember correctly, the code in nodecomment conversion diligently wiped out comment file uploads. So it did care of contrib metadata, just in a wrong way.
3. One of very few reasons to use nodecomment module is to be able to attach files and filefields to comments. Given that nodecomment is new, the people trying it most likely had some solution in place, like... comment_upload. If you think of it, these 5000 users have a lot of data on their websites that would be lost during conversion and would require a lot of manual labor to convert. Either warn them of it LOUDLY in the documentation and on the conversion form, or commit the fix.
4. <700 users of nodecomment in a year? It would grow fast if this issue is fixed. For one, I was not able to use it before the fix. I had a live site that I wanted to move to advanced_forum, and nodecomment is (still) a requirement.
My strong opinion is that nodecomment is the right way to go conceptually, and core comment is a mistake. So I support development and use of nodecomment. It just needs few touches to get going and grow users support behind it.
Comment #12
crea commentedOk. Would be best also if users also test this patch for converting their real data (using backups, ofcourse). I can review the patch and maybe run test conversion with couple of files, but I don't know these modules enough to mark this RTBC.
Comment #13
jaymallison commentedI applied the patch in #4 against the latest 6.x-2.x-dev from 2010-May-11.
I uploaded it to my site and enabled, created a new content type for node comments, changed the content type used for a part of my forums to use the new node comment content type for comments. I let it do the immediate conversion. It converted 298 comments, most of which had comment_upload based attachments.
Everything appears to have converted successfully. All of my comment_upload attachments are showing as normal upload attachments on the new comments. No data loss as far as I can tell.
Thanks for the patch!
Now I just have to get these new node comments integrated with advanced_forum / author pane.... it hit the reset button on the style of my forum...LOL
Comment #14
crea commentedOk this looks good. Committed. Thanks!