Add missing 'ORDER BY' discourse
authorMarcel Werk <burntime@woltlab.com>
Tue, 7 Nov 2023 13:03:19 +0000 (14:03 +0100)
committerMarcel Werk <burntime@woltlab.com>
Tue, 7 Nov 2023 13:03:19 +0000 (14:03 +0100)
files/lib/system/exporter/DiscourseExporter.class.php

index 573e9beaf2f5bbe05a480f0d17e93158d5d04560..a4fac974d4fa1df58576ca784572cebe943a2c5b 100644 (file)
@@ -7,7 +7,6 @@ use wcf\data\user\group\UserGroup;
 use wcf\system\database\PostgreSQLDatabase;
 use wcf\system\importer\ImportHandler;
 use wcf\system\WCF;
-use wcf\util\StringUtil;
 
 /**
  * Exporter for Discourse.
@@ -216,7 +215,8 @@ final class DiscourseExporter extends AbstractExporter
                 FROM        users
                 LEFT JOIN   user_emails
                             ON (user_emails.user_id = users.id)
-                WHERE       users.id > ?";
+                WHERE       users.id > ?
+                ORDER BY    users.id";
         $statement = $this->database->prepareStatement($sql, $limit, $offset);
         $statement->execute([0]);
         while ($row = $statement->fetchArray()) {
@@ -670,7 +670,8 @@ final class DiscourseExporter extends AbstractExporter
                 LEFT JOIN   users
                 ON          (users.id = topic_users.user_id)
                 WHERE       topic_users.topic_id IN (SELECT id FROM topics WHERE archetype = ?)
-                            AND topic_users.user_id > ?";
+                            AND topic_users.user_id > ?
+                ORDER BY    topic_users.id";
         $statement = $this->database->prepareStatement($sql, $limit, $offset);
         $statement->execute(['private_message', 0]);
         while ($row = $statement->fetchArray()) {