Bug #1911

Issues with PM Export (Download Messages)

Added by Jesse Labrocca 4 months ago.

Status:New Start date:01/18/2012
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Private Messages
Target version:-
Reproducibility:Rarely Database Type:
Reported In MyBB Version:1.6.5 Database Version:
PHP Version: SQA assignments:
Browser:

Description

Issues with PM Export (Download Messages)
At HF I've had problems with PM exports for a while. Today I really dug into it for fixing. I have found a number of problems that seem related to larger forums as well as small changes to improve a PM export. When exports were happening with large a MySQL error would occur but adding a ton of resources changed nothing. I apologize ahead of time for this lengthy bug report.

1. In private.php the archive templates should be added. private_archive_txt, private_archive_csv, private_archive_html This actually helped stop some of the MySQL errors.

2. The template "private_archive_html" has a {$css} parameter. The private.php page has this query.

$query = $db->simple_select("themestylesheets", "stylesheet", "sid=1", array('limit' => 1));
$css = $db->fetch_field($query, "stylesheet");

However no such css will exist. I've checked my base MyBB package to confirm that. Unsure if that's legacy code or something 1/2 done but even at MyBB.com on an html export you can see that $css was never filled. Yes it could be a placeholder for a future CSS but if that's the case please move that code to within this code so it's not executed:

    if($mybb->input['exporttype'] == "html")
    {
        $filename = "pm-archive.html";
        $contenttype = "text/html";
    }

Should be:

    if($mybb->input['exporttype'] == "html")
    {

    $query = $db->simple_select("themestylesheets", "stylesheet", "sid=1", array('limit' => 1));
    $css = $db->fetch_field($query, "stylesheet");

        $filename = "pm-archive.html";
        $contenttype = "text/html";
    }

Right now it's queried even if csv or txt exporting. So that saves a query and gets rid of a possible error on large exports. But realistically the $css query and template variable might be best removed completely.

3. This code is part of the html output problem for me.

    if($mybb->input['exporttype'] == "html")
    {
    output_page($archived);

    }
    else
    {
        echo $archived;
    }

By just using echo $archived instead of output_page() the html export worked. Seems to work similar as output() but I don't get a mysql error with output() while echo I do not.

So for some reason on large queries whenever any query does try to execute I get a mysql error. And in MyBB logs nothing is logged. So I'm having a tough time getting exact reason. Could be a setting somewhere I have to limit resources but could also be a default mysql limitation I'm unaware of. Could even be one of my kernel/firewall settings.

And yes smaller output queries do work. And I don't have this problem on any of my other MyBB sites. But I still believe these 3 items could be fixed to improve MyBB for everyone. I know 1 and 2 can be considered bugs for sure but maybe #3 is questionable.

After the fixes my complete export was 24,000 PMs and txt file was only 6mb. So I find it hard to believe a setting I have created the problem as much as some limitation with mysql or mybb somewhere. As test I added just one simple query to action.

$db->simple_select("users","username", "uid=1");

I received a MySQL error "2006 - MySQL server has gone away".

Please consider my report carefully. I'm happy to do any testing or assisting with dev team to investigate this further.

Also available in: Atom PDF