Skip to content

Commit

Permalink
Fixed issue: during vv export, output data was buffered and lead to o…
Browse files Browse the repository at this point in the history
…ut of memory errors when exporting large quantities of answers.
  • Loading branch information
Grapsus committed Mar 27, 2014
1 parent 7461a73 commit a6c7af1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions application/controllers/admin/export.php
Expand Up @@ -701,7 +701,8 @@ public function vvexport()
}
$result = Yii::app()->db->createCommand($query)->query();

foreach ( $result->readAll() as $row )
echo $vvoutput;
foreach ($result as $row)
{
foreach ( $fieldnames as $field )
{
Expand Down Expand Up @@ -743,14 +744,14 @@ public function vvexport()
$sun[]=$value;
}

$beach = implode($s, $sun);
$vvoutput .= $beach;
/* it is important here to stream output data, line by line
* in order to avoid huge memory consumption when exporting large
* quantities of answers */
echo implode($s, $sun)."\n";

unset($sun);
$vvoutput .= "\n";
}

echo $vvoutput;
exit;
}
}
Expand Down

0 comments on commit a6c7af1

Please sign in to comment.