There are plans to implement an API to upload files? I need to do a script to migrate from other CMS to Drupal and I don't know from where I need to begin hehe..
If you give me a clue, I could try to make an API.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | dbfm_mapper-6.x-1.x-dev.tar_.gz | 14.12 KB | Manonline |
| #8 | attach.patch | 1.22 KB | Manonline |
| #7 | dbfm_mapper.txt | 4.02 KB | Manonline |
Comments
Comment #1
geoff_eagles commentedHi Mariano,
You're still trying to import your ezPublish data??
I'm afraid dbFM doesn't have an API as such. Its initial development was a little haphazard - it evolved from another module (webFM) rather than being designed from the ground up. Perhaps I'll be able to clean things up a little for the D7 release?
I imagine all you need is a simple module to read each record in your ezPublish database table and create an entry in the dbfm_file table and a corresponding entry in the dbfm_data table. The easiest way to automate it would be to give every file the same parent directory and then manually move the files into a more appropriate directory structure later.
Take a look at the dbfm_form_upload_submit code where I fill in the metadata for the dbfm_file record then compress the file itself and shove it into the dbfm_data record.
Get in touch if you're struggling
Comment #2
Manonline commentedYes, I'm with the import from eZ, with some brakes in the middle, but now I'm fully dedicated to the migration.
Now I'm doing a module to do the file import, but I'm in trouble trying to get the filesize. I don't have the file in the filesystem, I have it in a variable.
Comment #3
geoff_eagles commentedDoesn't ezPublish record the file size somewhere?
If not you're going to have to get the file out of the ezPublish database blob before you compress it - you can see how big it is then?
Comment #4
Manonline commentedI can download them to filesystem and get the size with filesize(), but there are 25.000 files and I'm trying to avoid that :P
Comment #5
geoff_eagles commentedWhen you get your blob into a variable (prior to compressing it) can't you just measure the length of it?
e.g $ezfilecontents = $ezPubRec->ezblob;
$ezfilesize = strlen($ezfilecontents);
I'm still surprised that ezPublish doesn't save the filesize.
Comment #6
Manonline commentedYES! eZ does, eZ save the filesize. My mystake! I didn't look well -.-
Now I'm finishing the query to get the filedata and nid from an eZNID.
When finished, I'll upload the script and querys, may be it be usefull for other people :)
Comment #7
Manonline commentedWell... here is the module.
Is a mapper for the Feeds module (using filefield mapper as guide), in that module, I include a posible generic function for upload files for DBFM.
Can you review the code and tell me if I'm missing something?
If you like the Feeds integration, feel free to use it :)
Comment #8
Manonline commentedThere are some errors in the attach function. Here is the patch.
Comment #9
geoff_eagles commentedThanks for sharing your work, though I'm a bit pushed for time to have a really good look at it at the moment - I've not come across the Feeds module before.
My company's just been taken over so there's too much to read and do just now! I hope your solution works well and don't forget to post if you come across any more problems.
Comment #10
Manonline commentedHere is mi work finished and working :)