Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ❯ \cat ../opensim/inventory-reset/README.txt
- A Description of an Avatar Inventory Reset Script for OpenSimulator Grids and Standalone Regions
- 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
- 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
- reloading their inventories for backups, thus preening, cleaning, and flushing the inventories of any undesireable or waste content. The note/readme will begin with
- 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.
- Lets begin, without additional fuss:
- The basic operation/algorythm
- The basic operation's algorythm goes something like this:
- - 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,
- but as of this time, I don't have a clear picture of how to accomplish this.
- - 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'.
- 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,
- 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
- may prefer to start over scratch, while others would be devestated. This is why such care must be undertaken with the process.
- The Strategy for Implementation
- 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
- 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
- until a better understading is obtained as to how the mono program can execute the necessary sql statements to accomplish the purpose.
- The SQL:
- 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
- will produce what is needed for OSgrid:
- CREATE TABLE migrations(name varchar(100), version int);
- CREATE TABLE inventoryfolders(
- folderName varchar(64),
- type integer,
- version integer,
- folderID varchar(36) primary key,
- agentID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
- parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000');
- CREATE TABLE inventoryitems(
- assetID varchar(36),
- assetType integer,
- inventoryName varchar(64),
- inventoryDescription varchar(128),
- inventoryNextPermissions integer,
- inventoryCurrentPermissions integer,
- invType integer,
- creatorID varchar(128),
- inventoryBasePermissions integer,
- inventoryEveryOnePermissions integer,
- salePrice integer default 99,
- saleType integer default 0,
- creationDate integer default 2000,
- groupID varchar(36) default '00000000-0000-0000-0000-000000000000',
- groupOwned integer default 0,
- flags integer default 0,
- inventoryID varchar(36) primary key,
- parentFolderID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
- avatarID varchar(36) not null default '00000000-0000-0000-0000-000000000000',
- inventoryGroupPermissions integer not null default 0);
- CREATE INDEX inventoryfolders_agentid on inventoryfolders(agentID);
- CREATE INDEX inventoryfolders_parentid on inventoryfolders(parentFolderID);
- CREATE INDEX inventoryitems_parentfolderid on inventoryitems(parentFolderID);
- CREATE INDEX inventoryitems_avatarid on inventoryitems(avatarID);
- Classes and procedures we need to filch from the OpenSimulator source code:
- - from OpenSim/Services/InventoryService/XInventoryService.cs, we need to wrap in a class identical to "public class XInventoryService : ServiceBase, IInventoryService",
- excepting such parts of it as are required to support the successful execution of 'public virtual bool CreateUserInventory(UUID principalID)', and by extension,
- 'protected XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name)'. This means we'll also need to find where 'm_Database.StoreFolder(newFolder);'
- is defined.
- - 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
- action(s) to establish the user's OpenSim Library folder, and this too, must surely be done.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement