Would anyone here be willing to work on creating a PHP script / MySQL query that would allow one to convert and transfer the information contained in the file database table (used by attachment.module) over to the files table (used by Drupal's regular upload.module)?

I don't know about you, but I have a couple of years worth of attachments that will become invisible/unavailable for editing once I move over to Drupal 5.1, since there won't be an attachment.module 5.1. Even if there were one... best to take care of this now than one year from now, when Drupal 6 comes out or something, right?

I know a bit about PHP and MySQL, but this is still beyond me. I would appreciate any help.

Comments

drewish’s picture

Category: support » feature

That'd be a very good feature. I had to do the same thing with a version of the audio module i wrote that depended on filemanager. As a reference, the code I used can be found at: http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/drewish/audio...

ricmadeira’s picture

Wow, thanks! That function audio_update_7() looks like it could be a nice starting place. It looks up the entries in the old table, places them in the new one and even moves the files over to a new directory (not sure if that will be necessary or not at this point); it's as simple as that, I think.

This is just what a new guy like me needs to get to work. Thanks again! I'll try to make something out of this... if someone gets there first, please post your work here!

andykemp’s picture

Has any progress been made on this? I would really appreciate this script as I want to move over to Drupal 5, but don't want to have to reupload 400 odd files...

Happy to help out if needed but not sure where to start with something like this!

ricmadeira’s picture

I haven't started working on this yet, sorry. Got a couples other more pressing problems with my migration to 5.1 to solve first.

sun’s picture

I'll also need that migration soon.

Some facts that need to be adressed properly:

  1. attachment allows an additional file description per file, upload has a description only. This should be supported by another module after migration, specifically I'm thinking of Upload Preview.
  2. filemanager allows two files to have the same filename, while upload renames new files with filenames that already exist. If we will not move the attachments to the default directory of upload (/files) then this might not be a problem.
drewish’s picture

Status: Active » Closed (duplicate)

texasnomad, put a patch up over at: http://drupal.org/node/133956 even though this is older, i'm going to mark this as a duplicate since that has a patch. i'd really appreciate some testing of his patch.