From: Tim Düsterhus Date: Sun, 8 Dec 2013 19:33:24 +0000 (+0100) Subject: Fix exporting of attachments in vB 4 if they are stored in database X-Git-Tag: 2.0.0~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f760198a7bda8e156b9cc27f2b308032f1cb1f5f;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.exporter.git Fix exporting of attachments in vB 4 if they are stored in database --- diff --git a/files/lib/system/exporter/VB3or4xExporter.class.php b/files/lib/system/exporter/VB3or4xExporter.class.php index 949d4b4..d54ae0b 100644 --- a/files/lib/system/exporter/VB3or4xExporter.class.php +++ b/files/lib/system/exporter/VB3or4xExporter.class.php @@ -917,14 +917,18 @@ class VB3or4xExporter extends AbstractExporter { */ public function exportPostAttachments($offset, $limit) { try { - $sql = "SELECT *, contentid AS postid - FROM ".$this->databasePrefix."attachment - WHERE contenttypeid = (SELECT contenttypeid FROM ".$this->databasePrefix."contenttype WHERE class = 'Post') - ORDER BY attachmentid ASC"; + // vb 4 + $sql = "SELECT attachment.*, attachment.contentid AS postid, filedata.filedata + FROM ".$this->databasePrefix."attachment attachment + LEFT JOIN ".$this->databasePrefix."filedata filedata + ON attachment.filedataid = filedata.filedataid + WHERE attachment.contenttypeid = (SELECT contenttypeid FROM ".$this->databasePrefix."contenttype contenttype WHERE contenttype.class = 'Post') + ORDER BY attachment.attachmentid ASC"; $statement = $this->database->prepareStatement($sql, $limit, $offset); $statement->execute(); } catch (DatabaseException $e) { + // vb 3 $sql = "SELECT * FROM ".$this->databasePrefix."attachment ORDER BY attachmentid ASC";