Check inventory script/de

From OpenSimulator

Revision as of 22:57, 12 May 2022 by Manni (Talk | contribs)

Jump to: navigation, search

Contents

Überprüfen des Inventarskript

Vor 2022 akzeptierten die Viewer jede Form von Inventar.

Dies hat sich nun geändert, da Viewern neuer Code hinzugefügt wurde, um zu überprüfen, ob die Bestandsstruktur ordnungsgemäß eingerichtet ist.

Leider weisen aufgrund von Fehlern und Änderungen in OpenSim einige ältere Inventare von Benutzern, die vor 2015 erstellt wurden,

problematische Strukturen auf, die dazu führen können, dass das Inventar nicht geladen oder die Anmeldung vollständig blockiert wird.

Dieses Skript soll Grid-Betreibern eine Möglichkeit geben, das Inventar eines Benutzers oder aller Benutzer zu validieren,

um zu sehen bei welchen wahrscheinlich Probleme auftreten und was genau falsch ist.

Wir beschreiben hier auch die Schritte und Tools zur Behebung dieser Probleme.

Das Skript

Derzeit ein Github-Gist der Einfachheit halber, bitte richten Sie Probleme oder Anfragen an IRC

Check Inventory Script

Verwendungszweck

Das Skript erfordert einen Server, auf dem PHP7.4 installiert ist.

  • Öffnen Sie das Skript mit Ihrem bevorzugten Editor und überprüfen Sie das oberste Setup auf $database info Variablen. Stellen Sie sie so ein, dass sie sich mit Ihrer Grid-Datenbank verbinden, die die Inventoryfolder-Tabelle enthält.
  • Führen Sie das Skript über aus
     php check_inventory.php FirstName LastName 
    Dadurch wird das Skript ausgeführt, das nach schwerwiegenden Inventarfehlern sucht.
  • Führen Sie das Skript über aus
     php check_inventory.php FirstName LastName true
    Führt das Skript aus und sucht nach optionalen doppelten Ordnern desselben Typs.

Das Skript kann auch für alle Benutzer ausgeführt werden, aber die Ausgabe wird ziemlich groß sein. Es ist am besten, wenn möglich, die Ausgabe in eine Datei zu leiten.

 php check_inventory.php everyone true
Führt das Skript aus und sucht nach optionalen doppelten Ordnern desselben Typs für alle Benutzer in der UserAccounts-Tabelle.



Wenn dies kompliziert oder gefährlich erscheint, liegt dies daran, dass Änderungen in der Datenbank normalerweise direkt vorgenommen werden. Wenn Sie dies lieber jemandem mit mehr Wissen überlassen möchten, können Sie sich gerne an die Leute im IRC wenden, um Hilfe zu erhalten, oder einen der vielen providers of OpenSim hosted services.

How to resolve issues

Inventory setup was meant to have a single root folder, called "My Inventory". All folders should be sorted underneath this folder.

The usual folders for Clothing, Objects and even Trash have specific types designed to give them their icons and provide a way to sort incoming items accordingly. Only one set of these is meant to exist, but OpenSim adds a second set of these folders to the inventory under the "My Suitcase" folder used for the HG1.0 protocol.

You can read more about the folder types in the Database documentation

To resolve issues the inventory structure needs to be returned to the proper setup accepted by the viewers. To do this you will need to edit the inventoryfolders database table. This can be done from the command line or via external programs such as DBeaver or Navicat whichever you prefer.


Create a backup

Using tools like sqldump or the aforementioned database tools create a backup of the inventoryfolders table first before making edits to the table!


Find the user

Using either filters or an SQL query to select just the user we are concerned with filter for the "AgentID" in inventoryfolders.

 SELECT * FROM inventoryfolders WHERE `AgentID` = 'user-uuid' ;

Check the specific folders

The script will check for folders that are not "-1" of type, which signifies a normal folder a user might create. To fetch just these folders add a filter to only show folders not of this type.

 SELECT * FROM inventoryfolders WHERE `AgentID` = 'user-uuid' AND `type` != '-1' ;

Find the duplicates

To find the folders under "My Suitcase" is easy now. You should see the "My Inventory" folder in the selected set of rows showing also the parentFolderID, which should be a null key i.e. "00000000-0000-0000-0000-000000000000". You can see it's folderID as well here. This UUID will be what all proper other inventory folders, such as Clothing, Objects and Trash, will show in their respective parentFolderID. This creates a hierarchy starting with "My Inventory" and cascading down to all folders in the inventory structure.

Now sorting the query by the folderName will easily show the duplicates and their parentFolderID pointing not to "My Inventory" but the "My Suitcase" folder and its folderID.

 SELECT * FROM inventoryfolders WHERE `AgentID` = 'user-uuid' AND `type` != '-1' ORDER BY folderName DESC;

Observe, the "My Suitcase" folder's parent folder is also "My Inventory" folder.

Remove duplicates

Unless you are running the HG1.0 protocol using the "My Suitcase" folder to share items on the hypergrid without exposing your entire inventory you don't actually need the folder or it's sub-folders.

However, removing the folder entirely when it might contain items the user placed there might not be the best idea. Instead simply change the type of each duplicate folder to "-1" to make them regular folders.

 UPDATE inventoryfolders SET `type` = '-1' WHERE `AgentID` = 'user-uuid' AND `parentFolderID` != 'folderID of My Inventory' AND `parentFolderID` != '00000000-0000-0000-0000-000000000000'; 

This will set all folders to type "-1" for that specific user if the parent folder is not "My Inventory", which will change all "My Suitcase" sub-folders.

Checking bad root folders

Newer versions of OpenSim will put the "My Suitcase" folder as a type that does not conflict, usually type "100", but older versions will have put it as type "8" or "9", which causes a fatal error. To resolve this change the type to "100".

 UPDATE inventoryfolders SET `type` = '100' WHERE `AgentID` = 'user-uuid' AND `folderName` = 'My Suitcase'; 

In some cases the "My Inventory" folder might still be of the old type "9", which will also causes issues. To resolve this it needs to be changed to type "8".

 UPDATE inventoryfolders SET `type` = '8' WHERE `AgentID` = 'user-uuid' AND `folderName` = 'My Inventory'; 

These queries can, but probably should not be, run for all users by omitting the where clause specifying the agent UUID. We strongly suggest you look at each users inventory separately and make changes as required!!

Personal tools
General
About This Wiki