From f760198a7bda8e156b9cc27f2b308032f1cb1f5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 8 Dec 2013 20:33:24 +0100 Subject: [PATCH] Fix exporting of attachments in vB 4 if they are stored in database --- files/lib/system/exporter/VB3or4xExporter.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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"; -- 2.20.1