Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Attachments to FileUpload Importer

13»

Comments

  • Is this included in the version of the exporter that was just updated?
  • any news?
  • Hi,

    the Vanilla1-Exporter also export the Attachments of Vanilla1 (database entries, files have to be copies manually).

    But @Todd - have you managed to also export the attachments, attached to the first entry of a discussion?

    // Media if ($Ex->Exists('Attachment')) { $Media_Map = array( 'AttachmentID' => 'MediaID', 'Name' => 'Name', 'MimeType' => 'Type', 'Size' => 'Size', //'StorageMethod', 'Path' => array('Column' => 'Path', 'Filter' => array($this, 'StripMediaPath')), 'UserID' => 'InsertUserID', 'DateCreated' => 'DateInserted', 'CommentID' => 'ForeignID' //'ForeignTable' ); $Ex->ExportTable('Media', "select a.*, 'local' as StorageMethod, 'comment' as ForeignTable from :_Attachment a", $Media_Map); }

    That was a problem I had to manage.

    I might be wrong, but the first entry of a discussion is saved as discussion not as comment -> "ForeignTable" has to be "discussion" not "comment".
    Have not tested the new Exporter - @Todd, have you tested that?
  • LincLinc Detroit Admin
    @vegano I had the same concern. It's probably a bug.
  • Hmm... I guess this is a bug - if not, I didn't understood anything...

    This is working in my script (I have already changed the database prefix like it is used in the exporter)

    INSERT INTO GDN_Media (Name, Type, Size, StorageMethod, Path, InsertUserID, DateInserted, ForeignID, ForeignTable) SELECT Name, MimeType, Size, 'local', Path, UserID, DateCreated, CommentID, 'comment' from :_Attachment WHERE :_Attachment.AttachmentID NOT IN(SELECT AttachmentID FROM :_Attachment JOIN :_discussion ON :_Attachment.DiscussionID = :_discussion.DiscussionID WHERE :_Attachment.CommentID = :_discussion.FirstCommentID) INSERT INTO GDN_Media (Name, Type, Size, StorageMethod, Path, InsertUserID, DateInserted, ForeignID, ForeignTable) SELECT Name, MimeType, Size, 'local', Path, UserID, DateCreated, DiscussionID, 'discussion', DateCreated from :_Attachment WHERE :_Attachment.AttachmentID IN(SELECT AttachmentID FROM :_Attachment JOIN :_discussion ON :_Attachment.DiscussionID = :_discussion.DiscussionID WHERE :_Attachment.CommentID = :_discussion.FirstCommentID)

    This checks if the commten ist the first comment in a discussion - if yes - than the ForeignTable will be "discussion", not "comment" and the DiscussionID will be the ForeignID, not the CommentID.


    ==

    And I am not really sure this will work:
    'Path' => array('Column' => 'Path', 'Filter' => array($this, 'StripMediaPath')),

    My Attachment paths are absolute. Put an absolute string in another database and it stays absolut. So if I would delete my old Vanilla1 with the Attachments this will delete the attachments with are linked in Vanilla2 -> crash.

    Hm - configs are saved to file in Vanilla1, aren't they? Instead you could read the Attachment config and delete the absolut path, which is given in the extention.

    I would prefer user input. It might be possible to give suggestions like the database prefix is suggested in the exporter, if the given doesn't make sence (did I get this part of the exporter write? does the function do this?)

    ==

    Hm, I neight have enough knowledge in the exporter script to fix it nor enogh time to make my script working well (I think the may problem is the data transfer, that can last some minutes or longer, depending on the amount of files you have).
    But I can help with suggest solutions.
  • edited November 2010
    edited.. Nevermind.
Sign In or Register to comment.