From: Alexander Ebert Date: Thu, 27 Jul 2023 16:05:07 +0000 (+0200) Subject: SMF 2.1 renamed the icon column X-Git-Tag: 6.0.0_Beta_1~3^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ab00fcfbd08bf7cf5bff11b517ea51e79d2b8612;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.exporter.git SMF 2.1 renamed the icon column See https://github.com/SimpleMachines/SMF/blob/7f6d318352751d7ae8131557b4dd7c642903a67c/other/upgrade_2-1_mysql.sql#L1293-L1294 --- diff --git a/files/lib/system/exporter/SMF2xExporter.class.php b/files/lib/system/exporter/SMF2xExporter.class.php index f6550bc..483eb09 100644 --- a/files/lib/system/exporter/SMF2xExporter.class.php +++ b/files/lib/system/exporter/SMF2xExporter.class.php @@ -512,10 +512,15 @@ class SMF2xExporter extends AbstractExporter */ public function countUserRanks() { + $fieldName = 'stars'; + if (\version_compare($this->readOption('smfVersion'), '2.1.0', '>')) { + $fieldName = 'icons'; + } + $sql = "SELECT COUNT(*) AS count FROM " . $this->databasePrefix . "membergroups WHERE min_posts <> ? - AND stars <> ?"; + AND {$fieldName} <> ?"; $statement = $this->database->prepareStatement($sql); $statement->execute([-1, '']); $row = $statement->fetchArray(); @@ -531,15 +536,20 @@ class SMF2xExporter extends AbstractExporter */ public function exportUserRanks($offset, $limit) { + $fieldName = 'stars'; + if (\version_compare($this->readOption('smfVersion'), '2.1.0', '>')) { + $fieldName = 'icons'; + } + $sql = "SELECT * FROM " . $this->databasePrefix . "membergroups WHERE min_posts <> ? - AND stars <> ? + AND {$fieldName} <> ? ORDER BY id_group"; $statement = $this->database->prepareStatement($sql, $limit, $offset); $statement->execute([-1, '']); while ($row = $statement->fetchArray()) { - [$repeatImage, $rankImage] = \explode('#', $row['stars'], 2); + [$repeatImage, $rankImage] = \explode('#', $row[$fieldName], 2); $groupID = $row['id_group'] == self::GROUP_USER ? self::GROUP_USER_FAKE : $row['id_group'];