Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is also one of the main modules preventing me from going to Drupal 7, especially since tons of our forum posts have images and so on. Hopefully an upgrade path will arise, thanks for the hard work everyone!
Install the module on a site already upgraded from Drupal 6 that had comment_upload. (Just enable the comment_upload module no matter what directory it's installed in)
Run update.php
Disable and uninstall the module to remove the remains of D6 tables and variables.
Issues:
It's up to you to configure the field settings after the migration.
This brings the comment_upload files in as imagefields, although one of the options in the D6 version was basically a filefield. That means that you can't work with anything except image files. Somebody could easily provide a patch that changes the file type to a filefield when the variable 'comment_upload_images_<type>' variable is 'none'.
For every run of update.php it´s another filename, so perhaps something gets done with exactly one file per update run...
Anyone else getting this error?
I´ve already tried it with all non-core Modules disabled, same issue...
Google knows a lot about, but nothing works for me ;-)
Thank you!
But I´m not realy sure, if this is realy what happens to me...
All the Attachments of my Site are unter /files, and there is for sure no file which is an upper case version of: smf-fileupload-448.JPG
So for my site this seems not to belong to Case-Sensitivitie!?
Ehh!?!
I just compared the PDO-Exception in my Error and the Error in the other Issue....
Why is the filename in my Message: 100_5408.JPG and the URI: public://smf-fileupload-448.JPG ???
As I see it now, something went wrong by updating from D6 to D7 ?!
Drupal.org won't care about this module for D7, since we're not going to have files attached to comments anymore. See #1545922: [META] Issue page redesign for the full story.
RRRrrr, I wish I could say that the file in #32 worked for me, but it didn't.
I had to edit the "install" file, since my database uses a prefix (tables are "drupal_node" instead of just "node" for example). Basically, anywhere in the file where there was a SELECT command, I had to change the names of the tables that it was selecting.
So like on line 97, instead of
$result = db_query('SELECT DISTINCT type FROM `node` n, `comment_upload` cu WHERE n.nid = cu.nid');
i have this instead
$result = db_query('SELECT DISTINCT type FROM `drupal_node` n, `drupal_comment_upload` cu WHERE n.nid = cu.nid');
But even with those fixes, I still got an error message when I ran update.php:
The following updates returned messages
comment_upload module
Update #7001
Created field_comment_upload fields on types forum
Moreover, it has a Comment Upload file field formatter! So it can be used as a complete replacement of the D6 Comment Upload module for D7. Read more in README.md
If people are interested and maintainers don't mind it's possible to have this module as 7.x-1.x branch of Comment Upload module here on drupal.org.
Enjoy the module! I hope it will be useful for the community.
Konstantin
FYI: I did a successful migration using migrate_d2d module. Here’s what you need to do:
Duplicate the migrate_d2d_example folder inside the migrate_d2d module (just to keep the original as a backup), make it visible, rename it to get a module that you can modify to your needs.
Implement your migration classes, following the example code. Note that the current example does not include comment nodes, but they are straight forward.
The current example code also has a bug: In migrate_d2d_example_migrate_api() the $api array is created with a wrong nesting. The key 'migrations' needs to be at the top level of the array.
So basically this boils down to simply extending the query to retrieve all attached file IDs in a single result row, separated by commas. This seems to work only with MySQL or MariaDB, although I haven’t checked if other databases would possibly support this too.
With other databases, one would need to retrieve the file IDs in a separate query on a per-row basis. IIRC, the migrate API provides something like prepare_row() or similar that could possibly be used.
In any case, once you got the fid’s separated by commas, you’re fine to use this solution.
Comments
Comment #1
Heine CreditAttribution: Heine commentedAs it is a requirement for Drupal.org, it most likely will be ported, eventually.
Comment #2
Heine CreditAttribution: Heine commentedOr what's also likely, replaced with the Drupal 7 field api + filefield.
Comment #3
Heine CreditAttribution: Heine commentedAs I was getting ready to spend an afternoon on fieldable comments for D7, I found that they already are due to #504666: Make comments fieldable.
So, there will not be a comment upload for D7. An update to convert the current files to fieldapi would be a good idea.
Comment #5
svenrissmann CreditAttribution: svenrissmann commentedWhat´s about an Update path from Drupal 6 - Comment Upload files to Drupal 7 Filefields?
Comment #6
svenrissmann CreditAttribution: svenrissmann commentedPlease excuse me, but I think it´s ok to reopen this one....!
Comment #7
joachim CreditAttribution: joachim commentedThis would help with the upgrade path to FieldAPI: http://drupal.org/project/field_convert :)
Comment #8
blavish CreditAttribution: blavish commentedstill no solution>?
Comment #9
StudioARE CreditAttribution: StudioARE commentedThis is one of the very few modules that keeps me at D6.
No patch in issue, status updated.
Comment #10
izus CreditAttribution: izus commented+1
Comment #11
izus CreditAttribution: izus commentedHow do you use #3 and/or #7 to make it work after the D6->D7 upgrade ? does it need a lot of work or there is a "magic" way ?
thanks
Comment #12
joachim CreditAttribution: joachim commentedfield_convert in #7 is a framework for writing an upgrade path. It needs a fair bit of work, probably a day or two.
Comment #13
RikiB CreditAttribution: RikiB commentedThis is also one of the main modules preventing me from going to Drupal 7, especially since tons of our forum posts have images and so on. Hopefully an upgrade path will arise, thanks for the hard work everyone!
Comment #14
benjamin_dk CreditAttribution: benjamin_dk commentedsubscribing
Comment #15
StudioARE CreditAttribution: StudioARE commentedAny progress?
This really is the only thing that keeps me on D6.
Comment #16
rfayI've created an upgrade path in http://drupal.org/sandbox/rfay/1292764
You can download the tarball and try it out.
To use it:
Issues:
comment_upload_images_<type>
' variable is 'none'.Please try it out and see if it works OK for you.
Comment #17
cweagansUpdating title for dashboard.
Comment #18
StudioARE CreditAttribution: StudioARE commented"Comment Driven"?
Will be testing #16.
Comment #19
cweagansSorry bout that...looked at a lot of modules today.
Comment #20
svenrissmann CreditAttribution: svenrissmann commentedHi there,
when I migrate my Site from 6 to 7 I end up with this two Update-Steps won´t work!!
If I start the Update process it jumps to 100% an then shows this message:
For every run of update.php it´s another filename, so perhaps something gets done with exactly one file per update run...
Anyone else getting this error?
I´ve already tried it with all non-core Modules disabled, same issue...
Google knows a lot about, but nothing works for me ;-)
Hope somebody could help!
Comment #21
klonos@Bubo: ...this is what you're looking for: #966210: DB Case Sensitivity: system_update_7061() fails on inserting files with same name but different case
Comment #22
svenrissmann CreditAttribution: svenrissmann commentedThank you!
But I´m not realy sure, if this is realy what happens to me...
All the Attachments of my Site are unter /files, and there is for sure no file which is an upper case version of: smf-fileupload-448.JPG
So for my site this seems not to belong to Case-Sensitivitie!?
Comment #23
svenrissmann CreditAttribution: svenrissmann commentedEhh!?!
I just compared the PDO-Exception in my Error and the Error in the other Issue....
Why is the filename in my Message: 100_5408.JPG and the URI: public://smf-fileupload-448.JPG ???
As I see it now, something went wrong by updating from D6 to D7 ?!
Comment #24
klonos...to be exact, all I did in order to locate your issue was to do a search in all project's issues for "PDOException Integrity constraint violation". The issue that mostly fit your error was #1163740: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed}. Reading through that issue lead me to #966210: DB Case Sensitivity: system_update_7061() fails on inserting files with same name but different case. Specifically it was catch's comment:
Anyways, point is that your issue does not belong here and continuing any further discussion is off topic.
Comment #25
webchickTagging for the sprint.
Comment #26
Heine CreditAttribution: Heine commentedAn alternative to an upgrade path (for D7, sites I care about) is to create a migration class.
Comment #27
dwwDrupal.org won't care about this module for D7, since we're not going to have files attached to comments anymore. See #1545922: [META] Issue page redesign for the full story.
Comment #28
Oleksa-1 CreditAttribution: Oleksa-1 commentedDoes Anybody have a partched version of #16 for conversion to filefiled (not imagefield) ?
Comment #29
Oleksa-1 CreditAttribution: Oleksa-1 commentedWho wants module from #16 worked as filefields check this manual http://realguess.net/node/176
Comment #30
RRRrrr CreditAttribution: RRRrrr commentedModule from #16 for conversion to filefiled
This file contain error
See next message...
Comment #31
RRRrrr CreditAttribution: RRRrrr commentedThis file worked normally
Comment #32
RRRrrr CreditAttribution: RRRrrr commentedThis file worked normally
Comment #33
thermador CreditAttribution: thermador commentedRRRrrr, I wish I could say that the file in #32 worked for me, but it didn't.
I had to edit the "install" file, since my database uses a prefix (tables are "drupal_node" instead of just "node" for example). Basically, anywhere in the file where there was a SELECT command, I had to change the names of the tables that it was selecting.
So like on line 97, instead of
$result = db_query('SELECT DISTINCT type FROM `node` n, `comment_upload` cu WHERE n.nid = cu.nid');
i have this instead
$result = db_query('SELECT DISTINCT type FROM `drupal_node` n, `drupal_comment_upload` cu WHERE n.nid = cu.nid');
But even with those fixes, I still got an error message when I ran update.php:
Oh well... it was worth a shot. I am just going to move all the files manually, it's not that many.
Comment #34
Rhino-new CreditAttribution: Rhino-new commentedMy gratitude to Rfay for the upgrade path in #16 , it worked perfectly for me.
So there will never be a comment upload in Drupal7? Any alternatives?
Comment #35
Konstantin Komelin CreditAttribution: Konstantin Komelin commentedHere is upgrade path from D6 to D7: https://github.com/konstantin-komelin/comment_upload
It's based on #32 but has a bunch of improvements.
Moreover, it has a Comment Upload file field formatter! So it can be used as a complete replacement of the D6 Comment Upload module for D7. Read more in README.md
If people are interested and maintainers don't mind it's possible to have this module as 7.x-1.x branch of Comment Upload module here on drupal.org.
Enjoy the module! I hope it will be useful for the community.
Konstantin
Comment #36
AndersTwo CreditAttribution: AndersTwo commentedFYI: I did a successful migration using migrate_d2d module. Here’s what you need to do:
So basically this boils down to simply extending the query to retrieve all attached file IDs in a single result row, separated by commas. This seems to work only with MySQL or MariaDB, although I haven’t checked if other databases would possibly support this too.
With other databases, one would need to retrieve the file IDs in a separate query on a per-row basis. IIRC, the migrate API provides something like prepare_row() or similar that could possibly be used.
In any case, once you got the fid’s separated by commas, you’re fine to use this solution.