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

24

Comments

  • That looks like a gzipped file, no?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • @hgtonight, that's very possibly the explanation! Perhaps I didn't unzip it the right way. Will try that out...

  • hgtonighthgtonight MVP
    edited November 2013

    @fraxture said:
    hgtonight, that's very possibly the explanation! Perhaps I didn't unzip it the right way. Will try that out...

    The import script will ungzip files sent to it. I just can't read gzipped files unless they are a complete file. :D

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • peregrineperegrine MVP
    edited November 2013

    Since @hgtonight said the import script will unzip,

    you could look in the unzipped file and see if it properly unzips manually. If the file will not unzip then you have a problem with the export process itself.

    if it does unzip manually ,look at tables produced. (perhaps a problem with import process).

    and maybe manually install tables if they look properly formed.

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

  • peregrineperegrine MVP
    edited November 2013

    you could turnoff compression here

    line 1864 could try setting to NULL and looking at output file or removing the TRUE

     $Ex->UseCompression(TRUE);
    

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

  • Well, I turned off compression and got a proper text file, but I'm still getting the annoying can't parse error. Is there a log to check somewhere? Something with more information about what can't be parsed?

  • peregrineperegrine MVP
    edited November 2013

    now do a head on the text file or

    post the line where where the parse errors occur.

    I assume you are getting parse error on import

    don;t know about log - you would need to search the code.

    I don't know how porter imports. or do you just import via phpmyadmin.

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

  • The message says that the line happens "near" Line 1. Here's the first five lines:

    Vanilla Export: 1.6.9, Source: SimplePress 1.*, HashMethod: Vanilla
    
    // Export Started: 2013-11-14 15:38:27
    Table: User
    UserID,Name,Password,Email
    
  • can you post about 30 lines or 50 lines.

    I am taking a wild guess but you could remove the first 2 lines.

    how are you importing.

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

  • peregrineperegrine MVP
    edited November 2013

    head --lines 30 yourfilename

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

  • @fraxture said:
    but I'm still getting the annoying can't parse error.

    That error comes straight from the Vanilla source. Save screenshots of the error for posting here.

    Then look in the Vanilla source for that message so you can find out the reason you get that error

    There was an error rendering this rich post.

  • I'm a bit hesitant to post more of the db. It starts off immediately then with all the users. Each line looks like this:

    1,"admin","","@asfdf.net"

    and so on.

    I'm using the Vanilla Import page in the dashboard to import. I've tried removing the first two lines, and it doesn't work. The importer seems to need, especially, the first line, to know how to proceed.

  • peregrineperegrine MVP
    edited November 2013

    @underdog - how does one import using vanillaporter is it automatically imported after export.

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

  • fraxturefraxture
    edited November 2013

    screenshot of error:

  • This seems to be the code generating the error, from applications/dashboard/models/class.importmodel.php @ Line 1256:

    while (($Line = fgets($fpin)) !== FALSE) {
         $LineNumber++;
    
            if ($Line == "\n") {
                if ($fpout) {
                    // We are in a table so close it off.
                    fclose($fpout);
                    $fpout = 0;
                }
            } elseif ($fpout) {
                // We are in a table so dump the line.
                fputs($fpout, $Line);
            } 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));
            }
                $Table = $TableInfo['Table'];
                $Path = dirname($Path).DS.$Table.'.txt';
                $fpout = fopen($Path, 'wb');
    
                $TableInfo['Path'] = $Path;
                unset($TableInfo['Table']);
    
                // Get the column headers from the next line.
                if (($Line = fgets($fpin)) !== FALSE) {
               $LineNumber++;
    
               // Strip \r out of line.
               $Line = str_replace(array("\r\n", "\r"), array("\n", "\n"), $Line);
                    fwrite($fpout, $Line);
                    $Columns = $this->ParseInfoLine($Line);
                    $TableInfo['Columns'] = $Columns;
    
                    $Tables[$Table] = $TableInfo;
                }
            }
        }
    
  • peregrineperegrine MVP
    edited November 2013

    change it to this - and post results.


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

  • fraxturefraxture
    edited November 2013

    The results:

    array(3) { ["Vanilla Export"]=> string(5) "1.6.9" ["Source"]=> string(15) "SimplePress 1.*" ["HashMethod"]=> string(7) "Vanilla" }

    I guess the importer is not handline this first line in the correct way...?

  • peregrineperegrine MVP
    edited November 2013

    also search for

    ParseInfoLine routine.

    this is what it is doing

    public function ParseInfoLine($Line) {
        $Info = explode(',', $Line);
        $Result = array();
        foreach($Info as $Item) {
    
                    //    debug
                        var_dump($item);
    
    
    
                        $PropVal = explode(':', $Item);
            if(array_key_exists(1, $PropVal))
                $Result[trim($PropVal[0])] = trim($PropVal[1]);
            else
                $Result[trim($Item)] = '';
        }
    
        return $Result;
    }
    

    you could debug this loop.

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

  • It seems clear from the contents of $TableInfo what the problem is. The code in this section is analyzing the contents of different lines, like so:

    if ($Line == "\n") {
    if ($fpout) {
    // We are in a table so close it off.
    fclose($fpout);
    $fpout = 0;
    }
    } elseif ($fpout) {
    // We are in a table so dump the line.
    fputs($fpout, $Line);
    } 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);
       ...
    

    But then when it parses that line, it's not at a table definition, which is in fact 3 lines down in the file. But I'm not sure how this should be corrected. It strikes me as a sort of fundamental error. But I've probably misunderstood things here...

  • peregrineperegrine MVP
    edited November 2013

    well at least you know how to proceed as laborious as it might be.

    you can either correct output file

    just remove bad lines - until you get good lines,

    or correct import model to match ouput file - more trouble than its worth.

    I would choose to put export file in a readable format for import to work in a text editor.

    Take one table at a time.

    or load it into a spreadsheet export as csv and use phpmyadmin.

    too bad lincoln doesn't pop up.

    I gotta go.

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

Sign In or Register to comment.