]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Stop all reads/writes to the admin_log_entity table (#21186)
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Mon, 23 Oct 2023 04:24:03 +0000 (21:24 -0700)
committerGitHub <noreply@github.com>
Mon, 23 Oct 2023 04:24:03 +0000 (21:24 -0700)
Content.Server.Database/Model.cs
Content.Server/Administration/Logs/AdminLogManager.Json.cs
Content.Server/Administration/Logs/AdminLogManager.cs

index c2d2ea98dc98ef6af9acfbb3c608755c838858ca..298f849b476f5527141fdddb5767be1a51638056 100644 (file)
@@ -517,6 +517,7 @@ namespace Content.Server.Database
 
         public List<AdminLogPlayer> Players { get; set; } = default!;
 
+        // Unused
         public List<AdminLogEntity> Entities { get; set; } = default!;
     }
 
@@ -530,6 +531,7 @@ namespace Content.Server.Database
         [ForeignKey("LogId,RoundId")] public AdminLog Log { get; set; } = default!;
     }
 
+    // Unused
     public class AdminLogEntity
     {
         [Required, Key] public int Uid { get; set; }
index 43a1e0b8b567d39f94baedc913517a3352f72edd..63f30c7a66d20dbae80141e3927962d0ec5c194b 100644 (file)
@@ -2,7 +2,6 @@
 using System.Text.Json;
 using System.Text.Json.Serialization;
 using Content.Server.Administration.Logs.Converters;
-using Content.Server.Database;
 using Robust.Server.GameObjects;
 using Robust.Server.Player;
 using Robust.Shared.Map;
@@ -34,10 +33,9 @@ public sealed partial class AdminLogManager
         _sawmill.Debug($"Admin log converters found: {string.Join(" ", converterNames)}");
     }
 
-    private (JsonDocument Json, HashSet<Guid> Players, List<AdminLogEntity> Entities) ToJson(
+    private (JsonDocument Json, HashSet<Guid> Players) ToJson(
         Dictionary<string, object?> properties)
     {
-        var entities = new Dictionary<EntityUid, AdminLogEntity>();
         var players = new HashSet<Guid>();
         var parsed = new Dictionary<string, object?>();
 
@@ -63,24 +61,12 @@ public sealed partial class AdminLogManager
                 _ => null
             };
 
-            if (entityId is not { } uid)
-            {
-                continue;
-            }
-
-            var entityName = _entityManager.TryGetComponent(uid, out MetaDataComponent? metadata)
-                ? metadata.EntityName
-                : null;
-
-            // TODO set the id too whenever we feel like running a migration for 10 hours
-            entities.TryAdd(uid, new AdminLogEntity { Name = entityName });
-
-            if (_entityManager.TryGetComponent(uid, out ActorComponent? actor))
+            if (_entityManager.TryGetComponent(entityId, out ActorComponent? actor))
             {
                 players.Add(actor.PlayerSession.UserId.UserId);
             }
         }
 
-        return (JsonSerializer.SerializeToDocument(parsed, _jsonOptions), players, entities.Values.ToList());
+        return (JsonSerializer.SerializeToDocument(parsed, _jsonOptions), players);
     }
 }
index 06f58f10b20cd3b7dfab6f4e4c8f1382f085a328..e869d089dac73b9d0c1a31c6a03fe6530bfda229 100644 (file)
@@ -278,7 +278,7 @@ public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogMa
         }
     }
 
-    private void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet<Guid> players, List<AdminLogEntity> entities)
+    private void Add(LogType type, LogImpact impact, string message, JsonDocument json, HashSet<Guid> players)
     {
         var preRound = _runLevel == GameRunLevel.PreRoundLobby;
         var count = preRound ? _preRoundLogQueue.Count : _logQueue.Count;
@@ -297,8 +297,7 @@ public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogMa
             Date = DateTime.UtcNow,
             Message = message,
             Json = json,
-            Players = new List<AdminLogPlayer>(players.Count),
-            Entities = entities
+            Players = new List<AdminLogPlayer>(players.Count)
         };
 
         foreach (var id in players)
@@ -331,10 +330,10 @@ public sealed partial class AdminLogManager : SharedAdminLogManager, IAdminLogMa
             return;
         }
 
-        var (json, players, entities) = ToJson(handler.Values);
+        var (json, players) = ToJson(handler.Values);
         var message = handler.ToStringAndClear();
 
-        Add(type, impact, message, json, players, entities);
+        Add(type, impact, message, json, players);
     }
 
     public override void Add(LogType type, ref LogStringHandler handler)