Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Badges

Try Vanilla Forums Cloud product

fraxture

About

Username
fraxture
Joined
Visits
62
Last Active
Roles
Member
Points
57
Badges
6
  • Re: Trouble Exporting from Simple Press 5.34

    Ok, so I managed to import my SimplePress 5.34 content (more or less). At this point it seems to me that the problem is partly with the importer in fact. The exporter seems to work effectively, except that not for private messages / "conversations" between users. I simply commented out that portion of code in the existing Simple Press exporter class, so basically these lines:

    /*// Conversation.
      $Conv_Map = array(
         'message_id' => 'ConversationID',
         'from_id' => 'InsertUserID',
         'sent_date' => 'DateInserted'
      );
      $Ex->ExportTable('Conversation',
         "select *
         from :_sfmessages
         where is_reply = 0", $Conv_Map);
    
      // ConversationMessage.
      $ConvMessage_Map = array(
         'message_id' => 'MessageID',
         'from_id' => 'InsertUserID',
         'message' => array('Column'=>'Body')
      );
      $Ex->ExportTable('ConversationMessage',
         'select c.message_id as ConversationID, m.*
         from :_sfmessages c
         join :_sfmessages m
           on (m.is_reply = 0 and m.message_id = c.message_id) or (m.is_reply = 1 and c.is_reply = 0 and m.message_slug = c.message_slug and m.from_id in (c.from_id, c.to_id) and m.to_id in (c.from_id, c.to_id));',
         $ConvMessage_Map);
    
      // UserConversation
      $UserConv_Map = array(
         'message_id' => 'ConversationID',
         'from_id' => 'UserID'
      );
      $Ex->ExportTable('UserConversation',
         'select message_id, from_id
         from :_sfmessages
         where is_reply = 0
    
         union
    
         select message_id, to_id
         from :_sfmessages
         where is_reply = 0',
         $UserConv_Map);*/
    

    As for the problems with the importer, strangely it seemed to be a few lines of bad code that botched the section that parses the import file. Perhaps this is a mismatch between this exporter and the current version of the importer? Anywhere here is what I did to the lines between 1242 and 1245:

          $LineNumber++;
    
            if ($Line == "\n") {
                if ($fpout) {
                    // We are in a table so close it off.
                    fclose($fpout);
    -                   $fpout = 0;
    +                   $fpout = null;
                }
    -           } elseif ($fpout) {  
    +           } elseif (!is_null($fpout)) {
                // We are in a table so dump the line.
                fputs($fpout, $Line);
    +         } elseif (strpos($Line, 'Vanilla Export')) {
    +            // do nothing
                } elseif (substr_compare(self::COMMENT, $Line, 0, strlen(self::COMMENT)) == 0) {
                // This is a comment line so do nothing.
                } else {
                    // This is the start of a table.
                    $TableInfo = $this->ParseInfoLine($Line);
                    if (!array_key_exists('Table', $TableInfo)) {
                         throw new Gdn_UserException(sprintf(T('Could not parse import file. The problem is near line %s.'),    $LineNumber));
                }
                ...
    

    And this worked, or seems to have so far.

    Shadowdarehgtonightperegrineandrewmm