From 8138e621c96291e743ab04c776bab2df81d14bb8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 13 Mar 2019 17:39:00 +0100 Subject: [PATCH] Improve comments for attachment location compatibility layer see #2840 see #2869 --- .../files/lib/data/attachment/Attachment.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/data/attachment/Attachment.class.php b/wcfsetup/install/files/lib/data/attachment/Attachment.class.php index f739ea934e..f7bae162cb 100644 --- a/wcfsetup/install/files/lib/data/attachment/Attachment.class.php +++ b/wcfsetup/install/files/lib/data/attachment/Attachment.class.php @@ -151,7 +151,10 @@ class Attachment extends DatabaseObject implements IRouteController, IThumbnailF } /** - * Migrates the storage location of this attachment. + * Migrates the storage location of this attachment to + * include the `.bin` suffix. + * + * @since 5.2 */ public function migrateStorage() { foreach ([$this->getLocation(), $this->getThumbnailLocation(), $this->getThumbnailLocation('tiny')] as $location) { @@ -164,20 +167,22 @@ class Attachment extends DatabaseObject implements IRouteController, IThumbnailF /** * Returns the appropriate location with or without extension. * + * Files are suffixed with `.bin` since 5.2, but they are recognized + * without the extension for backward compatibility. + * * @param string $location * @return string + * @since 5.2 */ protected final function getLocationHelper($location) { - // Check location with extension if (is_readable($location.'.bin')) { return $location.'.bin'; } - // Check legacy location else if (is_readable($location)) { return $location; } - // Assume that the attachment is not yet uploaded. + // Assume that the attachment has not been uploaded yet. return $location.'.bin'; } -- 2.20.1