Advertisement
Hiro_Protagonist

Untitled

Feb 3rd, 2025
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | Fixit | 0 0
  1. ❯ \cat ../opensim/inventory-reset/README.txt
  2. A Description of an Avatar Inventory Reset Script for OpenSimulator Grids and Standalone Regions
  3.  
  4. This note/readme describes a tool for re-initializing the inventory of all avatars in the tablespace of an OpenSimulator standalone instance or grid. It's creation
  5. was requested by Dan Banner, CEO of OSgrid, Inc., to facillitate the rebuilding of the basic inventory system of the grid, in anticipation of concerned avatars
  6. reloading their inventories for backups, thus preening, cleaning, and flushing the inventories of any undesireable or waste content. The note/readme will begin with
  7. this goal statement, an overview of the basic mechanism by which it is to be accomplished, and ultimately, all the source code in SQL and C#/mono for the utility.
  8.  
  9. Lets begin, without additional fuss:
  10.  
  11. The basic operation/algorythm
  12.  
  13. The basic operation's algorythm goes something like this:
  14.  
  15. - drop and re-create the affected tables. This is the part that can be implemented directly as an SQL script. That script could also be embedded in the C# code,
  16. but as of this time, I don't have a clear picture of how to accomplish this.
  17.  
  18. - Rebuild the initial table contents for the inventory of each user. This is essentially a template of the inventory, sans-items, except of course, for the 'OpenSim Library'.
  19.  
  20. Simple, eh? heh. While there's bound to be more to it, this is the essence of it. It loses the old data (on purpose), and prepares the tables for each user's inventory items,
  21. as if they'd only logged in once and never touched a thing. This sets the stage for the use of IAR files to restore their previous inventory, sans-trash, if they desire. Many
  22. may prefer to start over scratch, while others would be devestated. This is why such care must be undertaken with the process.
  23.  
  24. The Strategy for Implementation
  25.  
  26. The strategy for implementation of this process is straightforward: crib the code from opensim that accomplishes these things, and create a much, much smaller project that
  27. performs the previously described tasks. No doubt the finished product will not be a sql script and a mono program, but we will speak in such terms as if it were to be so
  28. until a better understading is obtained as to how the mono program can execute the necessary sql statements to accomplish the purpose.
  29.  
  30. The SQL:
  31.  
  32. Following is the SQL to drop and recreate the tables, at least for SQLite3. It is lifted from the tables directly using the sqlite3 '.schema' command. A similar command for mariadb
  33. will produce what is needed for OSgrid:
  34.  
  35. CREATE TABLE migrations(name varchar(100), version int);
  36. CREATE TABLE inventoryfolders(
  37. folderName varchar(64),
  38. type integer,
  39. version integer,
  40. folderID varchar(36) primary key,
  41. agentID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
  42. parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000');
  43. CREATE TABLE inventoryitems(
  44. assetID varchar(36),
  45. assetType integer,
  46. inventoryName varchar(64),
  47. inventoryDescription varchar(128),
  48. inventoryNextPermissions integer,
  49. inventoryCurrentPermissions integer,
  50. invType integer,
  51. creatorID varchar(128),
  52. inventoryBasePermissions integer,
  53. inventoryEveryOnePermissions integer,
  54. salePrice integer default 99,
  55. saleType integer default 0,
  56. creationDate integer default 2000,
  57. groupID varchar(36) default '00000000-0000-0000-0000-000000000000',
  58. groupOwned integer default 0,
  59. flags integer default 0,
  60. inventoryID varchar(36) primary key,
  61. parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
  62. avatarID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
  63. inventoryGroupPermissions integer not null default 0);
  64. CREATE INDEX inventoryfolders_agentid on inventoryfolders(agentID);
  65. CREATE INDEX inventoryfolders_parentid on inventoryfolders(parentFolderID);
  66. CREATE INDEX inventoryitems_parentfolderid on inventoryitems(parentFolderID);
  67. CREATE INDEX inventoryitems_avatarid on inventoryitems(avatarID);
  68.  
  69.  
  70.  
  71. Classes and procedures we need to filch from the OpenSimulator source code:
  72.  
  73. - from OpenSim/Services/InventoryService/XInventoryService.cs, we need to wrap in a class identical to "public class XInventoryService : ServiceBase, IInventoryService",
  74. excepting such parts of it as are required to support the successful execution of 'public virtual bool CreateUserInventory(UUID principalID)', and by extension,
  75. 'protected XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name)'. This means we'll also need to find where 'm_Database.StoreFolder(newFolder);'
  76. is defined.
  77.  
  78. - we'll need to find not just 'm_Database.StoreFolder(newFolder);', but likely some other things as well. For instance, as best as I read this code, it does not perform any
  79. action(s) to establish the user's OpenSim Library folder, and this too, must surely be done.
  80.  
  81.  
  82.  
  83.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement