From ab00fcfbd08bf7cf5bff11b517ea51e79d2b8612 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 27 Jul 2023 18:05:07 +0200 Subject: [PATCH] SMF 2.1 renamed the icon column See https://github.com/SimpleMachines/SMF/blob/7f6d318352751d7ae8131557b4dd7c642903a67c/other/upgrade_2-1_mysql.sql#L1293-L1294 --- .../lib/system/exporter/SMF2xExporter.class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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']; -- 2.20.1