Support for attachments with the `.bin` extensions (WoltLab Suite 5.2+)
authorAlexander Ebert <ebert@woltlab.com>
Thu, 26 Dec 2019 17:41:51 +0000 (18:41 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 26 Dec 2019 17:41:51 +0000 (18:41 +0100)
Fixes #36

files/lib/system/exporter/WBB4xExporter.class.php

index 0e3e6579d42806b51c0cb2fbc17c00b806c011f7..e39102d845009b44a177e3507f7b851b7e379454 100644 (file)
@@ -3080,6 +3080,11 @@ class WBB4xExporter extends AbstractExporter {
                while ($row = $statement->fetchArray()) {
                        $fileLocation = $this->fileSystemPath . 'attachments/' . substr($row['fileHash'], 0, 2) . '/' . $row['attachmentID'] . '-' . $row['fileHash'];
                        
+                       // WoltLab Suite 5.2 uses the `.bin` extension for attachments.
+                       if (!is_readable($fileLocation) && is_readable("{$fileLocation}.bin")) {
+                               $fileLocation .= '.bin';
+                       }
+                       
                        ImportHandler::getInstance()->getImporter($importer)->import($row['attachmentID'], [
                                'objectID' => $row['objectID'],
                                'userID' => $row['userID'] ?: null,