From 0e328b48ce859545f046353bc164862941f96534 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Tue, 16 Nov 2021 03:25:04 +0700 Subject: [PATCH] Remove methods for creating "Acedia structure" --- sources/Data/Database/Local/LocalDatabase.uc | 10 +----- .../Database/Local/LocalDatabaseInstance.uc | 32 ------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/sources/Data/Database/Local/LocalDatabase.uc b/sources/Data/Database/Local/LocalDatabase.uc index b39ecd5..238199b 100644 --- a/sources/Data/Database/Local/LocalDatabase.uc +++ b/sources/Data/Database/Local/LocalDatabase.uc @@ -27,7 +27,6 @@ class LocalDatabase extends AcediaObject var config private string root; var config private bool createIfMissing; -var config private bool enforceAcediaStructure; public final function Text GetPackageName() { @@ -44,12 +43,6 @@ public final function Text GetRootName() return __().text.FromString(root); } -public final function bool RequiresAcediaStructure() -{ - return enforceAcediaStructure; -} - - /** * Changes caller's root name. * @@ -110,6 +103,5 @@ public final function DeleteSelf() defaultproperties { - enforceAcediaStructure = false - createIfMissing = false + createIfMissing = false } \ No newline at end of file diff --git a/sources/Data/Database/Local/LocalDatabaseInstance.uc b/sources/Data/Database/Local/LocalDatabaseInstance.uc index f4ee76f..4cb2725 100644 --- a/sources/Data/Database/Local/LocalDatabaseInstance.uc +++ b/sources/Data/Database/Local/LocalDatabaseInstance.uc @@ -86,8 +86,6 @@ var private DBTask lastTask; // Remember task's life version to make sure we still have the correct copy var private int lastTaskLifeVersion; -var private LoggerAPI.Definition warnDataErasedForAcediaStructure; - protected function Constructor() { _.unreal.OnTick(self).connect = CompleteAllTasks; @@ -343,38 +341,9 @@ public final function Initialize(LocalDatabase config, DBRecord root) configEntry = config; rootRecord = root; - if (config.RequiresAcediaStructure()) { - CreateAcediaStructure(config); - } ScheduleDiskUpdate(); } -// Create JSON object at "/users" if something else (or nothing) -// is stored there -private final function CreateAcediaStructure(LocalDatabase config) -{ - local DataType usersType; - local JSONPointer usersPointer; - local AssociativeArray emptyObject; - if (config == none) return; - if (rootRecord == none) return; - - usersPointer = _.json.Pointer(P("/users")); - usersType = rootRecord.GetObjectType(usersPointer); - if (usersType != JSON_Object) - { - emptyObject = _.collections.EmptyAssociativeArray(); - rootRecord.SaveObject(usersPointer, emptyObject); - emptyObject.FreeSelf(); - if (usersType != JSON_Undefined) - { - _.logger.Auto(warnDataErasedForAcediaStructure) - .Arg(config.GetPackageName()); - } - } - usersPointer.FreeSelf(); -} - /** * Returns config object that describes caller database. * @@ -390,5 +359,4 @@ public final function LocalDatabase GetConfig() defaultproperties { usesObjectPool = false - warnDataErasedForAcediaStructure = (l=LOG_Warning,m="Data was erased at \"/users\" in database \"%1\" to create Acedia's database structure.") } \ No newline at end of file