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.

Trouble Exporting from Simple Press 5.34

124»

Comments

  • @fraxture said:
    is there a correct way to turn on php error logging in vanilla?

    see.

    http://vanillaforums.org/discussion/25386/best-practice-for-outputting-debug-errors-in-vanilla

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • 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.

  • Does this need to be reported as a bug somewhere?

  • @fraxture said:
    Does this need to be reported as a bug somewhere?

    Maybe on github in the VanillaPorter repo, but only if you're absolutely 100% sure it's a bug with that (latest) version of SimplePress

    In that case also have a database backup ready to give so it can be tested (maybe delete some users, but you'll get the idea)

    There was an error rendering this rich post.

  • @fraxture‌ Could you post a download link of the export script and whatever else you did to get this working? I really could use this right now!

    Best,

Sign In or Register to comment.