From daa4f70b370d58f3e6a906b51f68c8d614029e8a Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 15 Mar 2024 15:25:20 +0100 Subject: [PATCH] Remove obsolete code The hash, file extension and dimensions are determined by the `UserAvatarImporter` anyway and do not need to be given as a parameter. --- .../system/exporter/IPB3xExporter.class.php | 3 --- .../system/exporter/IPB4xExporter.class.php | 2 -- .../exporter/Kunena3xExporter.class.php | 1 - .../system/exporter/MyBB16xExporter.class.php | 4 ---- .../exporter/PhpBB31xExporter.class.php | 1 - .../system/exporter/PhpBB3xExporter.class.php | 1 - .../system/exporter/SMF2xExporter.class.php | 1 - .../system/exporter/VB3or4xExporter.class.php | 3 --- .../system/exporter/VB5xExporter.class.php | 3 --- .../system/exporter/WBB2xExporter.class.php | 3 --- .../system/exporter/WBB3xExporter.class.php | 3 --- .../system/exporter/WBB4xExporter.class.php | 4 ---- .../system/exporter/XF12xExporter.class.php | 20 ++----------------- .../system/exporter/XF2xExporter.class.php | 20 ++----------------- 14 files changed, 4 insertions(+), 65 deletions(-) diff --git a/files/lib/system/exporter/IPB3xExporter.class.php b/files/lib/system/exporter/IPB3xExporter.class.php index 9b77eff..f6ad699 100644 --- a/files/lib/system/exporter/IPB3xExporter.class.php +++ b/files/lib/system/exporter/IPB3xExporter.class.php @@ -478,11 +478,8 @@ final class IPB3xExporter extends AbstractExporter $source .= $row['avatar_location']; } - $avatarExtension = \pathinfo($avatarName, \PATHINFO_EXTENSION); - $data = [ 'avatarName' => $avatarName, - 'avatarExtension' => $avatarExtension, 'userID' => $row['pp_member_id'], ]; diff --git a/files/lib/system/exporter/IPB4xExporter.class.php b/files/lib/system/exporter/IPB4xExporter.class.php index 7383f62..0e27054 100644 --- a/files/lib/system/exporter/IPB4xExporter.class.php +++ b/files/lib/system/exporter/IPB4xExporter.class.php @@ -492,11 +492,9 @@ final class IPB4xExporter extends AbstractExporter while ($row = $statement->fetchArray()) { $avatarName = \basename($row['pp_main_photo']); $source = $this->fileSystemPath . 'uploads/' . $row['pp_main_photo']; - $avatarExtension = \pathinfo($avatarName, \PATHINFO_EXTENSION); $data = [ 'avatarName' => $avatarName, - 'avatarExtension' => $avatarExtension, 'userID' => $row['member_id'], ]; diff --git a/files/lib/system/exporter/Kunena3xExporter.class.php b/files/lib/system/exporter/Kunena3xExporter.class.php index 6e3c77f..29a6c3d 100644 --- a/files/lib/system/exporter/Kunena3xExporter.class.php +++ b/files/lib/system/exporter/Kunena3xExporter.class.php @@ -357,7 +357,6 @@ final class Kunena3xExporter extends AbstractExporter $data = [ 'avatarName' => \basename($filepath), - 'avatarExtension' => \pathinfo($filepath, \PATHINFO_EXTENSION), 'userID' => $row['userid'], ]; diff --git a/files/lib/system/exporter/MyBB16xExporter.class.php b/files/lib/system/exporter/MyBB16xExporter.class.php index d2454a2..80a5a93 100644 --- a/files/lib/system/exporter/MyBB16xExporter.class.php +++ b/files/lib/system/exporter/MyBB16xExporter.class.php @@ -620,13 +620,9 @@ final class MyBB16xExporter extends AbstractExporter while ($row = $statement->fetchArray()) { $path = Url::parse($row['avatar']); - [$width, $height] = \explode('|', $row['avatardimensions']); $data = [ 'avatarName' => \basename($path['path']), - 'avatarExtension' => \pathinfo($path['path'], \PATHINFO_EXTENSION), - 'width' => $width, - 'height' => $height, 'userID' => $row['uid'], ]; diff --git a/files/lib/system/exporter/PhpBB31xExporter.class.php b/files/lib/system/exporter/PhpBB31xExporter.class.php index d1011b5..272eaad 100644 --- a/files/lib/system/exporter/PhpBB31xExporter.class.php +++ b/files/lib/system/exporter/PhpBB31xExporter.class.php @@ -720,7 +720,6 @@ final class PhpBB31xExporter extends AbstractExporter $data = [ 'avatarName' => \basename($row['user_avatar']), - 'avatarExtension' => $extension, 'userID' => $row['user_id'], ]; diff --git a/files/lib/system/exporter/PhpBB3xExporter.class.php b/files/lib/system/exporter/PhpBB3xExporter.class.php index 87b39c7..f68cd40 100644 --- a/files/lib/system/exporter/PhpBB3xExporter.class.php +++ b/files/lib/system/exporter/PhpBB3xExporter.class.php @@ -650,7 +650,6 @@ final class PhpBB3xExporter extends AbstractExporter $data = [ 'avatarName' => \basename($row['user_avatar']), - 'avatarExtension' => $extension, 'userID' => $row['user_id'], ]; diff --git a/files/lib/system/exporter/SMF2xExporter.class.php b/files/lib/system/exporter/SMF2xExporter.class.php index 9ad4368..1004448 100644 --- a/files/lib/system/exporter/SMF2xExporter.class.php +++ b/files/lib/system/exporter/SMF2xExporter.class.php @@ -689,7 +689,6 @@ final class SMF2xExporter extends AbstractExporter $data = [ 'avatarName' => \basename($row['avatarName']), - 'avatarExtension' => \pathinfo($row['avatarName'], \PATHINFO_EXTENSION), 'userID' => $row['id_member'], ]; diff --git a/files/lib/system/exporter/VB3or4xExporter.class.php b/files/lib/system/exporter/VB3or4xExporter.class.php index be254ad..5db3a8b 100644 --- a/files/lib/system/exporter/VB3or4xExporter.class.php +++ b/files/lib/system/exporter/VB3or4xExporter.class.php @@ -773,9 +773,6 @@ final class VB3or4xExporter extends AbstractExporter $data = [ 'avatarName' => StringUtil::decodeHTML($row['filename']), - 'avatarExtension' => \pathinfo($row['filename'], \PATHINFO_EXTENSION), - 'width' => $row['width'], - 'height' => $row['height'], 'userID' => $row['userid'], ]; diff --git a/files/lib/system/exporter/VB5xExporter.class.php b/files/lib/system/exporter/VB5xExporter.class.php index 3d5f944..9662c30 100644 --- a/files/lib/system/exporter/VB5xExporter.class.php +++ b/files/lib/system/exporter/VB5xExporter.class.php @@ -497,9 +497,6 @@ final class VB5xExporter extends AbstractExporter $data = [ 'avatarName' => $row['filename'], - 'avatarExtension' => \pathinfo($row['filename'], \PATHINFO_EXTENSION), - 'width' => $row['width'], - 'height' => $row['height'], 'userID' => $row['userid'], ]; diff --git a/files/lib/system/exporter/WBB2xExporter.class.php b/files/lib/system/exporter/WBB2xExporter.class.php index c91906b..f9fe581 100644 --- a/files/lib/system/exporter/WBB2xExporter.class.php +++ b/files/lib/system/exporter/WBB2xExporter.class.php @@ -454,9 +454,6 @@ final class WBB2xExporter extends AbstractExporter $data = [ 'avatarName' => $row['avatarname'], - 'avatarExtension' => $row['avatarextension'], - 'width' => $row['width'], - 'height' => $row['height'], 'userID' => $row['userid'], ]; diff --git a/files/lib/system/exporter/WBB3xExporter.class.php b/files/lib/system/exporter/WBB3xExporter.class.php index 4f7a353..01fd2da 100644 --- a/files/lib/system/exporter/WBB3xExporter.class.php +++ b/files/lib/system/exporter/WBB3xExporter.class.php @@ -777,9 +777,6 @@ final class WBB3xExporter extends AbstractExporter $data = [ 'avatarName' => $row['avatarName'], - 'avatarExtension' => $row['avatarExtension'], - 'width' => $row['width'], - 'height' => $row['height'], 'userID' => $row['userID'], ]; diff --git a/files/lib/system/exporter/WBB4xExporter.class.php b/files/lib/system/exporter/WBB4xExporter.class.php index 81101f2..fe3c66e 100644 --- a/files/lib/system/exporter/WBB4xExporter.class.php +++ b/files/lib/system/exporter/WBB4xExporter.class.php @@ -827,11 +827,7 @@ final class WBB4xExporter extends AbstractExporter $data = [ 'avatarName' => $row['avatarName'], - 'avatarExtension' => $row['avatarExtension'], - 'width' => $row['width'], - 'height' => $row['height'], 'userID' => $row['userID'], - 'fileHash' => $row['fileHash'], ]; ImportHandler::getInstance() diff --git a/files/lib/system/exporter/XF12xExporter.class.php b/files/lib/system/exporter/XF12xExporter.class.php index 157a2fb..4cc3f99 100644 --- a/files/lib/system/exporter/XF12xExporter.class.php +++ b/files/lib/system/exporter/XF12xExporter.class.php @@ -719,25 +719,8 @@ final class XF12xExporter extends AbstractExporter $config = $this->getConfig(); $location = $this->fileSystemPath . $config['externalDataPath'] . '/avatars/l/' . \floor($row['user_id'] / 1000) . '/' . $row['user_id'] . '.jpg'; - if (!$imageSize = @\getimagesize($location)) { - continue; - } - - switch ($imageSize[2]) { - case \IMAGETYPE_JPEG: - $extension = 'jpg'; - break; - case \IMAGETYPE_PNG: - $extension = 'png'; - break; - case \IMAGETYPE_GIF: - $extension = 'gif'; - } - - /** @noinspection PhpUndefinedVariableInspection */ $data = [ 'avatarName' => '', - 'avatarExtension' => $extension, 'userID' => $row['user_id'], ]; @@ -918,7 +901,8 @@ final class XF12xExporter extends AbstractExporter 0, $data, [ - 'labelIDs' => $row['is_starred'] ? [$row['user_id']] : [], ] + 'labelIDs' => $row['is_starred'] ? [$row['user_id']] : [], + ] ); } } diff --git a/files/lib/system/exporter/XF2xExporter.class.php b/files/lib/system/exporter/XF2xExporter.class.php index 35fb0c3..1c52189 100644 --- a/files/lib/system/exporter/XF2xExporter.class.php +++ b/files/lib/system/exporter/XF2xExporter.class.php @@ -759,25 +759,8 @@ final class XF2xExporter extends AbstractExporter $config = $this->getConfig(); $location = $this->fileSystemPath . $config['externalDataPath'] . '/avatars/l/' . \floor($row['user_id'] / 1000) . '/' . $row['user_id'] . '.jpg'; - if (!$imageSize = @\getimagesize($location)) { - continue; - } - - switch ($imageSize[2]) { - case \IMAGETYPE_JPEG: - $extension = 'jpg'; - break; - case \IMAGETYPE_PNG: - $extension = 'png'; - break; - case \IMAGETYPE_GIF: - $extension = 'gif'; - } - - /** @noinspection PhpUndefinedVariableInspection */ $data = [ 'avatarName' => '', - 'avatarExtension' => $extension, 'userID' => $row['user_id'], ]; @@ -958,7 +941,8 @@ final class XF2xExporter extends AbstractExporter 0, $data, [ - 'labelIDs' => $row['is_starred'] ? [$row['user_id']] : [], ] + 'labelIDs' => $row['is_starred'] ? [$row['user_id']] : [], + ] ); } } -- 2.20.1