Migrating Mantis bug attachments that are not stored in the Database
Added by Mark Stahler over 14 years ago
The rake task (/lib/tasks/migrate_from_mantis.rake) for migrating Mantis to Redmine assumes the user is using the default Mantis setting of storing attachment files in the database. I have inherited a Mantis installation I want to move to Redmine but need all the attachment files.
Has anyone made the modification to the migration script to support attachments stored on disk? I have spent a little time looking into making the change but I am not a Ruby programmer. It appears the read method of MantisBugFile reads the file from the Mantis database from the content field. Can this function be modified to use the diskfile field (stores the full path to the file), open a stream and read the contents? Easier said then done unfortunately. I am not sure where this read_finished variable is coming/being used from either.
Any help or guidance would be appreciated.
Replies (1)
RE: Migrating Mantis bug attachments that are not stored in the Database
-
Added by Mark Stahler over 14 years ago
Easy
class MantisBugFile < ActiveRecord::Base
set_table_name :mantis_bug_file_table
...
def read(*args)
if @read_finished
nil
else
@read_finished = true
f = File.open(diskfile, "r:binary")
f.read
end
end