瀏覽代碼

Add sorting for UPDATE queries

Visman 1 年之前
父節點
當前提交
9f46e4e302
共有 2 個文件被更改,包括 11 次插入1 次删除
  1. 4 0
      app/Models/Topic/Access.php
  2. 7 1
      app/Models/User/ChangeGroup.php

+ 4 - 0
app/Models/Topic/Access.php

@@ -28,6 +28,10 @@ class Access extends Action
         }
         }
 
 
         if (! empty($ids)) {
         if (! empty($ids)) {
+            if (\count($ids) > 1) {
+                \sort($ids, \SORT_NUMERIC);
+            }
+
             $vars = [
             $vars = [
                 ':ids'    => $ids,
                 ':ids'    => $ids,
                 ':closed' => $open ? 0 : 1,
                 ':closed' => $open ? 0 : 1,

+ 7 - 1
app/Models/User/ChangeGroup.php

@@ -48,14 +48,16 @@ class ChangeGroup extends Action
             ) {
             ) {
                 $moderators[$user->id] = $user;
                 $moderators[$user->id] = $user;
             }
             }
+
             if ($user->isAdmin) {
             if ($user->isAdmin) {
                 $adminPresent = true;
                 $adminPresent = true;
             }
             }
+
             if ($user->isUnverified) {
             if ($user->isUnverified) {
                 $unverPresent = true;
                 $unverPresent = true;
             }
             }
 
 
-            $ids[] = $user->id;
+            $ids[]            = $user->id;
             $user->__group_id = $newGroupId;
             $user->__group_id = $newGroupId;
         }
         }
 
 
@@ -70,6 +72,10 @@ class ChangeGroup extends Action
             }
             }
         }
         }
 
 
+        if (\count($ids) > 1) {
+            \sort($ids, \SORT_NUMERIC);
+        }
+
         $vars = [
         $vars = [
             ':new' => $newGroupId,
             ':new' => $newGroupId,
             ':ids' => $ids,
             ':ids' => $ids,