Compare commits

...

61 Commits

Author SHA1 Message Date
Fernando Oliveira
a3eb5bd8ad Merge branch 'master' of https://github.com/nebadon2025/opensimulator 2013-09-03 11:56:25 -03:00
Fernando Oliveira
e8272ab138 First commit - converting from mysql 2013-07-04 17:52:43 -03:00
Fernando Oliveira
98cef2a961 sincronização com master remoto 2013-07-04 14:59:26 -03:00
Fernando Oliveira
2d065bd327 Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	CONTRIBUTORS.txt
	OpenSim/Framework/Monitoring/BaseStatsCollector.cs
	OpenSim/Framework/Monitoring/MemoryWatchdog.cs
	OpenSim/Framework/Servers/MainServer.cs
	OpenSim/Framework/Util.cs
	OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
	OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
	OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
	OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
	OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
	OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
	OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
	OpenSim/Region/Framework/Interfaces/ISoundModule.cs
	OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
	OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
	OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs
	OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
	OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
	OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
	OpenSim/Services/HypergridService/GatekeeperService.cs
	OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs
	bin/OpenMetaverse.Rendering.Meshmerizer.dll
	bin/OpenMetaverse.dll.config
2013-07-04 14:55:49 -03:00
Fernando Oliveira
81c484d713 Merge branch 'master' of https://github.com/nebadon2025/opensimulator
Conflicts:
	OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
	OpenSim/ApplicationPlugins/RegionModulesController/Properties/AssemblyInfo.cs
	OpenSim/ApplicationPlugins/RemoteController/Properties/AssemblyInfo.cs
	OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs
	OpenSim/ApplicationPlugins/Rest/RestPlugin.cs
	OpenSim/Capabilities/Handlers/Properties/AssemblyInfo.cs
	OpenSim/Capabilities/Properties/AssemblyInfo.cs
	OpenSim/ConsoleClient/Properties/AssemblyInfo.cs
	OpenSim/Data/MSSQL/Properties/AssemblyInfo.cs
	OpenSim/Data/MySQL/Properties/AssemblyInfo.cs
	OpenSim/Data/Null/Properties/AssemblyInfo.cs
	OpenSim/Data/Properties/AssemblyInfo.cs
	OpenSim/Data/SQLite/Properties/AssemblyInfo.cs
	OpenSim/Framework/AssemblyInfo.cs
	OpenSim/Framework/AssetLoader/Filesystem/Properties/AssemblyInfo.cs
	OpenSim/Framework/Communications/Properties/AssemblyInfo.cs
	OpenSim/Framework/Configuration/HTTP/Properties/AssemblyInfo.cs
	OpenSim/Framework/Configuration/XML/Properties/AssemblyInfo.cs
	OpenSim/Framework/Console/AssemblyInfo.cs
	OpenSim/Framework/Monitoring/Properties/AssemblyInfo.cs
	OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
	OpenSim/Framework/Monitoring/Stats/Stat.cs
	OpenSim/Framework/Monitoring/StatsManager.cs
	OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
	OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
	OpenSim/Framework/Serialization/Properties/AssemblyInfo.cs
	OpenSim/Framework/Servers/BaseOpenSimServer.cs
	OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
	OpenSim/Framework/Servers/HttpServer/Properties/AssemblyInfo.cs
	OpenSim/Framework/Servers/Properties/AssemblyInfo.cs
	OpenSim/Framework/Servers/ServerBase.cs
	OpenSim/Region/Application/OpenSim.cs
	OpenSim/Region/Application/OpenSimBase.cs
	OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
	OpenSim/Region/ClientStack/Linden/Caps/Properties/AssemblyInfo.cs
	OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs
	OpenSim/Region/ClientStack/Properties/AssemblyInfo.cs
	OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
	OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
	OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
	OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
	OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
	OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs
	OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
	OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
	OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
	OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
	OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs
	OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs
	OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
	OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
	OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
	OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
	OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs
	OpenSim/Region/Framework/Properties/AssemblyInfo.cs
	OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
	OpenSim/Region/Framework/Scenes/EventManager.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/Framework/Scenes/SceneManager.cs
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
	OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
	OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs
	OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
	OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
	OpenSim/Region/OptionalModules/Properties/AssemblyInfo.cs
	OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs
	OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs
	OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
	OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
	OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
	OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
	OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
	OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
	OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
	OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
	OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
	OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
	OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
	OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
	OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
	OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
	OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs
	OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs
	OpenSim/Region/Physics/Manager/AssemblyInfo.cs
	OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs
	OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs
	OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs
	OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Properties/AssemblyInfo.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Runtime/Properties/AssemblyInfo.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Runtime/YieldProlog/Properties/AssemblyInfo.cs
	OpenSim/Region/ScriptEngine/Shared/CodeTools/Properties/AssemblyInfo.cs
	OpenSim/Region/ScriptEngine/Shared/Instance/Properties/AssemblyInfo.cs
	OpenSim/Region/ScriptEngine/Shared/Properties/AssemblyInfo.cs
	OpenSim/Region/ScriptEngine/XEngine/Properties/AssemblyInfo.cs
	OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs
	OpenSim/Server/Base/Properties/AssemblyInfo.cs
	OpenSim/Server/Base/ServicesServerBase.cs
	OpenSim/Server/Handlers/Properties/AssemblyInfo.cs
	OpenSim/Server/Properties/AssemblyInfo.cs
	OpenSim/Services/AssetService/Properties/AssemblyInfo.cs
	OpenSim/Services/AssetService/XAssetService.cs
	OpenSim/Services/AuthenticationService/Properties/AssemblyInfo.cs
	OpenSim/Services/AuthorizationService/Properties/AssemblyInfo.cs
	OpenSim/Services/AvatarService/Properties/AssemblyInfo.cs
	OpenSim/Services/Base/Properties/AssemblyInfo.cs
	OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
	OpenSim/Services/FreeswitchService/Properties/AssemblyInfo.cs
	OpenSim/Services/Friends/Properties/AssemblyInfo.cs
	OpenSim/Services/GridService/Properties/AssemblyInfo.cs
	OpenSim/Services/HypergridService/Properties/AssemblyInfo.cs
	OpenSim/Services/HypergridService/UserAgentService.cs
	OpenSim/Services/Interfaces/Properties/AssemblyInfo.cs
	OpenSim/Services/InventoryService/Properties/AssemblyInfo.cs
	OpenSim/Services/LLLoginService/Properties/AssemblyInfo.cs
	OpenSim/Services/MapImageService/Properties/AssemblyInfo.cs
	OpenSim/Services/PresenceService/Properties/AssemblyInfo.cs
	OpenSim/Services/UserAccountService/Properties/AssemblyInfo.cs
	OpenSim/Tests/Common/Helpers/SceneHelpers.cs
	OpenSim/Tests/Common/Mock/TestScene.cs
	OpenSim/Tools/Compiler/Properties/AssemblyInfo.cs
	OpenSim/Tools/Configger/Properties/AssemblyInfo.cs
	OpenSim/Tools/pCampBot/Properties/AssemblyInfo.cs
	ThirdParty/SmartThreadPool/AssemblyInfo.cs
	bin/OpenMetaverse.StructuredData.dll
	bin/OpenMetaverse.dll
	bin/OpenMetaverseTypes.dll
	bin/OpenSim.ini.example
	bin/OpenSimDefaults.ini
	bin/Robust.HG.ini.example
	bin/Robust.ini.example
	bin/config-include/StandaloneCommon.ini.example
	bin/lib32/BulletSim.dll
	bin/lib32/libBulletSim.so
	bin/lib64/BulletSim.dll
	bin/lib64/libBulletSim.so
	prebuild.xml
2013-04-17 23:41:43 -03:00
Fernando Oliveira
335687c846 Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	.gitignore
	OpenSim/Data/IXGroupData.cs
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2013-03-14 23:53:10 -03:00
Fernando Oliveira
cdbf39ddba Added MySQL/MySQLXGroupData.cs 2013-01-17 16:55:40 -02:00
Fernando Oliveira
269e20ca11 Rolled back to the nebadon source 2013-01-17 14:03:14 -02:00
Fernando Oliveira
0bcd3860cf Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2013-01-17 11:44:07 -02:00
Fernando Oliveira
94b5ea1b5a Merge remote-tracking branch 'upstream/master'
Conflicts:
	.gitignore
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2013-01-17 11:41:46 -02:00
Fernando Oliveira
9106d82382 Merge remote-tracking branch 'upstream/master'
Conflicts:
	.gitignore
	OpenSim/Framework/Console/ConsoleUtil.cs
	OpenSim/Region/Application/OpenSim.cs
	OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
	OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs
	OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
	OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
	OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
	OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
	OpenSim/Region/Framework/Scenes/EventManager.cs
	OpenSim/Region/Framework/Scenes/Scene.cs
	OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
	OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
	OpenSim/Region/Physics/BulletSPlugin/BS6DofConstraint.cs
	OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
	OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs
	OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
	OpenSim/Region/Physics/BulletSPlugin/BSHingeConstraint.cs
	OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
	OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
	OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
	OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs
	OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs
	OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
	OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs
	OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
	OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
	OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
	OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
	OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
	OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
	OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
	OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
	OpenSim/Region/Physics/Manager/PhysicsActor.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
	OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
	OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
	OpenSim/Region/UserStatistics/WebStatsModule.cs
	OpenSim/Server/Base/ServicesServerBase.cs
	OpenSim/Server/ServerMain.cs
	bin/OpenMetaverse.dll.config
	bin/OpenSim.ini.example
	bin/OpenSimDefaults.ini
	bin/Robust.HG.ini.example
	bin/Robust.ini.example
	bin/config-include/GridCommon.ini.example
	bin/lib32/BulletSim.dll
	bin/lib32/libBulletSim.so
	bin/lib64/BulletSim.dll
	bin/lib64/libBulletSim.so
2013-01-16 23:08:55 -02:00
Fernando Oliveira
5d3d600b2e Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2013-01-16 22:15:01 -02:00
Fernando Oliveira
31a43c7fbc Merge remote-tracking branch 'upstream/master' 2012-09-18 00:45:31 -03:00
Fernando Oliveira
82fd8c46ea Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
2012-09-15 14:20:33 -03:00
Fernando Oliveira
0ce8a5f76a added PostGreSQL support 2012-09-15 13:38:19 -03:00
Fernando Oliveira
34114c4e28 Merge remote-tracking branch 'upstream/master' 2012-08-19 22:59:24 -03:00
Fernando Oliveira
f839385af9 Merge remote-tracking branch 'upstream/master' 2012-05-03 20:11:24 -03:00
Fernando Oliveira
a6bce45692 Merge remote-tracking branch 'upstream/master' 2012-05-02 20:52:41 -03:00
Fernando Oliveira
7615d12148 Merge remote-tracking branch 'upstream/master' 2012-04-29 13:32:32 -03:00
Fernando Oliveira
0365fec926 Merge remote-tracking branch 'upstream/master' 2012-04-19 23:09:07 -03:00
Fernando Oliveira
53d21bcb50 Merge remote-tracking branch 'upstream/master' 2012-04-17 23:59:40 -03:00
Fernando Oliveira
c45392c17e Merge remote-tracking branch 'upstream/master' 2012-04-01 23:23:42 -03:00
Fernando Oliveira
7ac437987a Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	bin/lib32/BulletSim.dll
	bin/lib64/BulletSim.dll
2012-03-30 00:52:48 -03:00
Fernando Oliveira
9e17b07e8b Merge remote-tracking branch 'upstream/master' 2012-03-30 00:47:21 -03:00
Fernando Oliveira
8600ea2763 Merge branch 'master' into myideas 2012-03-27 00:45:13 -03:00
Fernando Oliveira
cd6fe5c4e6 Merge remote-tracking branch 'upstream/master' 2012-03-25 20:16:27 -03:00
Fernando Oliveira
64884bf65c Merge remote-tracking branch 'upstream/master' 2012-03-24 00:25:01 -03:00
Fernando Oliveira
c01db95f48 Merge remote-tracking branch 'remotes/upstream/master' into myideas
Started to implement GetEmptyCoordinates
2012-03-15 01:33:41 -03:00
Fernando Oliveira
3fbadb79ba Merge branch 'master' of https://github.com/ffoliveira/opensimulator
Conflicts:
	OpenSim/Region/Application/OpenSimBase.cs
	bin/OpenSim.ini.example
2012-03-10 20:40:26 -03:00
Fernando Oliveira
6eeba80d2a Merge remote-tracking branch 'upstream/master' 2012-03-10 20:31:40 -03:00
Fernando Oliveira
04431fcb01 Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/Application/OpenSimBase.cs
	bin/OpenSim.ini.example
2012-03-10 20:31:30 -03:00
Fernando Oliveira
bbe9af5576 Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/Application/OpenSimBase.cs
	bin/OpenSim.ini.example
2012-03-10 00:34:16 -03:00
Fernando Oliveira
6b4e4da89e Merge remote-tracking branch 'upstream/master' 2012-03-09 20:14:39 -03:00
Fernando Oliveira
b6e963c830 Merge branch 'master' of https://github.com/ffoliveira/opensimulator 2012-03-09 20:11:24 -03:00
Fernando Oliveira
8ea08cf4b4 merge changes from opensim 2012-03-09 20:11:02 -03:00
Fernando Oliveira
d92fc1dfb3 merge changes from opensim 2012-03-09 20:09:13 -03:00
Fernando Oliveira
83c018ebcd Merge remote-tracking branch 'upstream/master'
Conflicts:
	OpenSim/Region/Framework/Scenes/Scene.cs
2012-03-06 23:32:20 -03:00
Fernando Oliveira
cf763b8306 Merge remote-tracking branch 'upstream/master' 2012-02-29 23:09:00 -03:00
Fernando Oliveira
5cda6ab754 Merge remote-tracking branch 'upstream/master' 2012-02-25 00:48:11 -02:00
Fernando Oliveira
6f6e05d775 Optimizations on osSetDynamicTextureURL function to reduce memory leak 2012-02-24 01:29:18 -02:00
Fernando Oliveira
c07fdc6ac4 Merge remote-tracking branch 'upstream/master' 2012-02-23 13:21:14 -02:00
Fernando Oliveira
2e6f5f6bcd Changed the Estate first letter keys to uppercase 2012-02-23 13:16:47 -02:00
Fernando Oliveira
705b3fe414 Merge remote-tracking branch 'upstream/master' 2012-02-20 22:53:27 -02:00
Fernando Oliveira
55aaea8b91 Just added Maptile default to UUID.Zero 2012-02-20 22:53:22 -02:00
Fernando Oliveira
f4e32350ed Changed back to generate maptiles when there are no MaptileStaticUUID at regions.ini 2012-02-15 15:55:02 -02:00
Fernando Oliveira
58f5e4b47a Merge branch 'master' of https://github.com/ffoliveira/opensimulator 2012-02-15 02:04:58 -02:00
Fernando Oliveira
ddacc87617 Implemented different MapTile for each region in Regions.ini using MaptileStaticUUID key
OpenSim.ini MaptileStaticUUID still work for default regions

Signed-off-by: Fernando Oliveira <fernando@oliveira.eti.br>
2012-02-15 02:03:32 -02:00
Fernando Oliveira
c5d1d6c47b Implemented different MapTile for each region in Regions.ini using MaptileStaticUUID key
OpenSim.ini MaptileStaticUUID still work for default regions

Signed-off-by: Fernando Oliveira <fernando@oliveira.eti.br>
2012-02-15 01:35:49 -02:00
Fernando Oliveira
23ebe65add Merge remote-tracking branch 'upstream/master' 2012-02-15 00:28:22 -02:00
Fernando Oliveira
c611966828 try to configure maptile for each region 2012-02-15 00:27:10 -02:00
Fernando Oliveira
b9fa9a801e Added Log to Maptile from Regions.ini 2012-02-10 01:55:08 -02:00
Fernando Oliveira
ec38593674 Put MaptileStaticUUID also in Regions.Ini file - as an alternative to MapTile by region 2012-02-10 00:17:34 -02:00
Fernando Oliveira
f018047460 Merge branch 'master' of https://github.com/ffoliveira/opensimulator 2012-02-09 22:34:38 -02:00
Fernando Oliveira
60a0395837 sync and merge source code from nebadom repo 2012-02-09 22:05:59 -02:00
Fernando Oliveira
d27ed42897 Merge remote-tracking branch 'upstream/master' 2012-02-09 22:00:26 -02:00
Fernando Oliveira
8bdc238ca4 Automatic empty coordinates attribution at sim creation 2012-02-09 21:56:24 -02:00
root
6903b60a0f Merge remote-tracking branch 'upstream/master' 2012-02-02 13:19:56 -05:00
Fernando Oliveira
46dec8666c New methods to get empty coordinates from the server 2012-01-23 16:11:42 -02:00
Fernando Oliveira
352774d5bf Merge remote-tracking branch 'remotes/upstream/master' 2012-01-22 16:04:22 -02:00
Fernando Oliveira
34c0bd212a Moved the EstateName and EstateOwner to OpenSim.ini at EstateDefaults entry
To be used only on first time Estate Creation

Signed-off-by: Fernando Oliveira <fernando@oliveira.eti.br>
2012-01-22 02:04:10 -02:00
Fernando Oliveira
3032b49ec4 Changed to Auto Create a Sim at first time using the Regions.ini files Master Avatar and Estate keys 2012-01-21 19:08:04 -02:00
63 changed files with 22340 additions and 12334 deletions

View File

@@ -0,0 +1,385 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Data;
using System.Reflection;
using System.Collections.Generic;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
namespace OpenSim.Data.MongoDB
{
/// <summary>
/// A MongoDB Interface for the Asset Server
/// </summary>
public class MongoDBAssetData : AssetDataBase
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_connectionString;
private object m_dbLock = new object();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
#region IPlugin Members
public override string Version { get { return "1.0.0.0"; } }
/// <summary>
/// <para>Initialises Asset interface</para>
/// <para>
/// <list type="bullet">
/// <item>Loads and initialises the MongoDB storage plugin.</item>
/// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
/// <item>Check for migration</item>
/// </list>
/// </para>
/// </summary>
/// <param name="connect">connect string</param>
public override void Initialise(string connect)
{
m_connectionString = connect;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AssetStore");
m.Update();
}
}
public override void Initialise()
{
throw new NotImplementedException();
}
public override void Dispose() { }
/// <summary>
/// The name of this DB provider
/// </summary>
override public string Name
{
get { return "MongoDB Asset storage engine"; }
}
#endregion
#region IAssetDataPlugin Members
/// <summary>
/// Fetch Asset <paramref name="assetID"/> from database
/// </summary>
/// <param name="assetID">Asset UUID to fetch</param>
/// <returns>Return the asset</returns>
/// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks>
override public AssetBase GetAsset(UUID assetID)
{
AssetBase asset = null;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(
"SELECT name, description, assetType, local, temporary, asset_flags, CreatorID, data FROM assets WHERE id=?id",
dbcon))
{
cmd.Parameters.AddWithValue("?id", assetID.ToString());
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if (dbReader.Read())
{
asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], dbReader["CreatorID"].ToString());
asset.Data = (byte[])dbReader["data"];
asset.Description = (string)dbReader["description"];
string local = dbReader["local"].ToString();
if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
asset.Local = true;
else
asset.Local = false;
asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
}
}
}
catch (Exception e)
{
m_log.Error(
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
}
}
}
}
return asset;
}
/// <summary>
/// Create an asset in database, or update it if existing.
/// </summary>
/// <param name="asset">Asset UUID to create</param>
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
override public void StoreAsset(AssetBase asset)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd =
new MySqlCommand(
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)",
dbcon))
{
string assetName = asset.Name;
if (asset.Name.Length > 64)
{
assetName = asset.Name.Substring(0, 64);
m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
}
string assetDescription = asset.Description;
if (asset.Description.Length > 64)
{
assetDescription = asset.Description.Substring(0, 64);
m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
try
{
using (cmd)
{
// create unix epoch time
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
cmd.Parameters.AddWithValue("?id", asset.ID);
cmd.Parameters.AddWithValue("?name", assetName);
cmd.Parameters.AddWithValue("?description", assetDescription);
cmd.Parameters.AddWithValue("?assetType", asset.Type);
cmd.Parameters.AddWithValue("?local", asset.Local);
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
cmd.Parameters.AddWithValue("?create_time", now);
cmd.Parameters.AddWithValue("?access_time", now);
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
cmd.Parameters.AddWithValue("?data", asset.Data);
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.Error(
string.Format(
"[ASSET DB]: MongoDB failure creating asset {0} with name {1}. Exception ",
asset.FullID, asset.Name)
, e);
}
}
}
}
}
private void UpdateAccessTime(AssetBase asset)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd
= new MySqlCommand("update assets set access_time=?access_time where id=?id", dbcon))
{
try
{
using (cmd)
{
// create unix epoch time
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
cmd.Parameters.AddWithValue("?id", asset.ID);
cmd.Parameters.AddWithValue("?access_time", now);
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.Error(
string.Format(
"[ASSETS DB]: Failure updating access_time for asset {0} with name {1}. Exception ",
asset.FullID, asset.Name),
e);
}
}
}
}
}
/// <summary>
/// Check if the asset exists in the database
/// </summary>
/// <param name="uuid">The asset UUID</param>
/// <returns>true if it exists, false otherwise.</returns>
override public bool ExistsAsset(UUID uuid)
{
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
bool assetExists = false;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand("SELECT id FROM assets WHERE id=?id", dbcon))
{
cmd.Parameters.AddWithValue("?id", uuid.ToString());
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if (dbReader.Read())
{
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
assetExists = true;
}
}
}
catch (Exception e)
{
m_log.Error(
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", uuid), e);
}
}
}
}
return assetExists;
}
/// <summary>
/// Returns a list of AssetMetadata objects. The list is a subset of
/// the entire data set offset by <paramref name="start" /> containing
/// <paramref name="count" /> elements.
/// </summary>
/// <param name="start">The number of results to discard from the total data set.</param>
/// <param name="count">The number of rows the returned list should contain.</param>
/// <returns>A list of AssetMetadata objects.</returns>
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
{
List<AssetMetadata> retList = new List<AssetMetadata>(count);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd
= new MySqlCommand(
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
dbcon))
{
cmd.Parameters.AddWithValue("?start", start);
cmd.Parameters.AddWithValue("?count", count);
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader())
{
while (dbReader.Read())
{
AssetMetadata metadata = new AssetMetadata();
metadata.Name = (string)dbReader["name"];
metadata.Description = (string)dbReader["description"];
metadata.Type = (sbyte)dbReader["assetType"];
metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
metadata.FullID = DBGuid.FromDB(dbReader["id"]);
metadata.CreatorID = dbReader["CreatorID"].ToString();
// Current SHA1s are not stored/computed.
metadata.SHA1 = new byte[] { };
retList.Add(metadata);
}
}
}
catch (Exception e)
{
m_log.Error(
string.Format(
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
start, count),
e);
}
}
}
}
return retList;
}
public override bool Delete(string id)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon))
{
cmd.Parameters.AddWithValue("?id", id);
cmd.ExecuteNonQuery();
}
}
}
return true;
}
#endregion
}
}

View File

@@ -0,0 +1,226 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
public class MySqlAuthenticationData : MongoDBFramework, IAuthenticationData
{
private string m_Realm;
private List<string> m_ColumnNames;
private int m_LastExpire;
// private string m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySqlAuthenticationData(string connectionString, string realm)
: base(connectionString)
{
m_Realm = realm;
m_connectionString = connectionString;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AuthStore");
m.Update();
}
}
public AuthenticationData Get(UUID principalID)
{
AuthenticationData ret = new AuthenticationData();
ret.Data = new Dictionary<string, object>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd
= new MySqlCommand("select * from `" + m_Realm + "` where UUID = ?principalID", dbcon))
{
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
IDataReader result = cmd.ExecuteReader();
if (result.Read())
{
ret.PrincipalID = principalID;
CheckColumnNames(result);
foreach (string s in m_ColumnNames)
{
if (s == "UUID")
continue;
ret.Data[s] = result[s].ToString();
}
return ret;
}
else
{
return null;
}
}
}
}
private void CheckColumnNames(IDataReader result)
{
if (m_ColumnNames != null)
return;
List<string> columnNames = new List<string>();
DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
columnNames.Add(row["ColumnName"].ToString());
m_ColumnNames = columnNames;
}
public bool Store(AuthenticationData data)
{
if (data.Data.ContainsKey("UUID"))
data.Data.Remove("UUID");
string[] fields = new List<string>(data.Data.Keys).ToArray();
using (MySqlCommand cmd = new MySqlCommand())
{
string update = "update `"+m_Realm+"` set ";
bool first = true;
foreach (string field in fields)
{
if (!first)
update += ", ";
update += "`" + field + "` = ?"+field;
first = false;
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
}
update += " where UUID = ?principalID";
cmd.CommandText = update;
cmd.Parameters.AddWithValue("?principalID", data.PrincipalID.ToString());
if (ExecuteNonQuery(cmd) < 1)
{
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
String.Join("`, `", fields) +
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
cmd.CommandText = insert;
if (ExecuteNonQuery(cmd) < 1)
return false;
}
}
return true;
}
public bool SetDataItem(UUID principalID, string item, string value)
{
using (MySqlCommand cmd
= new MySqlCommand("update `" + m_Realm + "` set `" + item + "` = ?" + item + " where UUID = ?UUID"))
{
cmd.Parameters.AddWithValue("?"+item, value);
cmd.Parameters.AddWithValue("?UUID", principalID.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}
return false;
}
public bool SetToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
using (MySqlCommand cmd
= new MySqlCommand(
"insert into tokens (UUID, token, validity) values (?principalID, ?token, date_add(now(), interval ?lifetime minute))"))
{
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
cmd.Parameters.AddWithValue("?token", token);
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}
return false;
}
public bool CheckToken(UUID principalID, string token, int lifetime)
{
if (System.Environment.TickCount - m_LastExpire > 30000)
DoExpire();
using (MySqlCommand cmd
= new MySqlCommand(
"update tokens set validity = date_add(now(), interval ?lifetime minute) where UUID = ?principalID and token = ?token and validity > now()"))
{
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
cmd.Parameters.AddWithValue("?token", token);
cmd.Parameters.AddWithValue("?lifetime", lifetime.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}
return false;
}
private void DoExpire()
{
using (MySqlCommand cmd = new MySqlCommand("delete from tokens where validity < now()"))
{
ExecuteNonQuery(cmd);
}
m_LastExpire = System.Environment.TickCount;
}
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Threading;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
/// <summary>
/// A MongoDB Interface for the Grid Server
/// </summary>
public class MongoDBAvatarData : MongoDBGenericTableHandler<AvatarBaseData>,
IAvatarData
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public MongoDBAvatarData(string connectionString, string realm) :
base(connectionString, realm, "Avatar")
{
}
public bool Delete(UUID principalID, string name)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = ?PrincipalID and `Name` = ?Name", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?Name", name);
if (ExecuteNonQuery(cmd) > 0)
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,620 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Data;
namespace OpenSim.Data.MongoDB
{
public class MongoDBEstateStore : IEstateDataStore
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string m_waitTimeoutSelect = "select @@wait_timeout";
private string m_connectionString;
private long m_waitTimeout;
private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond;
// private long m_lastConnectionUse;
private FieldInfo[] m_Fields;
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MongoDBEstateStore()
{
}
public MongoDBEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
try
{
m_log.Info("[REGION DB]: MySql - connecting: " + Util.GetDisplayConnectionString(m_connectionString));
}
catch (Exception e)
{
m_log.Debug("Exception: password not found in connection string\n" + e.ToString());
}
GetWaitTimeout();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "EstateStore");
m.Update();
Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
foreach (FieldInfo f in m_Fields)
{
if (f.Name.Substring(0, 2) == "m_")
m_FieldMap[f.Name.Substring(2)] = f;
}
}
}
private string[] FieldList
{
get { return new List<string>(m_FieldMap.Keys).ToArray(); }
}
protected void GetWaitTimeout()
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, dbcon))
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if (dbReader.Read())
{
m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) *
TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
}
}
}
// m_lastConnectionUse = DateTime.Now.Ticks;
m_log.DebugFormat(
"[REGION DB]: Connection wait timeout {0} seconds",
m_waitTimeout / TimeSpan.TicksPerSecond);
}
}
public EstateSettings LoadEstateSettings(UUID regionID, bool create)
{
string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) +
" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID";
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = sql;
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
return DoLoad(cmd, regionID, create);
}
}
public EstateSettings CreateNewEstate()
{
EstateSettings es = new EstateSettings();
es.OnSave += StoreEstateSettings;
DoCreate(es);
LoadBanList(es);
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
return es;
}
private EstateSettings DoLoad(MySqlCommand cmd, UUID regionID, bool create)
{
EstateSettings es = new EstateSettings();
es.OnSave += StoreEstateSettings;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
bool found = false;
using (IDataReader r = cmd.ExecuteReader())
{
if (r.Read())
{
found = true;
foreach (string name in FieldList)
{
if (m_FieldMap[name].FieldType == typeof(bool))
{
m_FieldMap[name].SetValue(es, Convert.ToInt32(r[name]) != 0);
}
else if (m_FieldMap[name].FieldType == typeof(UUID))
{
m_FieldMap[name].SetValue(es, DBGuid.FromDB(r[name]));
}
else
{
m_FieldMap[name].SetValue(es, r[name]);
}
}
}
}
if (!found && create)
{
DoCreate(es);
LinkRegion(regionID, (int)es.EstateID);
}
}
LoadBanList(es);
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
return es;
}
private void DoCreate(EstateSettings es)
{
// Migration case
List<string> names = new List<string>(FieldList);
names.Remove("EstateID");
string sql = "insert into estate_settings (" + String.Join(",", names.ToArray()) + ") values ( ?" + String.Join(", ?", names.ToArray()) + ")";
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd2 = dbcon.CreateCommand())
{
cmd2.CommandText = sql;
cmd2.Parameters.Clear();
foreach (string name in FieldList)
{
if (m_FieldMap[name].GetValue(es) is bool)
{
if ((bool)m_FieldMap[name].GetValue(es))
cmd2.Parameters.AddWithValue("?" + name, "1");
else
cmd2.Parameters.AddWithValue("?" + name, "0");
}
else
{
cmd2.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd2.ExecuteNonQuery();
cmd2.CommandText = "select LAST_INSERT_ID() as id";
cmd2.Parameters.Clear();
using (IDataReader r = cmd2.ExecuteReader())
{
r.Read();
es.EstateID = Convert.ToUInt32(r["id"]);
}
es.Save();
}
}
}
public void StoreEstateSettings(EstateSettings es)
{
string sql = "replace into estate_settings (" + String.Join(",", FieldList) + ") values ( ?" + String.Join(", ?", FieldList) + ")";
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = sql;
foreach (string name in FieldList)
{
if (m_FieldMap[name].GetValue(es) is bool)
{
if ((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.AddWithValue("?" + name, "1");
else
cmd.Parameters.AddWithValue("?" + name, "0");
}
else
{
cmd.Parameters.AddWithValue("?" + name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd.ExecuteNonQuery();
}
}
SaveBanList(es);
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
}
private void LoadBanList(EstateSettings es)
{
es.ClearBans();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", es.EstateID);
using (IDataReader r = cmd.ExecuteReader())
{
while (r.Read())
{
EstateBan eb = new EstateBan();
UUID uuid = new UUID();
UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
eb.BannedUserID = uuid;
eb.BannedHostAddress = "0.0.0.0";
eb.BannedHostIPMask = "0.0.0.0";
es.AddBan(eb);
}
}
}
}
}
private void SaveBanList(EstateSettings es)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "delete from estateban where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( ?EstateID, ?bannedUUID, '', '', '' )";
foreach (EstateBan b in es.EstateBans)
{
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
cmd.Parameters.AddWithValue("?bannedUUID", b.BannedUserID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
}
}
void SaveUUIDList(uint EstateID, string table, UUID[] data)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "delete from " + table + " where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into " + table + " (EstateID, uuid) values ( ?EstateID, ?uuid )";
foreach (UUID uuid in data)
{
cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString());
cmd.Parameters.AddWithValue("?uuid", uuid.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
}
}
UUID[] LoadUUIDList(uint EstateID, string table)
{
List<UUID> uuids = new List<UUID>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select uuid from " + table + " where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", EstateID);
using (IDataReader r = cmd.ExecuteReader())
{
while (r.Read())
{
// EstateBan eb = new EstateBan();
uuids.Add(DBGuid.FromDB(r["uuid"]));
}
}
}
}
return uuids.ToArray();
}
public EstateSettings LoadEstateSettings(int estateID)
{
using (MySqlCommand cmd = new MySqlCommand())
{
string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) + " from estate_settings where EstateID = ?EstateID";
cmd.CommandText = sql;
cmd.Parameters.AddWithValue("?EstateID", estateID);
return DoLoad(cmd, UUID.Zero, false);
}
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<int> allEstateIds = GetEstatesAll();
foreach (int estateId in allEstateIds)
allEstateSettings.Add(LoadEstateSettings(estateId));
return allEstateSettings;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select estateID from estate_settings";
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
result.Add(Convert.ToInt32(reader["EstateID"]));
}
reader.Close();
}
}
dbcon.Close();
}
return result;
}
public List<int> GetEstates(string search)
{
List<int> result = new List<int>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select estateID from estate_settings where EstateName = ?EstateName";
cmd.Parameters.AddWithValue("?EstateName", search);
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
result.Add(Convert.ToInt32(reader["EstateID"]));
}
reader.Close();
}
}
dbcon.Close();
}
return result;
}
public List<int> GetEstatesByOwner(UUID ownerID)
{
List<int> result = new List<int>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select estateID from estate_settings where EstateOwner = ?EstateOwner";
cmd.Parameters.AddWithValue("?EstateOwner", ownerID);
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
result.Add(Convert.ToInt32(reader["EstateID"]));
}
reader.Close();
}
}
dbcon.Close();
}
return result;
}
public bool LinkRegion(UUID regionID, int estateID)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
MySqlTransaction transaction = dbcon.BeginTransaction();
try
{
// Delete any existing association of this region with an estate.
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.Transaction = transaction;
cmd.CommandText = "delete from estate_map where RegionID = ?RegionID";
cmd.Parameters.AddWithValue("?RegionID", regionID);
cmd.ExecuteNonQuery();
}
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.Transaction = transaction;
cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)";
cmd.Parameters.AddWithValue("?RegionID", regionID);
cmd.Parameters.AddWithValue("?EstateID", estateID);
int ret = cmd.ExecuteNonQuery();
if (ret != 0)
transaction.Commit();
else
transaction.Rollback();
dbcon.Close();
return (ret != 0);
}
}
catch (MySqlException ex)
{
m_log.Error("[REGION DB]: LinkRegion failed: " + ex.Message);
transaction.Rollback();
}
dbcon.Close();
}
return false;
}
public List<UUID> GetRegions(int estateID)
{
List<UUID> result = new List<UUID>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
try
{
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select RegionID from estate_map where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", estateID.ToString());
using (IDataReader reader = cmd.ExecuteReader())
{
while(reader.Read())
result.Add(DBGuid.FromDB(reader["RegionID"]));
reader.Close();
}
}
}
catch (Exception e)
{
m_log.Error("[REGION DB]: Error reading estate map. " + e.ToString());
return result;
}
dbcon.Close();
}
return result;
}
public bool DeleteEstate(int estateID)
{
return false;
}
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
/// <summary>
/// A database interface class to a user profile storage system
/// </summary>
public class MongoDBFramework
{
private static readonly log4net.ILog m_log =
log4net.LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected string m_connectionString;
protected object m_dbLock = new object();
protected MongoDBFramework(string connectionString)
{
m_connectionString = connectionString;
}
//////////////////////////////////////////////////////////////
//
// All non queries are funneled through one connection
// to increase performance a little
//
protected int ExecuteNonQuery(MySqlCommand cmd)
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
try
{
return cmd.ExecuteNonQuery();
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return 0;
}
}
}
}
}
}

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
public class MySqlFriendsData : MongoDBGenericTableHandler<FriendsData>, IFriendsData
{
public MySqlFriendsData(string connectionString, string realm)
: base(connectionString, realm, "FriendsStore")
{
}
public bool Delete(UUID principalID, string friend)
{
return Delete(principalID.ToString(), friend);
}
public bool Delete(string principalID, string friend)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where PrincipalID = ?PrincipalID and Friend = ?Friend", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?Friend", friend);
ExecuteNonQuery(cmd);
}
return true;
}
public FriendsData[] GetFriends(UUID principalID)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = ?PrincipalID", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
return DoQuery(cmd);
}
}
public FriendsData[] GetFriends(string principalID)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID LIKE ?PrincipalID", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString() + '%');
return DoQuery(cmd);
}
}
}
}

View File

@@ -0,0 +1,364 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Data.MongoDB
{
public class MongoDBGenericTableHandler<T> : MongoDBFramework where T: class, new()
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<string, FieldInfo> m_Fields =
new Dictionary<string, FieldInfo>();
protected List<string> m_ColumnNames = null;
protected string m_Realm;
protected FieldInfo m_DataField = null;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MongoDBGenericTableHandler(string connectionString,
string realm, string storeName) : base(connectionString)
{
m_Realm = realm;
m_connectionString = connectionString;
if (storeName != String.Empty)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, storeName);
m.Update();
}
}
Type t = typeof(T);
FieldInfo[] fields = t.GetFields(BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
if (fields.Length == 0)
return;
foreach (FieldInfo f in fields)
{
if (f.Name != "Data")
m_Fields[f.Name] = f;
else
m_DataField = f;
}
}
private void CheckColumnNames(IDataReader reader)
{
if (m_ColumnNames != null)
return;
List<string> columnNames = new List<string>();
DataTable schemaTable = reader.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
{
if (row["ColumnName"] != null &&
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
columnNames.Add(row["ColumnName"].ToString());
}
m_ColumnNames = columnNames;
}
public virtual T[] Get(string field, string key)
{
return Get(new string[] { field }, new string[] { key });
}
public virtual T[] Get(string[] fields, string[] keys)
{
if (fields.Length != keys.Length)
return new T[0];
List<string> terms = new List<string>();
using (MySqlCommand cmd = new MySqlCommand())
{
for (int i = 0 ; i < fields.Length ; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
}
string where = String.Join(" and ", terms.ToArray());
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
}
protected T[] DoQuery(MySqlCommand cmd)
{
List<T> result = new List<T>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
using (IDataReader reader = cmd.ExecuteReader())
{
if (reader == null)
return new T[0];
CheckColumnNames(reader);
while (reader.Read())
{
T row = new T();
foreach (string name in m_Fields.Keys)
{
if (reader[name] is DBNull)
{
continue;
}
if (m_Fields[name].FieldType == typeof(bool))
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v != 0 ? true : false);
}
else if (m_Fields[name].FieldType == typeof(UUID))
{
m_Fields[name].SetValue(row, DBGuid.FromDB(reader[name]));
}
else if (m_Fields[name].FieldType == typeof(int))
{
int v = Convert.ToInt32(reader[name]);
m_Fields[name].SetValue(row, v);
}
else
{
m_Fields[name].SetValue(row, reader[name]);
}
}
if (m_DataField != null)
{
Dictionary<string, string> data =
new Dictionary<string, string>();
foreach (string col in m_ColumnNames)
{
data[col] = reader[col].ToString();
if (data[col] == null)
data[col] = String.Empty;
}
m_DataField.SetValue(row, data);
}
result.Add(row);
}
}
}
return result.ToArray();
}
public virtual T[] Get(string where)
{
using (MySqlCommand cmd = new MySqlCommand())
{
string query = String.Format("select * from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
return DoQuery(cmd);
}
}
public virtual bool Store(T row)
{
// m_log.DebugFormat("[MYSQL GENERIC TABLE HANDLER]: Store(T row) invoked");
using (MySqlCommand cmd = new MySqlCommand())
{
string query = "";
List<String> names = new List<String>();
List<String> values = new List<String>();
foreach (FieldInfo fi in m_Fields.Values)
{
names.Add(fi.Name);
values.Add("?" + fi.Name);
// Temporarily return more information about what field is unexpectedly null for
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
// InventoryTransferModule or we may be required to substitute a DBNull here.
if (fi.GetValue(row) == null)
throw new NullReferenceException(
string.Format(
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
fi.Name, row));
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
}
if (m_DataField != null)
{
Dictionary<string, string> data =
(Dictionary<string, string>)m_DataField.GetValue(row);
foreach (KeyValuePair<string, string> kvp in data)
{
names.Add(kvp.Key);
values.Add("?" + kvp.Key);
cmd.Parameters.AddWithValue("?" + kvp.Key, kvp.Value);
}
}
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
cmd.CommandText = query;
if (ExecuteNonQuery(cmd) > 0)
return true;
return false;
}
}
public virtual bool Delete(string field, string key)
{
return Delete(new string[] { field }, new string[] { key });
}
public virtual bool Delete(string[] fields, string[] keys)
{
// m_log.DebugFormat(
// "[MYSQL GENERIC TABLE HANDLER]: Delete(string[] fields, string[] keys) invoked with {0}:{1}",
// string.Join(",", fields), string.Join(",", keys));
if (fields.Length != keys.Length)
return false;
List<string> terms = new List<string>();
using (MySqlCommand cmd = new MySqlCommand())
{
for (int i = 0 ; i < fields.Length ; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
}
string where = String.Join(" and ", terms.ToArray());
string query = String.Format("delete from {0} where {1}", m_Realm, where);
cmd.CommandText = query;
return ExecuteNonQuery(cmd) > 0;
}
}
public long GetCount(string field, string key)
{
return GetCount(new string[] { field }, new string[] { key });
}
public long GetCount(string[] fields, string[] keys)
{
if (fields.Length != keys.Length)
return 0;
List<string> terms = new List<string>();
using (MySqlCommand cmd = new MySqlCommand())
{
for (int i = 0; i < fields.Length; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
}
string where = String.Join(" and ", terms.ToArray());
string query = String.Format("select count(*) from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
Object result = DoQueryScalar(cmd);
return Convert.ToInt64(result);
}
}
public long GetCount(string where)
{
using (MySqlCommand cmd = new MySqlCommand())
{
string query = String.Format("select count(*) from {0} where {1}",
m_Realm, where);
cmd.CommandText = query;
object result = DoQueryScalar(cmd);
return Convert.ToInt64(result);
}
}
public object DoQueryScalar(MySqlCommand cmd)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
return cmd.ExecuteScalar();
}
}
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Threading;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
/// <summary>
/// A MongoDB Interface for user grid data
/// </summary>
public class MongoDBGridUserData : MongoDBGenericTableHandler<GridUserData>, IGridUserData
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public MongoDBGridUserData(string connectionString, string realm) : base(connectionString, realm, "GridUserStore") {}
public new GridUserData Get(string userID)
{
GridUserData[] ret = Get("UserID", userID);
if (ret.Length == 0)
return null;
return ret[0];
}
public GridUserData[] GetAll(string userID)
{
return base.Get(String.Format("UserID LIKE '{0}%'", userID));
}
}
}

View File

@@ -0,0 +1,482 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Data.MongoDB
{
public class MongoDBGroupsData : IGroupsData
{
private MySqlGroupsGroupsHandler m_Groups;
private MySqlGroupsMembershipHandler m_Membership;
private MySqlGroupsRolesHandler m_Roles;
private MySqlGroupsRoleMembershipHandler m_RoleMembership;
private MySqlGroupsInvitesHandler m_Invites;
private MySqlGroupsNoticesHandler m_Notices;
private MySqlGroupsPrincipalsHandler m_Principals;
public MongoDBGroupsData(string connectionString, string realm)
{
m_Groups = new MySqlGroupsGroupsHandler(connectionString, realm + "_groups", realm + "_Store");
m_Membership = new MySqlGroupsMembershipHandler(connectionString, realm + "_membership");
m_Roles = new MySqlGroupsRolesHandler(connectionString, realm + "_roles");
m_RoleMembership = new MySqlGroupsRoleMembershipHandler(connectionString, realm + "_rolemembership");
m_Invites = new MySqlGroupsInvitesHandler(connectionString, realm + "_invites");
m_Notices = new MySqlGroupsNoticesHandler(connectionString, realm + "_notices");
m_Principals = new MySqlGroupsPrincipalsHandler(connectionString, realm + "_principals");
}
#region groups table
public bool StoreGroup(GroupData data)
{
return m_Groups.Store(data);
}
public GroupData RetrieveGroup(UUID groupID)
{
GroupData[] groups = m_Groups.Get("GroupID", groupID.ToString());
if (groups.Length > 0)
return groups[0];
return null;
}
public GroupData RetrieveGroup(string name)
{
GroupData[] groups = m_Groups.Get("Name", name);
if (groups.Length > 0)
return groups[0];
return null;
}
public GroupData[] RetrieveGroups(string pattern)
{
if (string.IsNullOrEmpty(pattern))
pattern = "1 ORDER BY Name LIMIT 100";
else
pattern = string.Format("Name LIKE %{0}% ORDER BY Name LIMIT 100", pattern);
return m_Groups.Get(pattern);
}
public bool DeleteGroup(UUID groupID)
{
return m_Groups.Delete("GroupID", groupID.ToString());
}
public int GroupsCount()
{
return (int)m_Groups.GetCount("Location=\"\"");
}
#endregion
#region membership table
public MembershipData[] RetrieveMembers(UUID groupID)
{
return m_Membership.Get("GroupID", groupID.ToString());
}
public MembershipData RetrieveMember(UUID groupID, string pricipalID)
{
MembershipData[] m = m_Membership.Get(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), pricipalID });
if (m != null && m.Length > 0)
return m[0];
return null;
}
public MembershipData[] RetrieveMemberships(string pricipalID)
{
return m_Membership.Get("PrincipalID", pricipalID.ToString());
}
public bool StoreMember(MembershipData data)
{
return m_Membership.Store(data);
}
public bool DeleteMember(UUID groupID, string pricipalID)
{
return m_Membership.Delete(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), pricipalID });
}
public int MemberCount(UUID groupID)
{
return (int)m_Membership.GetCount("GroupID", groupID.ToString());
}
#endregion
#region roles table
public bool StoreRole(RoleData data)
{
return m_Roles.Store(data);
}
public RoleData RetrieveRole(UUID groupID, UUID roleID)
{
RoleData[] data = m_Roles.Get(new string[] { "GroupID", "RoleID" },
new string[] { groupID.ToString(), roleID.ToString() });
if (data != null && data.Length > 0)
return data[0];
return null;
}
public RoleData[] RetrieveRoles(UUID groupID)
{
//return m_Roles.RetrieveRoles(groupID);
return m_Roles.Get("GroupID", groupID.ToString());
}
public bool DeleteRole(UUID groupID, UUID roleID)
{
return m_Roles.Delete(new string[] { "GroupID", "RoleID" },
new string[] { groupID.ToString(), roleID.ToString() });
}
public int RoleCount(UUID groupID)
{
return (int)m_Roles.GetCount("GroupID", groupID.ToString());
}
#endregion
#region rolememberhip table
public RoleMembershipData[] RetrieveRolesMembers(UUID groupID)
{
RoleMembershipData[] data = m_RoleMembership.Get("GroupID", groupID.ToString());
return data;
}
public RoleMembershipData[] RetrieveRoleMembers(UUID groupID, UUID roleID)
{
RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "RoleID" },
new string[] { groupID.ToString(), roleID.ToString() });
return data;
}
public RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID)
{
RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), principalID.ToString() });
return data;
}
public RoleMembershipData RetrieveRoleMember(UUID groupID, UUID roleID, string principalID)
{
RoleMembershipData[] data = m_RoleMembership.Get(new string[] { "GroupID", "RoleID", "PrincipalID" },
new string[] { groupID.ToString(), roleID.ToString(), principalID.ToString() });
if (data != null && data.Length > 0)
return data[0];
return null;
}
public int RoleMemberCount(UUID groupID, UUID roleID)
{
return (int)m_RoleMembership.GetCount(new string[] { "GroupID", "RoleID" },
new string[] { groupID.ToString(), roleID.ToString() });
}
public bool StoreRoleMember(RoleMembershipData data)
{
return m_RoleMembership.Store(data);
}
public bool DeleteRoleMember(RoleMembershipData data)
{
return m_RoleMembership.Delete(new string[] { "GroupID", "RoleID", "PrincipalID"},
new string[] { data.GroupID.ToString(), data.RoleID.ToString(), data.PrincipalID });
}
public bool DeleteMemberAllRoles(UUID groupID, string principalID)
{
return m_RoleMembership.Delete(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), principalID });
}
#endregion
#region principals table
public bool StorePrincipal(PrincipalData data)
{
return m_Principals.Store(data);
}
public PrincipalData RetrievePrincipal(string principalID)
{
PrincipalData[] p = m_Principals.Get("PrincipalID", principalID);
if (p != null && p.Length > 0)
return p[0];
return null;
}
public bool DeletePrincipal(string principalID)
{
return m_Principals.Delete("PrincipalID", principalID);
}
#endregion
#region invites table
public bool StoreInvitation(InvitationData data)
{
return m_Invites.Store(data);
}
public InvitationData RetrieveInvitation(UUID inviteID)
{
InvitationData[] invites = m_Invites.Get("InviteID", inviteID.ToString());
if (invites != null && invites.Length > 0)
return invites[0];
return null;
}
public InvitationData RetrieveInvitation(UUID groupID, string principalID)
{
InvitationData[] invites = m_Invites.Get(new string[] { "GroupID", "PrincipalID" },
new string[] { groupID.ToString(), principalID });
if (invites != null && invites.Length > 0)
return invites[0];
return null;
}
public bool DeleteInvite(UUID inviteID)
{
return m_Invites.Delete("InviteID", inviteID.ToString());
}
public void DeleteOldInvites()
{
m_Invites.DeleteOld();
}
#endregion
#region notices table
public bool StoreNotice(NoticeData data)
{
return m_Notices.Store(data);
}
public NoticeData RetrieveNotice(UUID noticeID)
{
NoticeData[] notices = m_Notices.Get("NoticeID", noticeID.ToString());
if (notices != null && notices.Length > 0)
return notices[0];
return null;
}
public NoticeData[] RetrieveNotices(UUID groupID)
{
NoticeData[] notices = m_Notices.Get("GroupID", groupID.ToString());
return notices;
}
public bool DeleteNotice(UUID noticeID)
{
return m_Notices.Delete("NoticeID", noticeID.ToString());
}
public void DeleteOldNotices()
{
m_Notices.DeleteOld();
}
#endregion
#region combinations
public MembershipData RetrievePrincipalGroupMembership(string principalID, UUID groupID)
{
// TODO
return null;
}
public MembershipData[] RetrievePrincipalGroupMemberships(string principalID)
{
// TODO
return null;
}
#endregion
}
public class MySqlGroupsGroupsHandler : MongoDBGenericTableHandler<GroupData>
{
protected override Assembly Assembly
{
// WARNING! Moving migrations to this assembly!!!
get { return GetType().Assembly; }
}
public MySqlGroupsGroupsHandler(string connectionString, string realm, string store)
: base(connectionString, realm, store)
{
}
}
public class MySqlGroupsMembershipHandler : MongoDBGenericTableHandler<MembershipData>
{
protected override Assembly Assembly
{
// WARNING! Moving migrations to this assembly!!!
get { return GetType().Assembly; }
}
public MySqlGroupsMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
}
public class MySqlGroupsRolesHandler : MongoDBGenericTableHandler<RoleData>
{
protected override Assembly Assembly
{
// WARNING! Moving migrations to this assembly!!!
get { return GetType().Assembly; }
}
public MySqlGroupsRolesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
}
public class MySqlGroupsRoleMembershipHandler : MongoDBGenericTableHandler<RoleMembershipData>
{
protected override Assembly Assembly
{
// WARNING! Moving migrations to this assembly!!!
get { return GetType().Assembly; }
}
public MySqlGroupsRoleMembershipHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
}
public class MySqlGroupsInvitesHandler : MongoDBGenericTableHandler<InvitationData>
{
protected override Assembly Assembly
{
// WARNING! Moving migrations to this assembly!!!
get { return GetType().Assembly; }
}
public MySqlGroupsInvitesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
public void DeleteOld()
{
uint now = (uint)Util.UnixTimeSinceEpoch();
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm);
cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old
ExecuteNonQuery(cmd);
}
}
}
public class MySqlGroupsNoticesHandler : MongoDBGenericTableHandler<NoticeData>
{
protected override Assembly Assembly
{
// WARNING! Moving migrations to this assembly!!!
get { return GetType().Assembly; }
}
public MySqlGroupsNoticesHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
public void DeleteOld()
{
uint now = (uint)Util.UnixTimeSinceEpoch();
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where TMStamp < ?tstamp", m_Realm);
cmd.Parameters.AddWithValue("?tstamp", now - 14 * 24 * 60 * 60); // > 2 weeks old
ExecuteNonQuery(cmd);
}
}
}
public class MySqlGroupsPrincipalsHandler : MongoDBGenericTableHandler<PrincipalData>
{
protected override Assembly Assembly
{
// WARNING! Moving migrations to this assembly!!!
get { return GetType().Assembly; }
}
public MySqlGroupsPrincipalsHandler(string connectionString, string realm)
: base(connectionString, realm, string.Empty)
{
}
}
}

View File

@@ -0,0 +1,901 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
namespace OpenSim.Data.MongoDB
{
/// <summary>
/// A MongoDB interface for the inventory server
/// </summary>
public class MongoDBInventoryData : IInventoryDataPlugin
{
private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_connectionString;
private object m_dbLock = new object();
public string Version { get { return "1.0.0.0"; } }
public void Initialise()
{
m_log.Info("[MongoDBInventoryData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name);
}
/// <summary>
/// <para>Initialises Inventory interface</para>
/// <para>
/// <list type="bullet">
/// <item>Loads and initialises the MongoDB storage plugin</item>
/// <item>warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
/// <item>Check for migration</item>
/// </list>
/// </para>
/// </summary>
/// <param name="connect">connect string</param>
public void Initialise(string connect)
{
m_connectionString = connect;
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, assem, "InventoryStore");
m.Update();
}
}
/// <summary>
/// The name of this DB provider
/// </summary>
/// <returns>Name of DB provider</returns>
public string Name
{
get { return "MongoDB Inventory Data Interface"; }
}
/// <summary>
/// Closes this DB provider
/// </summary>
/// <remarks>do nothing</remarks>
public void Dispose()
{
// Do nothing.
}
/// <summary>
/// Returns a list of items in a specified folder
/// </summary>
/// <param name="folderID">The folder to search</param>
/// <returns>A list containing inventory items</returns>
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
{
try
{
lock (m_dbLock)
{
List<InventoryItemBase> items = new List<InventoryItemBase>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", folderID.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
while (reader.Read())
{
// A null item (because something went wrong) breaks everything in the folder
InventoryItemBase item = readInventoryItem(reader);
if (item != null)
items.Add(item);
}
return items;
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Returns a list of the root folders within a users inventory
/// </summary>
/// <param name="user">The user whose inventory is to be searched</param>
/// <returns>A list of folder objects</returns>
public List<InventoryFolderBase> getUserRootFolders(UUID user)
{
try
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand result = new MySqlCommand(
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", user.ToString());
result.Parameters.AddWithValue("?zero", UUID.Zero.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
while (reader.Read())
items.Add(readInventoryFolder(reader));
return items;
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// see <see cref="InventoryItemBase.getUserRootFolder"/>
/// </summary>
/// <param name="user">The user UUID</param>
/// <returns></returns>
public InventoryFolderBase getUserRootFolder(UUID user)
{
try
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand result = new MySqlCommand(
"SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", user.ToString());
result.Parameters.AddWithValue("?zero", UUID.Zero.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
while (reader.Read())
items.Add(readInventoryFolder(reader));
InventoryFolderBase rootFolder = null;
// There should only ever be one root folder for a user. However, if there's more
// than one we'll simply use the first one rather than failing. It would be even
// nicer to print some message to this effect, but this feels like it's too low a
// to put such a message out, and it's too minor right now to spare the time to
// suitably refactor.
if (items.Count > 0)
rootFolder = items[0];
return rootFolder;
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Return a list of folders in a users inventory contained within the specified folder.
/// This method is only used in tests - in normal operation the user always have one,
/// and only one, root folder.
/// </summary>
/// <param name="parentID">The folder to search</param>
/// <returns>A list of inventory folders</returns>
public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
{
try
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", parentID.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
List<InventoryFolderBase> items = new List<InventoryFolderBase>();
while (reader.Read())
items.Add(readInventoryFolder(reader));
return items;
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Reads a one item from an SQL result
/// </summary>
/// <param name="reader">The SQL Result</param>
/// <returns>the item read</returns>
private static InventoryItemBase readInventoryItem(MySqlDataReader reader)
{
try
{
InventoryItemBase item = new InventoryItemBase();
// TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
// (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
item.CreatorId = reader["creatorID"].ToString();
// Be a bit safer in parsing these because the
// database doesn't enforce them to be not null, and
// the inventory still works if these are weird in the
// db
// (Empty is Ok, but "weird" will throw!)
item.Owner = DBGuid.FromDB(reader["avatarID"]);
item.GroupID = DBGuid.FromDB(reader["groupID"]);
// Rest of the parsing. If these UUID's fail, we're dead anyway
item.ID = DBGuid.FromDB(reader["inventoryID"]);
item.AssetID = DBGuid.FromDB(reader["assetID"]);
item.AssetType = (int) reader["assetType"];
item.Folder = DBGuid.FromDB(reader["parentFolderID"]);
item.Name = (string)(reader["inventoryName"] ?? String.Empty);
item.Description = (string)(reader["inventoryDescription"] ?? String.Empty);
item.NextPermissions = (uint) reader["inventoryNextPermissions"];
item.CurrentPermissions = (uint) reader["inventoryCurrentPermissions"];
item.InvType = (int) reader["invType"];
item.BasePermissions = (uint) reader["inventoryBasePermissions"];
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
item.GroupPermissions = (uint) reader["inventoryGroupPermissions"];
item.SalePrice = (int) reader["salePrice"];
item.SaleType = unchecked((byte)(Convert.ToSByte(reader["saleType"])));
item.CreationDate = (int) reader["creationDate"];
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
item.Flags = (uint) reader["flags"];
return item;
}
catch (MySqlException e)
{
m_log.Error(e.ToString());
}
return null;
}
/// <summary>
/// Returns a specified inventory item
/// </summary>
/// <param name="item">The item to return</param>
/// <returns>An inventory item</returns>
public InventoryItemBase getInventoryItem(UUID itemID)
{
try
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", itemID.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
InventoryItemBase item = null;
if (reader.Read())
item = readInventoryItem(reader);
return item;
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
}
return null;
}
/// <summary>
/// Reads a list of inventory folders returned by a query.
/// </summary>
/// <param name="reader">A MongoDB Data Reader</param>
/// <returns>A List containing inventory folders</returns>
protected static InventoryFolderBase readInventoryFolder(MySqlDataReader reader)
{
try
{
InventoryFolderBase folder = new InventoryFolderBase();
folder.Owner = DBGuid.FromDB(reader["agentID"]);
folder.ParentID = DBGuid.FromDB(reader["parentFolderID"]);
folder.ID = DBGuid.FromDB(reader["folderID"]);
folder.Name = (string) reader["folderName"];
folder.Type = (short) reader["type"];
folder.Version = (ushort) ((int) reader["version"]);
return folder;
}
catch (Exception e)
{
m_log.Error(e.Message, e);
}
return null;
}
/// <summary>
/// Returns a specified inventory folder
/// </summary>
/// <param name="folderID">The folder to return</param>
/// <returns>A folder class</returns>
public InventoryFolderBase getInventoryFolder(UUID folderID)
{
try
{
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", folderID.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
InventoryFolderBase folder = null;
if (reader.Read())
folder = readInventoryFolder(reader);
return folder;
}
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Adds a specified item to the database
/// </summary>
/// <param name="item">The inventory item</param>
public void addInventoryItem(InventoryItemBase item)
{
string sql =
"REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName"
+ ", inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType"
+ ", creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, inventoryGroupPermissions, salePrice, saleType"
+ ", creationDate, groupID, groupOwned, flags) VALUES ";
sql +=
"(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription"
+ ", ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID"
+ ", ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?inventoryGroupPermissions, ?salePrice, ?saleType, ?creationDate"
+ ", ?groupID, ?groupOwned, ?flags)";
string itemName = item.Name;
if (item.Name.Length > 64)
{
itemName = item.Name.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length + " to " + itemName.Length + " characters on add item");
}
string itemDesc = item.Description;
if (item.Description.Length > 128)
{
itemDesc = item.Description.Substring(0, 128);
m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length + " to " + itemDesc.Length + " characters on add item");
}
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand result = new MySqlCommand(sql, dbcon))
{
result.Parameters.AddWithValue("?inventoryID", item.ID.ToString());
result.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
result.Parameters.AddWithValue("?assetType", item.AssetType.ToString());
result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString());
result.Parameters.AddWithValue("?avatarID", item.Owner.ToString());
result.Parameters.AddWithValue("?inventoryName", itemName);
result.Parameters.AddWithValue("?inventoryDescription", itemDesc);
result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString());
result.Parameters.AddWithValue("?inventoryCurrentPermissions",
item.CurrentPermissions.ToString());
result.Parameters.AddWithValue("?invType", item.InvType);
result.Parameters.AddWithValue("?creatorID", item.CreatorId);
result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
result.Parameters.AddWithValue("?groupID", item.GroupID);
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
result.Parameters.AddWithValue("?flags", item.Flags);
lock (m_dbLock)
result.ExecuteNonQuery();
result.Dispose();
}
using (MySqlCommand result = new MySqlCommand("update inventoryfolders set version=version+1 where folderID = ?folderID", dbcon))
{
result.Parameters.AddWithValue("?folderID", item.Folder.ToString());
lock (m_dbLock)
result.ExecuteNonQuery();
}
}
}
catch (MySqlException e)
{
m_log.Error(e.ToString());
}
}
/// <summary>
/// Updates the specified inventory item
/// </summary>
/// <param name="item">Inventory item to update</param>
public void updateInventoryItem(InventoryItemBase item)
{
addInventoryItem(item);
}
/// <summary>
/// Detele the specified inventory item
/// </summary>
/// <param name="item">The inventory item UUID to delete</param>
public void deleteInventoryItem(UUID itemID)
{
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", dbcon))
{
cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
}
}
catch (MySqlException e)
{
m_log.Error(e.Message, e);
}
}
public InventoryItemBase queryInventoryItem(UUID itemID)
{
return getInventoryItem(itemID);
}
public InventoryFolderBase queryInventoryFolder(UUID folderID)
{
return getInventoryFolder(folderID);
}
/// <summary>
/// Creates a new inventory folder
/// </summary>
/// <param name="folder">Folder to create</param>
public void addInventoryFolder(InventoryFolderBase folder)
{
string sql =
"REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES ";
sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)";
string folderName = folder.Name;
if (folderName.Length > 64)
{
folderName = folderName.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length + " to " + folderName.Length + " characters on add folder");
}
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
{
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
cmd.Parameters.AddWithValue("?agentID", folder.Owner.ToString());
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
cmd.Parameters.AddWithValue("?folderName", folderName);
cmd.Parameters.AddWithValue("?type", folder.Type);
cmd.Parameters.AddWithValue("?version", folder.Version);
try
{
lock (m_dbLock)
{
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.Error(e.ToString());
}
}
}
}
/// <summary>
/// Updates an inventory folder
/// </summary>
/// <param name="folder">Folder to update</param>
public void updateInventoryFolder(InventoryFolderBase folder)
{
addInventoryFolder(folder);
}
/// <summary>
/// Move an inventory folder
/// </summary>
/// <param name="folder">Folder to move</param>
/// <remarks>UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID</remarks>
public void moveInventoryFolder(InventoryFolderBase folder)
{
string sql =
"UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID";
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(sql, dbcon))
{
cmd.Parameters.AddWithValue("?folderID", folder.ID.ToString());
cmd.Parameters.AddWithValue("?parentFolderID", folder.ParentID.ToString());
try
{
lock (m_dbLock)
{
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.Error(e.ToString());
}
}
}
}
/// <summary>
/// Append a list of all the child folders of a parent folder
/// </summary>
/// <param name="folders">list where folders will be appended</param>
/// <param name="parentID">ID of parent</param>
protected void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
{
List<InventoryFolderBase> subfolderList = getInventoryFolders(parentID);
foreach (InventoryFolderBase f in subfolderList)
folders.Add(f);
}
/// <summary>
/// See IInventoryDataPlugin
/// </summary>
/// <param name="parentID"></param>
/// <returns></returns>
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
{
/* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one
* - We will only need to hit the database twice instead of n times.
* - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned
* by the same person, each user only has 1 inventory heirarchy
* - The returned list is not ordered, instead of breadth-first ordered
There are basically 2 usage cases for getFolderHeirarchy:
1) Getting the user's entire inventory heirarchy when they log in
2) Finding a subfolder heirarchy to delete when emptying the trash.
This implementation will pull all inventory folders from the database, and then prune away any folder that
is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the
database than to make n requests. This pays off only if requested heirarchy is large.
By making this choice, we are making the worst case better at the cost of making the best case worse.
This way is generally better because we don't have to rebuild the connection/sql query per subfolder,
even if we end up getting more data from the SQL server than we need.
- Francis
*/
try
{
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
Dictionary<UUID, List<InventoryFolderBase>> hashtable = new Dictionary<UUID, List<InventoryFolderBase>>(); ;
List<InventoryFolderBase> parentFolder = new List<InventoryFolderBase>();
bool buildResultsFromHashTable = false;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
/* Fetch the parent folder from the database to determine the agent ID, and if
* we're querying the root of the inventory folder tree */
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", parentID.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
// Should be at most 1 result
while (reader.Read())
parentFolder.Add(readInventoryFolder(reader));
}
}
if (parentFolder.Count >= 1) // No result means parent folder does not exist
{
if (parentFolder[0].ParentID == UUID.Zero) // We are querying the root folder
{
/* Get all of the agent's folders from the database, put them in a list and return it */
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE agentID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", parentFolder[0].Owner.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
while (reader.Read())
{
InventoryFolderBase curFolder = readInventoryFolder(reader);
if (curFolder.ID != parentID) // Do not need to add the root node of the tree to the list
folders.Add(curFolder);
}
}
}
} // if we are querying the root folder
else // else we are querying a subtree of the inventory folder tree
{
/* Get all of the agent's folders from the database, put them all in a hash table
* indexed by their parent ID */
using (MySqlCommand result = new MySqlCommand("SELECT * FROM inventoryfolders WHERE agentID = ?uuid", dbcon))
{
result.Parameters.AddWithValue("?uuid", parentFolder[0].Owner.ToString());
using (MySqlDataReader reader = result.ExecuteReader())
{
while (reader.Read())
{
InventoryFolderBase curFolder = readInventoryFolder(reader);
if (hashtable.ContainsKey(curFolder.ParentID)) // Current folder already has a sibling
hashtable[curFolder.ParentID].Add(curFolder); // append to sibling list
else // else current folder has no known (yet) siblings
{
List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>();
siblingList.Add(curFolder);
// Current folder has no known (yet) siblings
hashtable.Add(curFolder.ParentID, siblingList);
}
} // while more items to read from the database
}
}
// Set flag so we know we need to build the results from the hash table after
// we unlock the database
buildResultsFromHashTable = true;
} // else we are querying a subtree of the inventory folder tree
} // if folder parentID exists
if (buildResultsFromHashTable)
{
/* We have all of the user's folders stored in a hash table indexed by their parent ID
* and we need to return the requested subtree. We will build the requested subtree
* by performing a breadth-first-search on the hash table */
if (hashtable.ContainsKey(parentID))
folders.AddRange(hashtable[parentID]);
for (int i = 0; i < folders.Count; i++) // **Note: folders.Count is *not* static
if (hashtable.ContainsKey(folders[i].ID))
folders.AddRange(hashtable[folders[i].ID]);
}
}
} // lock (database)
return folders;
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
/// <summary>
/// Delete a folder from database
/// </summary>
/// <param name="folderID">the folder UUID</param>
protected void deleteOneFolder(UUID folderID)
{
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
// System folders can never be deleted. Period.
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid and type=-1", dbcon))
{
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
}
}
catch (MySqlException e)
{
m_log.Error(e.Message, e);
}
}
/// <summary>
/// Delete all item in a folder
/// </summary>
/// <param name="folderID">the folder UUID</param>
protected void deleteItemsInFolder(UUID folderID)
{
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", dbcon))
{
cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
}
}
catch (MySqlException e)
{
m_log.Error(e.ToString());
}
}
/// <summary>
/// Deletes an inventory folder
/// </summary>
/// <param name="folderId">Id of folder to delete</param>
public void deleteInventoryFolder(UUID folderID)
{
List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
//Delete all sub-folders
foreach (InventoryFolderBase f in subFolders)
{
deleteOneFolder(f.ID);
deleteItemsInFolder(f.ID);
}
//Delete the actual row
deleteOneFolder(folderID);
deleteItemsInFolder(folderID);
}
public List<InventoryItemBase> fetchActiveGestures(UUID avatarID)
{
lock (m_dbLock)
{
try
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand sqlCmd = new MySqlCommand(
"SELECT * FROM inventoryitems WHERE avatarId = ?uuid AND assetType = ?type and flags & 1", dbcon))
{
sqlCmd.Parameters.AddWithValue("?uuid", avatarID.ToString());
sqlCmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
using (MySqlDataReader result = sqlCmd.ExecuteReader())
{
List<InventoryItemBase> list = new List<InventoryItemBase>();
while (result.Read())
{
InventoryItemBase item = readInventoryItem(result);
if (item != null)
list.Add(item);
}
return list;
}
}
}
}
catch (Exception e)
{
m_log.Error(e.Message, e);
return null;
}
}
}
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using log4net;
namespace OpenSim.Data.MongoDB
{
/// <summary>This is a MongoDB-customized migration processor. The only difference is in how
/// it executes SQL scripts (using MySqlScript instead of MyCommand)
///
/// </summary>
public class MySqlMigration : Migration
{
public MySqlMigration()
: base()
{
}
public MySqlMigration(DbConnection conn, Assembly assem, string subtype, string type) :
base(conn, assem, subtype, type)
{
}
public MySqlMigration(DbConnection conn, Assembly assem, string type) :
base(conn, assem, type)
{
}
protected override void ExecuteScript(DbConnection conn, string[] script)
{
if (!(conn is MySqlConnection))
{
base.ExecuteScript(conn, script);
return;
}
MySqlScript scr = new MySqlScript((MySqlConnection)conn);
{
foreach (string sql in script)
{
scr.Query = sql;
scr.Error += delegate(object sender, MySqlScriptErrorEventArgs args)
{
throw new Exception(sql);
};
scr.Execute();
}
}
}
}
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Data.MongoDB;
using OpenMetaverse;
namespace OpenSim.Data.MongoDB
{
public class MongoDBOfflineIMData : MongoDBGenericTableHandler<OfflineIMData>, IOfflineIMData
{
public MongoDBOfflineIMData(string connectionString, string realm)
: base(connectionString, realm, "IM_Store")
{
}
public void DeleteOld()
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where TMStamp < NOW() - INTERVAL 2 WEEK", m_Realm);
ExecuteNonQuery(cmd);
}
}
}
}

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Threading;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
/// <summary>
/// A MongoDB Interface for the Grid Server
/// </summary>
public class MongoDBPresenceData : MongoDBGenericTableHandler<PresenceData>,
IPresenceData
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public MongoDBPresenceData(string connectionString, string realm) :
base(connectionString, realm, "Presence")
{
}
public PresenceData Get(UUID sessionID)
{
PresenceData[] ret = Get("SessionID",
sessionID.ToString());
if (ret.Length == 0)
return null;
return ret[0];
}
public void LogoutRegionAgents(UUID regionID)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("delete from {0} where `RegionID`=?RegionID", m_Realm);
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
ExecuteNonQuery(cmd);
}
}
public bool ReportAgent(UUID sessionID, UUID regionID)
{
PresenceData[] pd = Get("SessionID", sessionID.ToString());
if (pd.Length == 0)
return false;
if (regionID == UUID.Zero)
return false;
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("update {0} set RegionID=?RegionID, LastSeen=NOW() where `SessionID`=?SessionID", m_Realm);
cmd.Parameters.AddWithValue("?SessionID", sessionID.ToString());
cmd.Parameters.AddWithValue("?RegionID", regionID.ToString());
if (ExecuteNonQuery(cmd) == 0)
return false;
}
return true;
}
public bool VerifyAgent(UUID agentId, UUID secureSessionID)
{
PresenceData[] ret = Get("SecureSessionID",
secureSessionID.ToString());
if (ret.Length == 0)
return false;
if(ret[0].UserID != agentId.ToString())
return false;
return true;
}
}
}

View File

@@ -0,0 +1,339 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
using RegionFlags = OpenSim.Framework.RegionFlags;
namespace OpenSim.Data.MongoDB
{
public class MySqlRegionData : MongoDBFramework, IRegionData
{
private string m_Realm;
private List<string> m_ColumnNames;
//private string m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySqlRegionData(string connectionString, string realm)
: base(connectionString)
{
m_Realm = realm;
m_connectionString = connectionString;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "GridStore");
m.Update();
}
}
public List<RegionData> Get(string regionName, UUID scopeID)
{
string command = "select * from `"+m_Realm+"` where regionName like ?regionName";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
command += " order by regionName";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?regionName", regionName);
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd);
}
}
public RegionData Get(int posX, int posY, UUID scopeID)
{
string command = "select * from `"+m_Realm+"` where locX = ?posX and locY = ?posY";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?posX", posX.ToString());
cmd.Parameters.AddWithValue("?posY", posY.ToString());
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
List<RegionData> ret = RunCommand(cmd);
if (ret.Count == 0)
return null;
return ret[0];
}
}
public RegionData Get(UUID regionID, UUID scopeID)
{
string command = "select * from `"+m_Realm+"` where uuid = ?regionID";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
List<RegionData> ret = RunCommand(cmd);
if (ret.Count == 0)
return null;
return ret[0];
}
}
public List<RegionData> Get(int startX, int startY, int endX, int endY, UUID scopeID)
{
string command = "select * from `"+m_Realm+"` where locX between ?startX and ?endX and locY between ?startY and ?endY";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?startX", startX.ToString());
cmd.Parameters.AddWithValue("?startY", startY.ToString());
cmd.Parameters.AddWithValue("?endX", endX.ToString());
cmd.Parameters.AddWithValue("?endY", endY.ToString());
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd);
}
}
public List<RegionData> RunCommand(MySqlCommand cmd)
{
List<RegionData> retList = new List<RegionData>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
using (IDataReader result = cmd.ExecuteReader())
{
while (result.Read())
{
RegionData ret = new RegionData();
ret.Data = new Dictionary<string, object>();
ret.RegionID = DBGuid.FromDB(result["uuid"]);
ret.ScopeID = DBGuid.FromDB(result["ScopeID"]);
ret.RegionName = result["regionName"].ToString();
ret.posX = Convert.ToInt32(result["locX"]);
ret.posY = Convert.ToInt32(result["locY"]);
ret.sizeX = Convert.ToInt32(result["sizeX"]);
ret.sizeY = Convert.ToInt32(result["sizeY"]);
CheckColumnNames(result);
foreach (string s in m_ColumnNames)
{
if (s == "uuid")
continue;
if (s == "ScopeID")
continue;
if (s == "regionName")
continue;
if (s == "locX")
continue;
if (s == "locY")
continue;
object value = result[s];
if (value is DBNull)
ret.Data[s] = null;
else
ret.Data[s] = result[s].ToString();
}
retList.Add(ret);
}
}
}
return retList;
}
private void CheckColumnNames(IDataReader result)
{
if (m_ColumnNames != null)
return;
List<string> columnNames = new List<string>();
DataTable schemaTable = result.GetSchemaTable();
foreach (DataRow row in schemaTable.Rows)
{
if (row["ColumnName"] != null)
columnNames.Add(row["ColumnName"].ToString());
}
m_ColumnNames = columnNames;
}
public bool Store(RegionData data)
{
if (data.Data.ContainsKey("uuid"))
data.Data.Remove("uuid");
if (data.Data.ContainsKey("ScopeID"))
data.Data.Remove("ScopeID");
if (data.Data.ContainsKey("regionName"))
data.Data.Remove("regionName");
if (data.Data.ContainsKey("posX"))
data.Data.Remove("posX");
if (data.Data.ContainsKey("posY"))
data.Data.Remove("posY");
if (data.Data.ContainsKey("sizeX"))
data.Data.Remove("sizeX");
if (data.Data.ContainsKey("sizeY"))
data.Data.Remove("sizeY");
if (data.Data.ContainsKey("locX"))
data.Data.Remove("locX");
if (data.Data.ContainsKey("locY"))
data.Data.Remove("locY");
if (data.RegionName.Length > 128)
data.RegionName = data.RegionName.Substring(0, 128);
string[] fields = new List<string>(data.Data.Keys).ToArray();
using (MySqlCommand cmd = new MySqlCommand())
{
string update = "update `" + m_Realm + "` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY";
foreach (string field in fields)
{
update += ", ";
update += "`" + field + "` = ?" + field;
cmd.Parameters.AddWithValue("?" + field, data.Data[field]);
}
update += " where uuid = ?regionID";
if (data.ScopeID != UUID.Zero)
update += " and ScopeID = ?scopeID";
cmd.CommandText = update;
cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString());
cmd.Parameters.AddWithValue("?regionName", data.RegionName);
cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString());
cmd.Parameters.AddWithValue("?posX", data.posX.ToString());
cmd.Parameters.AddWithValue("?posY", data.posY.ToString());
cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString());
cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString());
if (ExecuteNonQuery(cmd) < 1)
{
string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `regionName`, `" +
String.Join("`, `", fields) +
"`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?regionName, ?" + String.Join(", ?", fields) + ")";
cmd.CommandText = insert;
if (ExecuteNonQuery(cmd) < 1)
{
return false;
}
}
}
return true;
}
public bool SetDataItem(UUID regionID, string item, string value)
{
using (MySqlCommand cmd = new MySqlCommand("update `" + m_Realm + "` set `" + item + "` = ?" + item + " where uuid = ?UUID"))
{
cmd.Parameters.AddWithValue("?" + item, value);
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}
return false;
}
public bool Delete(UUID regionID)
{
using (MySqlCommand cmd = new MySqlCommand("delete from `" + m_Realm + "` where uuid = ?UUID"))
{
cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
if (ExecuteNonQuery(cmd) > 0)
return true;
}
return false;
}
public List<RegionData> GetDefaultRegions(UUID scopeID)
{
return Get((int)RegionFlags.DefaultRegion, scopeID);
}
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
{
List<RegionData> regions = Get((int)RegionFlags.FallbackRegion, scopeID);
RegionDataDistanceCompare distanceComparer = new RegionDataDistanceCompare(x, y);
regions.Sort(distanceComparer);
return regions;
}
public List<RegionData> GetHyperlinks(UUID scopeID)
{
return Get((int)RegionFlags.Hyperlink, scopeID);
}
private List<RegionData> Get(int regionFlags, UUID scopeID)
{
string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
public class MySqlUserAccountData : MongoDBGenericTableHandler<UserAccountData>, IUserAccountData
{
public MySqlUserAccountData(string connectionString, string realm)
: base(connectionString, realm, "UserAccount")
{
}
public UserAccountData[] GetUsers(UUID scopeID, string query)
{
string[] words = query.Split(new char[] {' '});
for (int i = 0 ; i < words.Length ; i++)
{
if (words[i].Length < 3)
{
if (i != words.Length - 1)
Array.Copy(words, i + 1, words, i, words.Length - i - 1);
Array.Resize(ref words, words.Length - 1);
}
}
if (words.Length == 0)
return new UserAccountData[0];
if (words.Length > 2)
return new UserAccountData[0];
using (MySqlCommand cmd = new MySqlCommand())
{
if (words.Length == 1)
{
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?search or LastName like ?search)", m_Realm);
cmd.Parameters.AddWithValue("?search", "%" + words[0] + "%");
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
}
else
{
cmd.CommandText = String.Format("select * from {0} where (ScopeID=?ScopeID or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like ?searchFirst or LastName like ?searchLast)", m_Realm);
cmd.Parameters.AddWithValue("?searchFirst", "%" + words[0] + "%");
cmd.Parameters.AddWithValue("?searchLast", "%" + words[1] + "%");
cmd.Parameters.AddWithValue("?ScopeID", scopeID.ToString());
}
return DoQuery(cmd);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,522 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
namespace OpenSim.Data.MongoDB
{
public class MongoDBXAssetData : IXAssetDataPlugin
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
/// <summary>
/// Number of days that must pass before we update the access time on an asset when it has been fetched.
/// </summary>
private const int DaysBetweenAccessTimeUpdates = 30;
private bool m_enableCompression = false;
private string m_connectionString;
private object m_dbLock = new object();
/// <summary>
/// We can reuse this for all hashing since all methods are single-threaded through m_dbBLock
/// </summary>
private HashAlgorithm hasher = new SHA256CryptoServiceProvider();
#region IPlugin Members
public string Version { get { return "1.0.0.0"; } }
/// <summary>
/// <para>Initialises Asset interface</para>
/// <para>
/// <list type="bullet">
/// <item>Loads and initialises the MongoDB storage plugin.</item>
/// <item>Warns and uses the obsolete mysql_connection.ini if connect string is empty.</item>
/// <item>Check for migration</item>
/// </list>
/// </para>
/// </summary>
/// <param name="connect">connect string</param>
public void Initialise(string connect)
{
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
m_log.ErrorFormat("[MYSQL XASSETDATA]: THIS PLUGIN IS STRICTLY EXPERIMENTAL.");
m_log.ErrorFormat("[MYSQL XASSETDATA]: DO NOT USE FOR ANY DATA THAT YOU DO NOT MIND LOSING.");
m_log.ErrorFormat("[MYSQL XASSETDATA]: DATABASE TABLES CAN CHANGE AT ANY TIME, CAUSING EXISTING DATA TO BE LOST.");
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
m_log.ErrorFormat("[MYSQL XASSETDATA]: ***********************************************************");
m_connectionString = connect;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "XAssetStore");
m.Update();
}
}
public void Initialise()
{
throw new NotImplementedException();
}
public void Dispose() { }
/// <summary>
/// The name of this DB provider
/// </summary>
public string Name
{
get { return "MongoDB XAsset storage engine"; }
}
#endregion
#region IAssetDataPlugin Members
/// <summary>
/// Fetch Asset <paramref name="assetID"/> from database
/// </summary>
/// <param name="assetID">Asset UUID to fetch</param>
/// <returns>Return the asset</returns>
/// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks>
public AssetBase GetAsset(UUID assetID)
{
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
AssetBase asset = null;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(
"SELECT Name, Description, AccessTime, AssetType, Local, Temporary, AssetFlags, CreatorID, Data FROM XAssetsMeta JOIN XAssetsData ON XAssetsMeta.Hash = XAssetsData.Hash WHERE ID=?ID",
dbcon))
{
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if (dbReader.Read())
{
asset = new AssetBase(assetID, (string)dbReader["Name"], (sbyte)dbReader["AssetType"], dbReader["CreatorID"].ToString());
asset.Data = (byte[])dbReader["Data"];
asset.Description = (string)dbReader["Description"];
string local = dbReader["Local"].ToString();
if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase))
asset.Local = true;
else
asset.Local = false;
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
if (m_enableCompression)
{
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
{
MemoryStream outputStream = new MemoryStream();
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
}
}
}
catch (Exception e)
{
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
}
}
}
}
return asset;
}
/// <summary>
/// Create an asset in database, or update it if existing.
/// </summary>
/// <param name="asset">Asset UUID to create</param>
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
public void StoreAsset(AssetBase asset)
{
// m_log.DebugFormat("[XASSETS DB]: Storing asset {0} {1}", asset.Name, asset.ID);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlTransaction transaction = dbcon.BeginTransaction())
{
string assetName = asset.Name;
if (asset.Name.Length > 64)
{
assetName = asset.Name.Substring(0, 64);
m_log.WarnFormat(
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
}
string assetDescription = asset.Description;
if (asset.Description.Length > 64)
{
assetDescription = asset.Description.Substring(0, 64);
m_log.WarnFormat(
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
if (m_enableCompression)
{
MemoryStream outputStream = new MemoryStream();
using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false))
{
// Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
// We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream.
compressionStream.Close();
byte[] compressedData = outputStream.ToArray();
asset.Data = compressedData;
}
}
byte[] hash = hasher.ComputeHash(asset.Data);
// m_log.DebugFormat(
// "[XASSET DB]: Compressed data size for {0} {1}, hash {2} is {3}",
// asset.ID, asset.Name, hash, compressedData.Length);
try
{
using (MySqlCommand cmd =
new MySqlCommand(
"replace INTO XAssetsMeta(ID, Hash, Name, Description, AssetType, Local, Temporary, CreateTime, AccessTime, AssetFlags, CreatorID)" +
"VALUES(?ID, ?Hash, ?Name, ?Description, ?AssetType, ?Local, ?Temporary, ?CreateTime, ?AccessTime, ?AssetFlags, ?CreatorID)",
dbcon))
{
// create unix epoch time
int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
cmd.Parameters.AddWithValue("?ID", asset.ID);
cmd.Parameters.AddWithValue("?Hash", hash);
cmd.Parameters.AddWithValue("?Name", assetName);
cmd.Parameters.AddWithValue("?Description", assetDescription);
cmd.Parameters.AddWithValue("?AssetType", asset.Type);
cmd.Parameters.AddWithValue("?Local", asset.Local);
cmd.Parameters.AddWithValue("?Temporary", asset.Temporary);
cmd.Parameters.AddWithValue("?CreateTime", now);
cmd.Parameters.AddWithValue("?AccessTime", now);
cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
cmd.Parameters.AddWithValue("?AssetFlags", (int)asset.Flags);
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.ErrorFormat("[ASSET DB]: MongoDB failure creating asset metadata {0} with name \"{1}\". Error: {2}",
asset.FullID, asset.Name, e.Message);
transaction.Rollback();
return;
}
if (!ExistsData(dbcon, transaction, hash))
{
try
{
using (MySqlCommand cmd =
new MySqlCommand(
"INSERT INTO XAssetsData(Hash, Data) VALUES(?Hash, ?Data)",
dbcon))
{
cmd.Parameters.AddWithValue("?Hash", hash);
cmd.Parameters.AddWithValue("?Data", asset.Data);
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.ErrorFormat("[XASSET DB]: MongoDB failure creating asset data {0} with name \"{1}\". Error: {2}",
asset.FullID, asset.Name, e.Message);
transaction.Rollback();
return;
}
}
transaction.Commit();
}
}
}
}
/// <summary>
/// Updates the access time of the asset if it was accessed above a given threshhold amount of time.
/// </summary>
/// <remarks>
/// This gives us some insight into assets which haven't ben accessed for a long period. This is only done
/// over the threshold time to avoid excessive database writes as assets are fetched.
/// </remarks>
/// <param name='asset'></param>
/// <param name='accessTime'></param>
private void UpdateAccessTime(AssetMetadata assetMetadata, int accessTime)
{
DateTime now = DateTime.UtcNow;
if ((now - Utils.UnixTimeToDateTime(accessTime)).TotalDays < DaysBetweenAccessTimeUpdates)
return;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
MySqlCommand cmd =
new MySqlCommand("update XAssetsMeta set AccessTime=?AccessTime where ID=?ID", dbcon);
try
{
using (cmd)
{
// create unix epoch time
cmd.Parameters.AddWithValue("?ID", assetMetadata.ID);
cmd.Parameters.AddWithValue("?AccessTime", (int)Utils.DateTimeToUnixTime(now));
cmd.ExecuteNonQuery();
}
}
catch (Exception e)
{
m_log.ErrorFormat(
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
assetMetadata.ID, assetMetadata.Name);
}
}
}
}
/// <summary>
/// We assume we already have the m_dbLock.
/// </summary>
/// TODO: need to actually use the transaction.
/// <param name="dbcon"></param>
/// <param name="transaction"></param>
/// <param name="hash"></param>
/// <returns></returns>
private bool ExistsData(MySqlConnection dbcon, MySqlTransaction transaction, byte[] hash)
{
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
bool exists = false;
using (MySqlCommand cmd = new MySqlCommand("SELECT Hash FROM XAssetsData WHERE Hash=?Hash", dbcon))
{
cmd.Parameters.AddWithValue("?Hash", hash);
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if (dbReader.Read())
{
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
exists = true;
}
}
}
catch (Exception e)
{
m_log.ErrorFormat(
"[XASSETS DB]: MySql failure in ExistsData fetching hash {0}. Exception {1}{2}",
hash, e.Message, e.StackTrace);
}
}
return exists;
}
/// <summary>
/// Check if the asset exists in the database
/// </summary>
/// <param name="uuid">The asset UUID</param>
/// <returns>true if it exists, false otherwise.</returns>
public bool ExistsAsset(UUID uuid)
{
// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid);
bool assetExists = false;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand("SELECT ID FROM XAssetsMeta WHERE ID=?ID", dbcon))
{
cmd.Parameters.AddWithValue("?ID", uuid.ToString());
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if (dbReader.Read())
{
// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid);
assetExists = true;
}
}
}
catch (Exception e)
{
m_log.Error(string.Format("[XASSETS DB]: MySql failure fetching asset {0}", uuid), e);
}
}
}
}
return assetExists;
}
/// <summary>
/// Returns a list of AssetMetadata objects. The list is a subset of
/// the entire data set offset by <paramref name="start" /> containing
/// <paramref name="count" /> elements.
/// </summary>
/// <param name="start">The number of results to discard from the total data set.</param>
/// <param name="count">The number of rows the returned list should contain.</param>
/// <returns>A list of AssetMetadata objects.</returns>
public List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
{
List<AssetMetadata> retList = new List<AssetMetadata>(count);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon);
cmd.Parameters.AddWithValue("?start", start);
cmd.Parameters.AddWithValue("?count", count);
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader())
{
while (dbReader.Read())
{
AssetMetadata metadata = new AssetMetadata();
metadata.Name = (string)dbReader["Name"];
metadata.Description = (string)dbReader["Description"];
metadata.Type = (sbyte)dbReader["AssetType"];
metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct.
metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
metadata.FullID = DBGuid.FromDB(dbReader["ID"]);
metadata.CreatorID = dbReader["CreatorID"].ToString();
// We'll ignore this for now - it appears unused!
// metadata.SHA1 = dbReader["hash"]);
UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
retList.Add(metadata);
}
}
}
catch (Exception e)
{
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
}
}
}
return retList;
}
public bool Delete(string id)
{
// m_log.DebugFormat("[XASSETS DB]: Deleting asset {0}", id);
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand("delete from XAssetsMeta where ID=?ID", dbcon))
{
cmd.Parameters.AddWithValue("?ID", id);
cmd.ExecuteNonQuery();
}
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
// keep a reference count (?)
}
}
return true;
}
#endregion
}
}

View File

@@ -0,0 +1,334 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.MongoDB
{
/// <summary>
/// A MongoDB Interface for the Asset Server
/// </summary>
public class MongoDBXInventoryData : IXInventoryData
{
private MySqlFolderHandler m_Folders;
private MySqlItemHandler m_Items;
public MongoDBXInventoryData(string conn, string realm)
{
m_Folders = new MySqlFolderHandler(
conn, "inventoryfolders", "InventoryStore");
m_Items = new MySqlItemHandler(
conn, "inventoryitems", String.Empty);
}
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
{
return m_Folders.Get(fields, vals);
}
public XInventoryItem[] GetItems(string[] fields, string[] vals)
{
return m_Items.Get(fields, vals);
}
public bool StoreFolder(XInventoryFolder folder)
{
if (folder.folderName.Length > 64)
folder.folderName = folder.folderName.Substring(0, 64);
return m_Folders.Store(folder);
}
public bool StoreItem(XInventoryItem item)
{
if (item.inventoryName.Length > 64)
item.inventoryName = item.inventoryName.Substring(0, 64);
if (item.inventoryDescription.Length > 128)
item.inventoryDescription = item.inventoryDescription.Substring(0, 128);
return m_Items.Store(item);
}
public bool DeleteFolders(string field, string val)
{
return m_Folders.Delete(field, val);
}
public bool DeleteFolders(string[] fields, string[] vals)
{
return m_Folders.Delete(fields, vals);
}
public bool DeleteItems(string field, string val)
{
return m_Items.Delete(field, val);
}
public bool DeleteItems(string[] fields, string[] vals)
{
return m_Items.Delete(fields, vals);
}
public bool MoveItem(string id, string newParent)
{
return m_Items.MoveItem(id, newParent);
}
public bool MoveFolder(string id, string newParent)
{
return m_Folders.MoveFolder(id, newParent);
}
public XInventoryItem[] GetActiveGestures(UUID principalID)
{
return m_Items.GetActiveGestures(principalID);
}
public int GetAssetPermissions(UUID principalID, UUID assetID)
{
return m_Items.GetAssetPermissions(principalID, assetID);
}
}
public class MySqlItemHandler : MySqlInventoryHandler<XInventoryItem>
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public MySqlItemHandler(string c, string t, string m) :
base(c, t, m)
{
}
public override bool Delete(string field, string val)
{
XInventoryItem[] retrievedItems = Get(new string[] { field }, new string[] { val });
if (retrievedItems.Length == 0)
return false;
if (!base.Delete(field, val))
return false;
// Don't increment folder version here since Delete(string, string) calls Delete(string[], string[])
// IncrementFolderVersion(retrievedItems[0].parentFolderID);
return true;
}
public override bool Delete(string[] fields, string[] vals)
{
XInventoryItem[] retrievedItems = Get(fields, vals);
if (retrievedItems.Length == 0)
return false;
if (!base.Delete(fields, vals))
return false;
HashSet<UUID> deletedItemFolderUUIDs = new HashSet<UUID>();
Array.ForEach<XInventoryItem>(retrievedItems, i => deletedItemFolderUUIDs.Add(i.parentFolderID));
foreach (UUID deletedItemFolderUUID in deletedItemFolderUUIDs)
IncrementFolderVersion(deletedItemFolderUUID);
return true;
}
public bool MoveItem(string id, string newParent)
{
XInventoryItem[] retrievedItems = Get(new string[] { "inventoryID" }, new string[] { id });
if (retrievedItems.Length == 0)
return false;
UUID oldParent = retrievedItems[0].parentFolderID;
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm);
cmd.Parameters.AddWithValue("?ParentFolderID", newParent);
cmd.Parameters.AddWithValue("?InventoryID", id);
if (ExecuteNonQuery(cmd) == 0)
return false;
}
IncrementFolderVersion(oldParent);
IncrementFolderVersion(newParent);
return true;
}
public XInventoryItem[] GetActiveGestures(UUID principalID)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm);
cmd.Parameters.AddWithValue("?uuid", principalID.ToString());
cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
return DoQuery(cmd);
}
}
public int GetAssetPermissions(UUID principalID, UUID assetID)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.Connection = dbcon;
cmd.CommandText = String.Format("select bit_or(inventoryCurrentPermissions) as inventoryCurrentPermissions from inventoryitems where avatarID = ?PrincipalID and assetID = ?AssetID group by assetID", m_Realm);
cmd.Parameters.AddWithValue("?PrincipalID", principalID.ToString());
cmd.Parameters.AddWithValue("?AssetID", assetID.ToString());
using (IDataReader reader = cmd.ExecuteReader())
{
int perms = 0;
if (reader.Read())
{
perms = Convert.ToInt32(reader["inventoryCurrentPermissions"]);
}
return perms;
}
}
}
}
public override bool Store(XInventoryItem item)
{
if (!base.Store(item))
return false;
IncrementFolderVersion(item.parentFolderID);
return true;
}
}
public class MySqlFolderHandler : MySqlInventoryHandler<XInventoryFolder>
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public MySqlFolderHandler(string c, string t, string m) :
base(c, t, m)
{
}
public bool MoveFolder(string id, string newParentFolderID)
{
XInventoryFolder[] folders = Get(new string[] { "folderID" }, new string[] { id });
if (folders.Length == 0)
return false;
UUID oldParentFolderUUID = folders[0].parentFolderID;
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText
= String.Format(
"update {0} set parentFolderID = ?ParentFolderID where folderID = ?folderID", m_Realm);
cmd.Parameters.AddWithValue("?ParentFolderID", newParentFolderID);
cmd.Parameters.AddWithValue("?folderID", id);
if (ExecuteNonQuery(cmd) == 0)
return false;
}
IncrementFolderVersion(oldParentFolderUUID);
IncrementFolderVersion(newParentFolderID);
return true;
}
public override bool Store(XInventoryFolder folder)
{
if (!base.Store(folder))
return false;
IncrementFolderVersion(folder.parentFolderID);
return true;
}
}
public class MySqlInventoryHandler<T> : MongoDBGenericTableHandler<T> where T: class, new()
{
public MySqlInventoryHandler(string c, string t, string m) : base(c, t, m) {}
protected bool IncrementFolderVersion(UUID folderID)
{
return IncrementFolderVersion(folderID.ToString());
}
protected bool IncrementFolderVersion(string folderID)
{
// m_log.DebugFormat("[MYSQL FOLDER HANDLER]: Incrementing version on folder {0}", folderID);
// Util.PrintCallStack();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.Connection = dbcon;
cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID");
cmd.Parameters.AddWithValue("?folderID", folderID);
try
{
cmd.ExecuteNonQuery();
}
catch (Exception)
{
return false;
}
cmd.Dispose();
}
dbcon.Close();
}
return true;
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Reflection;
using System.Runtime.InteropServices;
// General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly : AssemblyTitle("OpenSim.Data.MongoDB")]
[assembly : AssemblyDescription("")]
[assembly : AssemblyConfiguration("")]
[assembly : AssemblyCompany("http://opensimulator.org")]
[assembly : AssemblyProduct("OpenSim.Data.MongoDB")]
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
[assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly : Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly : AssemblyVersion("0.7.6.*")]

View File

@@ -0,0 +1,77 @@
# -----------------
:VERSION 1
BEGIN;
CREATE TABLE `assets` (
`id` binary(16) NOT NULL,
`name` varchar(64) NOT NULL,
`description` varchar(64) NOT NULL,
`assetType` tinyint(4) NOT NULL,
`invType` tinyint(4) NOT NULL,
`local` tinyint(1) NOT NULL,
`temporary` tinyint(1) NOT NULL,
`data` longblob NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
COMMIT;
# -----------------
:VERSION 2
BEGIN;
ALTER TABLE assets change id oldid binary(16);
ALTER TABLE assets add id varchar(36) not null default '';
UPDATE assets set id = concat(substr(hex(oldid),1,8),"-",substr(hex(oldid),9,4),"-",substr(hex(oldid),13,4),"-",substr(hex(oldid),17,4),"-",substr(hex(oldid),21,12));
ALTER TABLE assets drop oldid;
ALTER TABLE assets add constraint primary key(id);
COMMIT;
# -----------------
:VERSION 3
BEGIN;
ALTER TABLE assets change id oldid varchar(36);
ALTER TABLE assets add id char(36) not null default '00000000-0000-0000-0000-000000000000';
UPDATE assets set id = oldid;
ALTER TABLE assets drop oldid;
ALTER TABLE assets add constraint primary key(id);
COMMIT;
# -----------------
:VERSION 4
BEGIN;
ALTER TABLE assets drop InvType;
COMMIT;
# -----------------
:VERSION 5
BEGIN;
ALTER TABLE assets add create_time integer default 0;
ALTER TABLE assets add access_time integer default 0;
COMMIT;
# -----------------
:VERSION 6
DELETE FROM assets WHERE id = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621'
:VERSION 7
ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
:VERSION 8
ALTER TABLE assets ADD COLUMN CreatorID varchar(128) NOT NULL DEFAULT '';

View File

@@ -0,0 +1,39 @@
:VERSION 1 # -------------------------------
begin;
CREATE TABLE `auth` (
`UUID` char(36) NOT NULL,
`passwordHash` char(32) NOT NULL default '',
`passwordSalt` char(32) NOT NULL default '',
`webLoginKey` varchar(255) NOT NULL default '',
PRIMARY KEY (`UUID`)
) ENGINE=InnoDB;
CREATE TABLE `tokens` (
`UUID` char(36) NOT NULL,
`token` varchar(255) NOT NULL,
`validity` datetime NOT NULL,
UNIQUE KEY `uuid_token` (`UUID`,`token`),
KEY `UUID` (`UUID`),
KEY `token` (`token`),
KEY `validity` (`validity`)
) ENGINE=InnoDB;
commit;
:VERSION 2 # -------------------------------
BEGIN;
INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users;
COMMIT;
:VERSION 3 # -------------------------------
BEGIN;
ALTER TABLE `auth` ADD COLUMN `accountType` VARCHAR(32) NOT NULL DEFAULT 'UserAccount';
COMMIT;

View File

@@ -0,0 +1,20 @@
:VERSION 1
BEGIN;
CREATE TABLE Avatars (
PrincipalID CHAR(36) NOT NULL,
Name VARCHAR(32) NOT NULL,
Value VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY(PrincipalID, Name),
KEY(PrincipalID));
COMMIT;
:VERSION 2
BEGIN;
alter table Avatars change column Value Value text;
COMMIT;

View File

@@ -0,0 +1,87 @@
:VERSION 13
# The estate migrations used to be in Region store
# here they will do nothing (bad) if the tables are already there,
# just update the store version.
BEGIN;
CREATE TABLE IF NOT EXISTS `estate_managers` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estate_groups` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estate_users` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estateban` (
`EstateID` int(10) unsigned NOT NULL,
`bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL,
`bannedNameMask` varchar(64) default NULL,
KEY `estateban_EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estate_settings` (
`EstateID` int(10) unsigned NOT NULL auto_increment,
`EstateName` varchar(64) default NULL,
`AbuseEmailToEstateOwner` tinyint(4) NOT NULL,
`DenyAnonymous` tinyint(4) NOT NULL,
`ResetHomeOnTeleport` tinyint(4) NOT NULL,
`FixedSun` tinyint(4) NOT NULL,
`DenyTransacted` tinyint(4) NOT NULL,
`BlockDwell` tinyint(4) NOT NULL,
`DenyIdentified` tinyint(4) NOT NULL,
`AllowVoice` tinyint(4) NOT NULL,
`UseGlobalTime` tinyint(4) NOT NULL,
`PricePerMeter` int(11) NOT NULL,
`TaxFree` tinyint(4) NOT NULL,
`AllowDirectTeleport` tinyint(4) NOT NULL,
`RedirectGridX` int(11) NOT NULL,
`RedirectGridY` int(11) NOT NULL,
`ParentEstateID` int(10) unsigned NOT NULL,
`SunPosition` double NOT NULL,
`EstateSkipScripts` tinyint(4) NOT NULL,
`BillableFactor` float NOT NULL,
`PublicAccess` tinyint(4) NOT NULL,
`AbuseEmail` varchar(255) not null,
`EstateOwner` varchar(36) not null,
`DenyMinors` tinyint not null,
PRIMARY KEY (`EstateID`)
) ENGINE=InnoDB AUTO_INCREMENT=100;
CREATE TABLE IF NOT EXISTS `estate_map` (
`RegionID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`EstateID` int(11) NOT NULL,
PRIMARY KEY (`RegionID`),
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
COMMIT;
:VERSION 32 #--------------------- (moved from RegionStore migr, just in case)
BEGIN;
ALTER TABLE estate_settings AUTO_INCREMENT = 100;
COMMIT;
:VERSION 33 #---------------------
BEGIN;
ALTER TABLE estate_settings ADD COLUMN `AllowLandmark` tinyint(4) NOT NULL default '1';
ALTER TABLE estate_settings ADD COLUMN `AllowParcelChanges` tinyint(4) NOT NULL default '1';
ALTER TABLE estate_settings ADD COLUMN `AllowSetHome` tinyint(4) NOT NULL default '1';
COMMIT;

View File

@@ -0,0 +1,32 @@
:VERSION 1 # -------------------------
BEGIN;
CREATE TABLE `Friends` (
`PrincipalID` CHAR(36) NOT NULL,
`Friend` VARCHAR(255) NOT NULL,
`Flags` VARCHAR(16) NOT NULL DEFAULT 0,
`Offered` VARCHAR(32) NOT NULL DEFAULT 0,
PRIMARY KEY(`PrincipalID`, `Friend`),
KEY(`PrincipalID`)
) ENGINE=InnoDB;
COMMIT;
:VERSION 2 # -------------------------
BEGIN;
INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`;
COMMIT;
:VERSION 3 # -------------------------
BEGIN;
ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
ALTER TABLE `Friends` DROP PRIMARY KEY;
ALTER TABLE `Friends` ADD PRIMARY KEY(PrincipalID(36), Friend(36));
COMMIT;

View File

@@ -0,0 +1,105 @@
:VERSION 1
CREATE TABLE `regions` (
`uuid` varchar(36) NOT NULL,
`regionHandle` bigint(20) unsigned NOT NULL,
`regionName` varchar(32) default NULL,
`regionRecvKey` varchar(128) default NULL,
`regionSendKey` varchar(128) default NULL,
`regionSecret` varchar(128) default NULL,
`regionDataURI` varchar(255) default NULL,
`serverIP` varchar(64) default NULL,
`serverPort` int(10) unsigned default NULL,
`serverURI` varchar(255) default NULL,
`locX` int(10) unsigned default NULL,
`locY` int(10) unsigned default NULL,
`locZ` int(10) unsigned default NULL,
`eastOverrideHandle` bigint(20) unsigned default NULL,
`westOverrideHandle` bigint(20) unsigned default NULL,
`southOverrideHandle` bigint(20) unsigned default NULL,
`northOverrideHandle` bigint(20) unsigned default NULL,
`regionAssetURI` varchar(255) default NULL,
`regionAssetRecvKey` varchar(128) default NULL,
`regionAssetSendKey` varchar(128) default NULL,
`regionUserURI` varchar(255) default NULL,
`regionUserRecvKey` varchar(128) default NULL,
`regionUserSendKey` varchar(128) default NULL, `regionMapTexture` varchar(36) default NULL,
`serverHttpPort` int(10) default NULL, `serverRemotingPort` int(10) default NULL,
`owner_uuid` varchar(36) default '00000000-0000-0000-0000-000000000000' not null,
`originUUID` varchar(36),
PRIMARY KEY (`uuid`),
KEY `regionName` (`regionName`),
KEY `regionHandle` (`regionHandle`),
KEY `overrideHandles` (`eastOverrideHandle`,`westOverrideHandle`,`southOverrideHandle`,`northOverrideHandle`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Rev. 3';
:VERSION 2
BEGIN;
ALTER TABLE regions add column access integer unsigned default 1;
COMMIT;
:VERSION 3
BEGIN;
ALTER TABLE regions add column ScopeID char(36) not null default '00000000-0000-0000-0000-000000000000';
create index ScopeID on regions(ScopeID);
COMMIT;
:VERSION 4
BEGIN;
ALTER TABLE regions add column sizeX integer not null default 0;
ALTER TABLE regions add column sizeY integer not null default 0;
COMMIT;
:VERSION 5
BEGIN;
ALTER TABLE `regions` ADD COLUMN `flags` integer NOT NULL DEFAULT 0;
CREATE INDEX flags ON regions(flags);
COMMIT;
:VERSION 6
BEGIN;
ALTER TABLE `regions` ADD COLUMN `last_seen` integer NOT NULL DEFAULT 0;
COMMIT;
:VERSION 7
BEGIN;
ALTER TABLE `regions` ADD COLUMN `PrincipalID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
ALTER TABLE `regions` ADD COLUMN `Token` varchar(255) NOT NULL;
COMMIT;
:VERSION 8 # ------------
BEGIN;
alter table regions modify column regionName varchar(128) default NULL;
COMMIT;
:VERSION 9 # ------------
BEGIN;
alter table regions add column `parcelMapTexture` varchar(36) default NULL;
COMMIT;

View File

@@ -0,0 +1,24 @@
:VERSION 1 # --------------------------
BEGIN;
CREATE TABLE `GridUser` (
`UserID` VARCHAR(255) NOT NULL,
`HomeRegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`HomePosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
`HomeLookAt` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
`LastRegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`LastPosition` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
`LastLookAt` CHAR(64) NOT NULL DEFAULT '<0,0,0>',
`Online` CHAR(5) NOT NULL DEFAULT 'false',
`Login` CHAR(16) NOT NULL DEFAULT '0',
`Logout` CHAR(16) NOT NULL DEFAULT '0',
PRIMARY KEY (`UserID`)
) ENGINE=InnoDB;
COMMIT;
:VERSION 2 # --------------------------
BEGIN;
COMMIT;

View File

@@ -0,0 +1,24 @@
:VERSION 1 # --------------------------
BEGIN;
CREATE TABLE `im_offline` (
`ID` MEDIUMINT NOT NULL AUTO_INCREMENT,
`PrincipalID` char(36) NOT NULL default '',
`Message` text NOT NULL,
`TMStamp` timestamp NOT NULL,
PRIMARY KEY (`ID`),
KEY `PrincipalID` (`PrincipalID`)
) ENGINE=MyISAM;
COMMIT;
:VERSION 2 # --------------------------
BEGIN;
INSERT INTO `im_offline` SELECT * from `diva_im_offline`;
DROP TABLE `diva_im_offline`;
DELETE FROM `migrations` WHERE name='diva_im_Store';
COMMIT;

View File

@@ -0,0 +1,109 @@
:VERSION 1 # ------------
BEGIN;
CREATE TABLE `inventoryfolders` (
`folderID` varchar(36) NOT NULL default '',
`agentID` varchar(36) default NULL,
`parentFolderID` varchar(36) default NULL,
`folderName` varchar(64) default NULL,
`type` smallint NOT NULL default 0,
`version` int NOT NULL default 0,
PRIMARY KEY (`folderID`),
KEY `owner` (`agentID`),
KEY `parent` (`parentFolderID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `inventoryitems` (
`inventoryID` varchar(36) NOT NULL default '',
`assetID` varchar(36) default NULL,
`assetType` int(11) default NULL,
`parentFolderID` varchar(36) default NULL,
`avatarID` varchar(36) default NULL,
`inventoryName` varchar(64) default NULL,
`inventoryDescription` varchar(128) default NULL,
`inventoryNextPermissions` int(10) unsigned default NULL,
`inventoryCurrentPermissions` int(10) unsigned default NULL,
`invType` int(11) default NULL,
`creatorID` varchar(36) default NULL,
`inventoryBasePermissions` int(10) unsigned NOT NULL default 0,
`inventoryEveryOnePermissions` int(10) unsigned NOT NULL default 0,
`salePrice` int(11) NOT NULL default 0,
`saleType` tinyint(4) NOT NULL default 0,
`creationDate` int(11) NOT NULL default 0,
`groupID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`groupOwned` tinyint(4) NOT NULL default 0,
`flags` int(11) unsigned NOT NULL default 0,
PRIMARY KEY (`inventoryID`),
KEY `owner` (`avatarID`),
KEY `folder` (`parentFolderID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;
:VERSION 2 # ------------
BEGIN;
ALTER TABLE inventoryfolders change folderID folderIDold varchar(36);
ALTER TABLE inventoryfolders change agentID agentIDold varchar(36);
ALTER TABLE inventoryfolders change parentFolderID parentFolderIDold varchar(36);
ALTER TABLE inventoryfolders add folderID char(36) not null default '00000000-0000-0000-0000-000000000000';
ALTER TABLE inventoryfolders add agentID char(36) default NULL;
ALTER TABLE inventoryfolders add parentFolderID char(36) default NULL;
UPDATE inventoryfolders set folderID = folderIDold, agentID = agentIDold, parentFolderID = parentFolderIDold;
ALTER TABLE inventoryfolders drop folderIDold;
ALTER TABLE inventoryfolders drop agentIDold;
ALTER TABLE inventoryfolders drop parentFolderIDold;
ALTER TABLE inventoryfolders add constraint primary key(folderID);
ALTER TABLE inventoryfolders add index inventoryfolders_agentid(agentID);
ALTER TABLE inventoryfolders add index inventoryfolders_parentFolderid(parentFolderID);
ALTER TABLE inventoryitems change inventoryID inventoryIDold varchar(36);
ALTER TABLE inventoryitems change avatarID avatarIDold varchar(36);
ALTER TABLE inventoryitems change parentFolderID parentFolderIDold varchar(36);
ALTER TABLE inventoryitems add inventoryID char(36) not null default '00000000-0000-0000-0000-000000000000';
ALTER TABLE inventoryitems add avatarID char(36) default NULL;
ALTER TABLE inventoryitems add parentFolderID char(36) default NULL;
UPDATE inventoryitems set inventoryID = inventoryIDold, avatarID = avatarIDold, parentFolderID = parentFolderIDold;
ALTER TABLE inventoryitems drop inventoryIDold;
ALTER TABLE inventoryitems drop avatarIDold;
ALTER TABLE inventoryitems drop parentFolderIDold;
ALTER TABLE inventoryitems add constraint primary key(inventoryID);
ALTER TABLE inventoryitems add index inventoryitems_avatarid(avatarID);
ALTER TABLE inventoryitems add index inventoryitems_parentFolderid(parentFolderID);
COMMIT;
:VERSION 3 # ------------
BEGIN;
alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0;
COMMIT;
:VERSION 4 # ------------
BEGIN;
update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' where creatorID is NULL;
update inventoryitems set creatorID = '00000000-0000-0000-0000-000000000000' where creatorID = '';
alter table inventoryitems modify column creatorID varchar(36) not NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 5 # ------------
BEGIN;
alter table inventoryitems modify column creatorID varchar(128) not NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 6 # ------------
BEGIN;
alter table inventoryitems modify column creatorID varchar(255) not NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@@ -0,0 +1,13 @@
:VERSION 1
CREATE TABLE `logs` (
`logID` int(10) unsigned NOT NULL auto_increment,
`target` varchar(36) default NULL,
`server` varchar(64) default NULL,
`method` varchar(64) default NULL,
`arguments` varchar(255) default NULL,
`priority` int(11) default NULL,
`message` text,
PRIMARY KEY (`logID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@@ -0,0 +1,23 @@
:VERSION 1 # --------------------------
BEGIN;
CREATE TABLE `Presence` (
`UserID` VARCHAR(255) NOT NULL,
`RegionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`SessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
`SecureSessionID` CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'
) ENGINE=InnoDB;
CREATE UNIQUE INDEX SessionID ON Presence(SessionID);
CREATE INDEX UserID ON Presence(UserID);
COMMIT;
:VERSION 2 # --------------------------
BEGIN;
ALTER TABLE `Presence` ADD COLUMN LastSeen timestamp;
COMMIT;

View File

@@ -0,0 +1,932 @@
:VERSION 1 #---------------------
BEGIN;
CREATE TABLE `prims` (
`UUID` varchar(255) NOT NULL,
`RegionUUID` varchar(255) default NULL,
`ParentID` int(11) default NULL,
`CreationDate` int(11) default NULL,
`Name` varchar(255) default NULL,
`SceneGroupID` varchar(255) default NULL,
`Text` varchar(255) default NULL,
`Description` varchar(255) default NULL,
`SitName` varchar(255) default NULL,
`TouchName` varchar(255) default NULL,
`ObjectFlags` int(11) default NULL,
`CreatorID` varchar(255) default NULL,
`OwnerID` varchar(255) default NULL,
`GroupID` varchar(255) default NULL,
`LastOwnerID` varchar(255) default NULL,
`OwnerMask` int(11) default NULL,
`NextOwnerMask` int(11) default NULL,
`GroupMask` int(11) default NULL,
`EveryoneMask` int(11) default NULL,
`BaseMask` int(11) default NULL,
`PositionX` float default NULL,
`PositionY` float default NULL,
`PositionZ` float default NULL,
`GroupPositionX` float default NULL,
`GroupPositionY` float default NULL,
`GroupPositionZ` float default NULL,
`VelocityX` float default NULL,
`VelocityY` float default NULL,
`VelocityZ` float default NULL,
`AngularVelocityX` float default NULL,
`AngularVelocityY` float default NULL,
`AngularVelocityZ` float default NULL,
`AccelerationX` float default NULL,
`AccelerationY` float default NULL,
`AccelerationZ` float default NULL,
`RotationX` float default NULL,
`RotationY` float default NULL,
`RotationZ` float default NULL,
`RotationW` float default NULL,
`SitTargetOffsetX` float default NULL,
`SitTargetOffsetY` float default NULL,
`SitTargetOffsetZ` float default NULL,
`SitTargetOrientW` float default NULL,
`SitTargetOrientX` float default NULL,
`SitTargetOrientY` float default NULL,
`SitTargetOrientZ` float default NULL,
PRIMARY KEY (`UUID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `primshapes` (
`UUID` varchar(255) NOT NULL,
`Shape` int(11) default NULL,
`ScaleX` float default NULL,
`ScaleY` float default NULL,
`ScaleZ` float default NULL,
`PCode` int(11) default NULL,
`PathBegin` int(11) default NULL,
`PathEnd` int(11) default NULL,
`PathScaleX` int(11) default NULL,
`PathScaleY` int(11) default NULL,
`PathShearX` int(11) default NULL,
`PathShearY` int(11) default NULL,
`PathSkew` int(11) default NULL,
`PathCurve` int(11) default NULL,
`PathRadiusOffset` int(11) default NULL,
`PathRevolutions` int(11) default NULL,
`PathTaperX` int(11) default NULL,
`PathTaperY` int(11) default NULL,
`PathTwist` int(11) default NULL,
`PathTwistBegin` int(11) default NULL,
`ProfileBegin` int(11) default NULL,
`ProfileEnd` int(11) default NULL,
`ProfileCurve` int(11) default NULL,
`ProfileHollow` int(11) default NULL,
`State` int(11) default NULL,
`Texture` longblob,
`ExtraParams` longblob,
PRIMARY KEY (`UUID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `primitems` (
`itemID` varchar(255) NOT NULL,
`primID` varchar(255) default NULL,
`assetID` varchar(255) default NULL,
`parentFolderID` varchar(255) default NULL,
`invType` int(11) default NULL,
`assetType` int(11) default NULL,
`name` varchar(255) default NULL,
`description` varchar(255) default NULL,
`creationDate` bigint(20) default NULL,
`creatorID` varchar(255) default NULL,
`ownerID` varchar(255) default NULL,
`lastOwnerID` varchar(255) default NULL,
`groupID` varchar(255) default NULL,
`nextPermissions` int(11) default NULL,
`currentPermissions` int(11) default NULL,
`basePermissions` int(11) default NULL,
`everyonePermissions` int(11) default NULL,
`groupPermissions` int(11) default NULL,
PRIMARY KEY (`itemID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `terrain` (
`RegionUUID` varchar(255) default NULL,
`Revision` int(11) default NULL,
`Heightfield` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `land` (
`UUID` varchar(255) NOT NULL,
`RegionUUID` varchar(255) default NULL,
`LocalLandID` int(11) default NULL,
`Bitmap` longblob,
`Name` varchar(255) default NULL,
`Description` varchar(255) default NULL,
`OwnerUUID` varchar(255) default NULL,
`IsGroupOwned` int(11) default NULL,
`Area` int(11) default NULL,
`AuctionID` int(11) default NULL,
`Category` int(11) default NULL,
`ClaimDate` int(11) default NULL,
`ClaimPrice` int(11) default NULL,
`GroupUUID` varchar(255) default NULL,
`SalePrice` int(11) default NULL,
`LandStatus` int(11) default NULL,
`LandFlags` int(11) default NULL,
`LandingType` int(11) default NULL,
`MediaAutoScale` int(11) default NULL,
`MediaTextureUUID` varchar(255) default NULL,
`MediaURL` varchar(255) default NULL,
`MusicURL` varchar(255) default NULL,
`PassHours` float default NULL,
`PassPrice` int(11) default NULL,
`SnapshotUUID` varchar(255) default NULL,
`UserLocationX` float default NULL,
`UserLocationY` float default NULL,
`UserLocationZ` float default NULL,
`UserLookAtX` float default NULL,
`UserLookAtY` float default NULL,
`UserLookAtZ` float default NULL,
`AuthbuyerID` varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
PRIMARY KEY (`UUID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `landaccesslist` (
`LandUUID` varchar(255) default NULL,
`AccessUUID` varchar(255) default NULL,
`Flags` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
COMMIT;
:VERSION 2 #---------------------
BEGIN;
CREATE index prims_regionuuid on prims(RegionUUID);
CREATE index primitems_primid on primitems(primID);
COMMIT;
:VERSION 3 #---------------------
BEGIN;
CREATE TABLE regionban (regionUUID VARCHAR(36) NOT NULL, bannedUUID VARCHAR(36) NOT NULL, bannedIp VARCHAR(16) NOT NULL, bannedIpHostMask VARCHAR(16) NOT NULL) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
COMMIT;
:VERSION 4 #---------------------
BEGIN;
ALTER TABLE primitems add flags integer not null default 0;
COMMIT;
:VERSION 5 #---------------------
BEGIN;
create table regionsettings (
regionUUID char(36) not null,
block_terraform integer not null,
block_fly integer not null,
allow_damage integer not null,
restrict_pushing integer not null,
allow_land_resell integer not null,
allow_land_join_divide integer not null,
block_show_in_search integer not null,
agent_limit integer not null,
object_bonus float not null,
maturity integer not null,
disable_scripts integer not null,
disable_collisions integer not null,
disable_physics integer not null,
terrain_texture_1 char(36) not null,
terrain_texture_2 char(36) not null,
terrain_texture_3 char(36) not null,
terrain_texture_4 char(36) not null,
elevation_1_nw float not null,
elevation_2_nw float not null,
elevation_1_ne float not null,
elevation_2_ne float not null,
elevation_1_se float not null,
elevation_2_se float not null,
elevation_1_sw float not null,
elevation_2_sw float not null,
water_height float not null,
terrain_raise_limit float not null,
terrain_lower_limit float not null,
use_estate_sun integer not null,
fixed_sun integer not null,
sun_position float not null,
covenant char(36),
primary key(regionUUID)
);
COMMIT;
:VERSION 6 #---------------------
BEGIN;
alter table landaccesslist ENGINE = InnoDB;
alter table migrations ENGINE = InnoDB;
alter table primitems ENGINE = InnoDB;
alter table prims ENGINE = InnoDB;
alter table primshapes ENGINE = InnoDB;
alter table regionsettings ENGINE = InnoDB;
alter table terrain ENGINE = InnoDB;
COMMIT;
:VERSION 7 #---------------------
BEGIN;
ALTER TABLE prims change UUID UUIDold varchar(255);
ALTER TABLE prims change RegionUUID RegionUUIDold varchar(255);
ALTER TABLE prims change CreatorID CreatorIDold varchar(255);
ALTER TABLE prims change OwnerID OwnerIDold varchar(255);
ALTER TABLE prims change GroupID GroupIDold varchar(255);
ALTER TABLE prims change LastOwnerID LastOwnerIDold varchar(255);
ALTER TABLE prims add UUID char(36);
ALTER TABLE prims add RegionUUID char(36);
ALTER TABLE prims add CreatorID char(36);
ALTER TABLE prims add OwnerID char(36);
ALTER TABLE prims add GroupID char(36);
ALTER TABLE prims add LastOwnerID char(36);
UPDATE prims set UUID = UUIDold, RegionUUID = RegionUUIDold, CreatorID = CreatorIDold, OwnerID = OwnerIDold, GroupID = GroupIDold, LastOwnerID = LastOwnerIDold;
ALTER TABLE prims drop UUIDold;
ALTER TABLE prims drop RegionUUIDold;
ALTER TABLE prims drop CreatorIDold;
ALTER TABLE prims drop OwnerIDold;
ALTER TABLE prims drop GroupIDold;
ALTER TABLE prims drop LastOwnerIDold;
ALTER TABLE prims add constraint primary key(UUID);
ALTER TABLE prims add index prims_regionuuid(RegionUUID);
COMMIT;
:VERSION 8 #---------------------
BEGIN;
ALTER TABLE primshapes change UUID UUIDold varchar(255);
ALTER TABLE primshapes add UUID char(36);
UPDATE primshapes set UUID = UUIDold;
ALTER TABLE primshapes drop UUIDold;
ALTER TABLE primshapes add constraint primary key(UUID);
COMMIT;
:VERSION 9 #---------------------
BEGIN;
ALTER TABLE primitems change itemID itemIDold varchar(255);
ALTER TABLE primitems change primID primIDold varchar(255);
ALTER TABLE primitems change assetID assetIDold varchar(255);
ALTER TABLE primitems change parentFolderID parentFolderIDold varchar(255);
ALTER TABLE primitems change creatorID creatorIDold varchar(255);
ALTER TABLE primitems change ownerID ownerIDold varchar(255);
ALTER TABLE primitems change groupID groupIDold varchar(255);
ALTER TABLE primitems change lastOwnerID lastOwnerIDold varchar(255);
ALTER TABLE primitems add itemID char(36);
ALTER TABLE primitems add primID char(36);
ALTER TABLE primitems add assetID char(36);
ALTER TABLE primitems add parentFolderID char(36);
ALTER TABLE primitems add creatorID char(36);
ALTER TABLE primitems add ownerID char(36);
ALTER TABLE primitems add groupID char(36);
ALTER TABLE primitems add lastOwnerID char(36);
UPDATE primitems set itemID = itemIDold, primID = primIDold, assetID = assetIDold, parentFolderID = parentFolderIDold, creatorID = creatorIDold, ownerID = ownerIDold, groupID = groupIDold, lastOwnerID = lastOwnerIDold;
ALTER TABLE primitems drop itemIDold;
ALTER TABLE primitems drop primIDold;
ALTER TABLE primitems drop assetIDold;
ALTER TABLE primitems drop parentFolderIDold;
ALTER TABLE primitems drop creatorIDold;
ALTER TABLE primitems drop ownerIDold;
ALTER TABLE primitems drop groupIDold;
ALTER TABLE primitems drop lastOwnerIDold;
ALTER TABLE primitems add constraint primary key(itemID);
ALTER TABLE primitems add index primitems_primid(primID);
COMMIT;
:VERSION 10 #---------------------
# 1 "010_RegionStore.sql"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "010_RegionStore.sql"
BEGIN;
DELETE FROM regionsettings;
COMMIT;
:VERSION 11 #---------------------
BEGIN;
ALTER TABLE prims change SceneGroupID SceneGroupIDold varchar(255);
ALTER TABLE prims add SceneGroupID char(36);
UPDATE prims set SceneGroupID = SceneGroupIDold;
ALTER TABLE prims drop SceneGroupIDold;
ALTER TABLE prims add index prims_scenegroupid(SceneGroupID);
COMMIT;
:VERSION 12 #---------------------
BEGIN;
ALTER TABLE prims add index prims_parentid(ParentID);
COMMIT;
:VERSION 13 #---------------------
begin;
drop table regionsettings;
CREATE TABLE `regionsettings` (
`regionUUID` char(36) NOT NULL,
`block_terraform` int(11) NOT NULL,
`block_fly` int(11) NOT NULL,
`allow_damage` int(11) NOT NULL,
`restrict_pushing` int(11) NOT NULL,
`allow_land_resell` int(11) NOT NULL,
`allow_land_join_divide` int(11) NOT NULL,
`block_show_in_search` int(11) NOT NULL,
`agent_limit` int(11) NOT NULL,
`object_bonus` float NOT NULL,
`maturity` int(11) NOT NULL,
`disable_scripts` int(11) NOT NULL,
`disable_collisions` int(11) NOT NULL,
`disable_physics` int(11) NOT NULL,
`terrain_texture_1` char(36) NOT NULL,
`terrain_texture_2` char(36) NOT NULL,
`terrain_texture_3` char(36) NOT NULL,
`terrain_texture_4` char(36) NOT NULL,
`elevation_1_nw` float NOT NULL,
`elevation_2_nw` float NOT NULL,
`elevation_1_ne` float NOT NULL,
`elevation_2_ne` float NOT NULL,
`elevation_1_se` float NOT NULL,
`elevation_2_se` float NOT NULL,
`elevation_1_sw` float NOT NULL,
`elevation_2_sw` float NOT NULL,
`water_height` float NOT NULL,
`terrain_raise_limit` float NOT NULL,
`terrain_lower_limit` float NOT NULL,
`use_estate_sun` int(11) NOT NULL,
`fixed_sun` int(11) NOT NULL,
`sun_position` float NOT NULL,
`covenant` char(36) default NULL,
`Sandbox` tinyint(4) NOT NULL,
PRIMARY KEY (`regionUUID`)
) ENGINE=InnoDB;
commit;
:VERSION 16 #---------------------
BEGIN;
ALTER TABLE prims ADD COLUMN PayPrice integer not null default 0;
ALTER TABLE prims ADD COLUMN PayButton1 integer not null default 0;
ALTER TABLE prims ADD COLUMN PayButton2 integer not null default 0;
ALTER TABLE prims ADD COLUMN PayButton3 integer not null default 0;
ALTER TABLE prims ADD COLUMN PayButton4 integer not null default 0;
ALTER TABLE prims ADD COLUMN LoopedSound char(36) not null default '00000000-0000-0000-0000-000000000000';
ALTER TABLE prims ADD COLUMN LoopedSoundGain float not null default 0.0;
ALTER TABLE prims ADD COLUMN TextureAnimation blob;
ALTER TABLE prims ADD COLUMN OmegaX float not null default 0.0;
ALTER TABLE prims ADD COLUMN OmegaY float not null default 0.0;
ALTER TABLE prims ADD COLUMN OmegaZ float not null default 0.0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float not null default 0.0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float not null default 0.0;
ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float not null default 0.0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetX float not null default 0.0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetY float not null default 0.0;
ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float not null default 0.0;
ALTER TABLE prims ADD COLUMN ForceMouselook tinyint not null default 0;
ALTER TABLE prims ADD COLUMN ScriptAccessPin integer not null default 0;
ALTER TABLE prims ADD COLUMN AllowedDrop tinyint not null default 0;
ALTER TABLE prims ADD COLUMN DieAtEdge tinyint not null default 0;
ALTER TABLE prims ADD COLUMN SalePrice integer not null default 10;
ALTER TABLE prims ADD COLUMN SaleType tinyint not null default 0;
COMMIT;
:VERSION 17 #---------------------
BEGIN;
ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;
ALTER TABLE prims ADD COLUMN ParticleSystem blob;
COMMIT;
:VERSION 18 #---------------------
begin;
ALTER TABLE prims ADD COLUMN ClickAction tinyint NOT NULL default 0;
commit;
:VERSION 19 #---------------------
begin;
ALTER TABLE prims ADD COLUMN Material tinyint NOT NULL default 3;
commit;
:VERSION 20 #---------------------
begin;
ALTER TABLE land ADD COLUMN OtherCleanTime integer NOT NULL default 0;
ALTER TABLE land ADD COLUMN Dwell integer NOT NULL default 0;
commit;
:VERSION 21 #---------------------
begin;
ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0;
ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0;
ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0;
commit;
:VERSION 22 #---------------------
BEGIN;
ALTER TABLE prims ADD COLUMN CollisionSound char(36) not null default '00000000-0000-0000-0000-000000000000';
ALTER TABLE prims ADD COLUMN CollisionSoundVolume float not null default 0.0;
COMMIT;
:VERSION 23 #---------------------
BEGIN;
ALTER TABLE prims ADD COLUMN LinkNumber integer not null default 0;
COMMIT;
:VERSION 24 #---------------------
BEGIN;
alter table regionsettings change column `object_bonus` `object_bonus` double NOT NULL;
alter table regionsettings change column `elevation_1_nw` `elevation_1_nw` double NOT NULL;
alter table regionsettings change column `elevation_2_nw` `elevation_2_nw` double NOT NULL;
alter table regionsettings change column `elevation_1_ne` `elevation_1_ne` double NOT NULL;
alter table regionsettings change column `elevation_2_ne` `elevation_2_ne` double NOT NULL;
alter table regionsettings change column `elevation_1_se` `elevation_1_se` double NOT NULL;
alter table regionsettings change column `elevation_2_se` `elevation_2_se` double NOT NULL;
alter table regionsettings change column `elevation_1_sw` `elevation_1_sw` double NOT NULL;
alter table regionsettings change column `elevation_2_sw` `elevation_2_sw` double NOT NULL;
alter table regionsettings change column `water_height` `water_height` double NOT NULL;
alter table regionsettings change column `terrain_raise_limit` `terrain_raise_limit` double NOT NULL;
alter table regionsettings change column `terrain_lower_limit` `terrain_lower_limit` double NOT NULL;
alter table regionsettings change column `sun_position` `sun_position` double NOT NULL;
COMMIT;
:VERSION 25 #---------------------
BEGIN;
alter table prims change column `PositionX` `PositionX` double default NULL;
alter table prims change column `PositionY` `PositionY` double default NULL;
alter table prims change column `PositionZ` `PositionZ` double default NULL;
alter table prims change column `GroupPositionX` `GroupPositionX` double default NULL;
alter table prims change column `GroupPositionY` `GroupPositionY` double default NULL;
alter table prims change column `GroupPositionZ` `GroupPositionZ` double default NULL;
alter table prims change column `VelocityX` `VelocityX` double default NULL;
alter table prims change column `VelocityY` `VelocityY` double default NULL;
alter table prims change column `VelocityZ` `VelocityZ` double default NULL;
alter table prims change column `AngularVelocityX` `AngularVelocityX` double default NULL;
alter table prims change column `AngularVelocityY` `AngularVelocityY` double default NULL;
alter table prims change column `AngularVelocityZ` `AngularVelocityZ` double default NULL;
alter table prims change column `AccelerationX` `AccelerationX` double default NULL;
alter table prims change column `AccelerationY` `AccelerationY` double default NULL;
alter table prims change column `AccelerationZ` `AccelerationZ` double default NULL;
alter table prims change column `RotationX` `RotationX` double default NULL;
alter table prims change column `RotationY` `RotationY` double default NULL;
alter table prims change column `RotationZ` `RotationZ` double default NULL;
alter table prims change column `RotationW` `RotationW` double default NULL;
alter table prims change column `SitTargetOffsetX` `SitTargetOffsetX` double default NULL;
alter table prims change column `SitTargetOffsetY` `SitTargetOffsetY` double default NULL;
alter table prims change column `SitTargetOffsetZ` `SitTargetOffsetZ` double default NULL;
alter table prims change column `SitTargetOrientW` `SitTargetOrientW` double default NULL;
alter table prims change column `SitTargetOrientX` `SitTargetOrientX` double default NULL;
alter table prims change column `SitTargetOrientY` `SitTargetOrientY` double default NULL;
alter table prims change column `SitTargetOrientZ` `SitTargetOrientZ` double default NULL;
alter table prims change column `LoopedSoundGain` `LoopedSoundGain` double NOT NULL default '0';
alter table prims change column `OmegaX` `OmegaX` double NOT NULL default '0';
alter table prims change column `OmegaY` `OmegaY` double NOT NULL default '0';
alter table prims change column `OmegaZ` `OmegaZ` double NOT NULL default '0';
alter table prims change column `CameraEyeOffsetX` `CameraEyeOffsetX` double NOT NULL default '0';
alter table prims change column `CameraEyeOffsetY` `CameraEyeOffsetY` double NOT NULL default '0';
alter table prims change column `CameraEyeOffsetZ` `CameraEyeOffsetZ` double NOT NULL default '0';
alter table prims change column `CameraAtOffsetX` `CameraAtOffsetX` double NOT NULL default '0';
alter table prims change column `CameraAtOffsetY` `CameraAtOffsetY` double NOT NULL default '0';
alter table prims change column `CameraAtOffsetZ` `CameraAtOffsetZ` double NOT NULL default '0';
alter table prims change column `CollisionSoundVolume` `CollisionSoundVolume` double NOT NULL default '0';
alter table primshapes change column `ScaleX` `ScaleX` double NOT NULL default '0';
alter table primshapes change column `ScaleY` `ScaleY` double NOT NULL default '0';
alter table primshapes change column `ScaleZ` `ScaleZ` double NOT NULL default '0';
COMMIT;
:VERSION 26 #---------------------
begin;
alter table prims change column `PositionX` `PositionX` double default NULL;
alter table prims change column `PositionY` `PositionY` double default NULL;
alter table prims change column `PositionZ` `PositionZ` double default NULL;
alter table prims change column `GroupPositionX` `GroupPositionX` double default NULL;
alter table prims change column `GroupPositionY` `GroupPositionY` double default NULL;
alter table prims change column `GroupPositionZ` `GroupPositionZ` double default NULL;
alter table prims change column `VelocityX` `VelocityX` double default NULL;
alter table prims change column `VelocityY` `VelocityY` double default NULL;
alter table prims change column `VelocityZ` `VelocityZ` double default NULL;
alter table prims change column `AngularVelocityX` `AngularVelocityX` double default NULL;
alter table prims change column `AngularVelocityY` `AngularVelocityY` double default NULL;
alter table prims change column `AngularVelocityZ` `AngularVelocityZ` double default NULL;
alter table prims change column `AccelerationX` `AccelerationX` double default NULL;
alter table prims change column `AccelerationY` `AccelerationY` double default NULL;
alter table prims change column `AccelerationZ` `AccelerationZ` double default NULL;
alter table prims change column `RotationX` `RotationX` double default NULL;
alter table prims change column `RotationY` `RotationY` double default NULL;
alter table prims change column `RotationZ` `RotationZ` double default NULL;
alter table prims change column `RotationW` `RotationW` double default NULL;
alter table prims change column `SitTargetOffsetX` `SitTargetOffsetX` double default NULL;
alter table prims change column `SitTargetOffsetY` `SitTargetOffsetY` double default NULL;
alter table prims change column `SitTargetOffsetZ` `SitTargetOffsetZ` double default NULL;
alter table prims change column `SitTargetOrientW` `SitTargetOrientW` double default NULL;
alter table prims change column `SitTargetOrientX` `SitTargetOrientX` double default NULL;
alter table prims change column `SitTargetOrientY` `SitTargetOrientY` double default NULL;
alter table prims change column `SitTargetOrientZ` `SitTargetOrientZ` double default NULL;
alter table prims change column `LoopedSoundGain` `LoopedSoundGain` double NOT NULL default '0';
alter table prims change column `OmegaX` `OmegaX` double NOT NULL default '0';
alter table prims change column `OmegaY` `OmegaY` double NOT NULL default '0';
alter table prims change column `OmegaZ` `OmegaZ` double NOT NULL default '0';
alter table prims change column `CameraEyeOffsetX` `CameraEyeOffsetX` double NOT NULL default '0';
alter table prims change column `CameraEyeOffsetY` `CameraEyeOffsetY` double NOT NULL default '0';
alter table prims change column `CameraEyeOffsetZ` `CameraEyeOffsetZ` double NOT NULL default '0';
alter table prims change column `CameraAtOffsetX` `CameraAtOffsetX` double NOT NULL default '0';
alter table prims change column `CameraAtOffsetY` `CameraAtOffsetY` double NOT NULL default '0';
alter table prims change column `CameraAtOffsetZ` `CameraAtOffsetZ` double NOT NULL default '0';
alter table prims change column `CollisionSoundVolume` `CollisionSoundVolume` double NOT NULL default '0';
commit;
:VERSION 27 #---------------------
BEGIN;
ALTER TABLE prims DROP COLUMN ParentID;
COMMIT;
:VERSION 28 #---------------------
BEGIN;
update terrain
set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12))
where RegionUUID not like '%-%';
update landaccesslist
set LandUUID = concat(substr(LandUUID, 1, 8), "-", substr(LandUUID, 9, 4), "-", substr(LandUUID, 13, 4), "-", substr(LandUUID, 17, 4), "-", substr(LandUUID, 21, 12))
where LandUUID not like '%-%';
update landaccesslist
set AccessUUID = concat(substr(AccessUUID, 1, 8), "-", substr(AccessUUID, 9, 4), "-", substr(AccessUUID, 13, 4), "-", substr(AccessUUID, 17, 4), "-", substr(AccessUUID, 21, 12))
where AccessUUID not like '%-%';
update prims
set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12))
where UUID not like '%-%';
update prims
set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12))
where RegionUUID not like '%-%';
update prims
set SceneGroupID = concat(substr(SceneGroupID, 1, 8), "-", substr(SceneGroupID, 9, 4), "-", substr(SceneGroupID, 13, 4), "-", substr(SceneGroupID, 17, 4), "-", substr(SceneGroupID, 21, 12))
where SceneGroupID not like '%-%';
update prims
set CreatorID = concat(substr(CreatorID, 1, 8), "-", substr(CreatorID, 9, 4), "-", substr(CreatorID, 13, 4), "-", substr(CreatorID, 17, 4), "-", substr(CreatorID, 21, 12))
where CreatorID not like '%-%';
update prims
set OwnerID = concat(substr(OwnerID, 1, 8), "-", substr(OwnerID, 9, 4), "-", substr(OwnerID, 13, 4), "-", substr(OwnerID, 17, 4), "-", substr(OwnerID, 21, 12))
where OwnerID not like '%-%';
update prims
set GroupID = concat(substr(GroupID, 1, 8), "-", substr(GroupID, 9, 4), "-", substr(GroupID, 13, 4), "-", substr(GroupID, 17, 4), "-", substr(GroupID, 21, 12))
where GroupID not like '%-%';
update prims
set LastOwnerID = concat(substr(LastOwnerID, 1, 8), "-", substr(LastOwnerID, 9, 4), "-", substr(LastOwnerID, 13, 4), "-", substr(LastOwnerID, 17, 4), "-", substr(LastOwnerID, 21, 12))
where LastOwnerID not like '%-%';
update primshapes
set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12))
where UUID not like '%-%';
update land
set UUID = concat(substr(UUID, 1, 8), "-", substr(UUID, 9, 4), "-", substr(UUID, 13, 4), "-", substr(UUID, 17, 4), "-", substr(UUID, 21, 12))
where UUID not like '%-%';
update land
set RegionUUID = concat(substr(RegionUUID, 1, 8), "-", substr(RegionUUID, 9, 4), "-", substr(RegionUUID, 13, 4), "-", substr(RegionUUID, 17, 4), "-", substr(RegionUUID, 21, 12))
where RegionUUID not like '%-%';
update land
set OwnerUUID = concat(substr(OwnerUUID, 1, 8), "-", substr(OwnerUUID, 9, 4), "-", substr(OwnerUUID, 13, 4), "-", substr(OwnerUUID, 17, 4), "-", substr(OwnerUUID, 21, 12))
where OwnerUUID not like '%-%';
update land
set GroupUUID = concat(substr(GroupUUID, 1, 8), "-", substr(GroupUUID, 9, 4), "-", substr(GroupUUID, 13, 4), "-", substr(GroupUUID, 17, 4), "-", substr(GroupUUID, 21, 12))
where GroupUUID not like '%-%';
update land
set MediaTextureUUID = concat(substr(MediaTextureUUID, 1, 8), "-", substr(MediaTextureUUID, 9, 4), "-", substr(MediaTextureUUID, 13, 4), "-", substr(MediaTextureUUID, 17, 4), "-", substr(MediaTextureUUID, 21, 12))
where MediaTextureUUID not like '%-%';
update land
set SnapshotUUID = concat(substr(SnapshotUUID, 1, 8), "-", substr(SnapshotUUID, 9, 4), "-", substr(SnapshotUUID, 13, 4), "-", substr(SnapshotUUID, 17, 4), "-", substr(SnapshotUUID, 21, 12))
where SnapshotUUID not like '%-%';
update land
set AuthbuyerID = concat(substr(AuthbuyerID, 1, 8), "-", substr(AuthbuyerID, 9, 4), "-", substr(AuthbuyerID, 13, 4), "-", substr(AuthbuyerID, 17, 4), "-", substr(AuthbuyerID, 21, 12))
where AuthbuyerID not like '%-%';
COMMIT;
:VERSION 29 #---------------------
BEGIN;
ALTER TABLE prims ADD COLUMN PassTouches tinyint not null default 0;
COMMIT;
:VERSION 30 #---------------------
BEGIN;
ALTER TABLE regionsettings ADD COLUMN loaded_creation_date varchar(20) default NULL;
ALTER TABLE regionsettings ADD COLUMN loaded_creation_time varchar(20) default NULL;
ALTER TABLE regionsettings ADD COLUMN loaded_creation_id varchar(64) default NULL;
COMMIT;
:VERSION 31 #---------------------
BEGIN;
ALTER TABLE regionsettings DROP COLUMN loaded_creation_date;
ALTER TABLE regionsettings DROP COLUMN loaded_creation_time;
ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT NULL default 0;
COMMIT;
:VERSION 32
BEGIN;
CREATE TABLE `regionwindlight` (
`region_id` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000',
`water_color_r` float(9,6) unsigned NOT NULL DEFAULT '4.000000',
`water_color_g` float(9,6) unsigned NOT NULL DEFAULT '38.000000',
`water_color_b` float(9,6) unsigned NOT NULL DEFAULT '64.000000',
`water_fog_density_exponent` float(3,1) unsigned NOT NULL DEFAULT '4.0',
`underwater_fog_modifier` float(3,2) unsigned NOT NULL DEFAULT '0.25',
`reflection_wavelet_scale_1` float(3,1) unsigned NOT NULL DEFAULT '2.0',
`reflection_wavelet_scale_2` float(3,1) unsigned NOT NULL DEFAULT '2.0',
`reflection_wavelet_scale_3` float(3,1) unsigned NOT NULL DEFAULT '2.0',
`fresnel_scale` float(3,2) unsigned NOT NULL DEFAULT '0.40',
`fresnel_offset` float(3,2) unsigned NOT NULL DEFAULT '0.50',
`refract_scale_above` float(3,2) unsigned NOT NULL DEFAULT '0.03',
`refract_scale_below` float(3,2) unsigned NOT NULL DEFAULT '0.20',
`blur_multiplier` float(4,3) unsigned NOT NULL DEFAULT '0.040',
`big_wave_direction_x` float(3,2) NOT NULL DEFAULT '1.05',
`big_wave_direction_y` float(3,2) NOT NULL DEFAULT '-0.42',
`little_wave_direction_x` float(3,2) NOT NULL DEFAULT '1.11',
`little_wave_direction_y` float(3,2) NOT NULL DEFAULT '-1.16',
`normal_map_texture` varchar(36) NOT NULL DEFAULT '822ded49-9a6c-f61c-cb89-6df54f42cdf4',
`horizon_r` float(3,2) unsigned NOT NULL DEFAULT '0.25',
`horizon_g` float(3,2) unsigned NOT NULL DEFAULT '0.25',
`horizon_b` float(3,2) unsigned NOT NULL DEFAULT '0.32',
`horizon_i` float(3,2) unsigned NOT NULL DEFAULT '0.32',
`haze_horizon` float(3,2) unsigned NOT NULL DEFAULT '0.19',
`blue_density_r` float(3,2) unsigned NOT NULL DEFAULT '0.12',
`blue_density_g` float(3,2) unsigned NOT NULL DEFAULT '0.22',
`blue_density_b` float(3,2) unsigned NOT NULL DEFAULT '0.38',
`blue_density_i` float(3,2) unsigned NOT NULL DEFAULT '0.38',
`haze_density` float(3,2) unsigned NOT NULL DEFAULT '0.70',
`density_multiplier` float(3,2) unsigned NOT NULL DEFAULT '0.18',
`distance_multiplier` float(4,1) unsigned NOT NULL DEFAULT '0.8',
`max_altitude` int(4) unsigned NOT NULL DEFAULT '1605',
`sun_moon_color_r` float(3,2) unsigned NOT NULL DEFAULT '0.24',
`sun_moon_color_g` float(3,2) unsigned NOT NULL DEFAULT '0.26',
`sun_moon_color_b` float(3,2) unsigned NOT NULL DEFAULT '0.30',
`sun_moon_color_i` float(3,2) unsigned NOT NULL DEFAULT '0.30',
`sun_moon_position` float(4,3) unsigned NOT NULL DEFAULT '0.317',
`ambient_r` float(3,2) unsigned NOT NULL DEFAULT '0.35',
`ambient_g` float(3,2) unsigned NOT NULL DEFAULT '0.35',
`ambient_b` float(3,2) unsigned NOT NULL DEFAULT '0.35',
`ambient_i` float(3,2) unsigned NOT NULL DEFAULT '0.35',
`east_angle` float(3,2) unsigned NOT NULL DEFAULT '0.00',
`sun_glow_focus` float(3,2) unsigned NOT NULL DEFAULT '0.10',
`sun_glow_size` float(3,2) unsigned NOT NULL DEFAULT '1.75',
`scene_gamma` float(4,2) unsigned NOT NULL DEFAULT '1.00',
`star_brightness` float(3,2) unsigned NOT NULL DEFAULT '0.00',
`cloud_color_r` float(3,2) unsigned NOT NULL DEFAULT '0.41',
`cloud_color_g` float(3,2) unsigned NOT NULL DEFAULT '0.41',
`cloud_color_b` float(3,2) unsigned NOT NULL DEFAULT '0.41',
`cloud_color_i` float(3,2) unsigned NOT NULL DEFAULT '0.41',
`cloud_x` float(3,2) unsigned NOT NULL DEFAULT '1.00',
`cloud_y` float(3,2) unsigned NOT NULL DEFAULT '0.53',
`cloud_density` float(3,2) unsigned NOT NULL DEFAULT '1.00',
`cloud_coverage` float(3,2) unsigned NOT NULL DEFAULT '0.27',
`cloud_scale` float(3,2) unsigned NOT NULL DEFAULT '0.42',
`cloud_detail_x` float(3,2) unsigned NOT NULL DEFAULT '1.00',
`cloud_detail_y` float(3,2) unsigned NOT NULL DEFAULT '0.53',
`cloud_detail_density` float(3,2) unsigned NOT NULL DEFAULT '0.12',
`cloud_scroll_x` float(3,2) unsigned NOT NULL DEFAULT '0.20',
`cloud_scroll_x_lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
`cloud_scroll_y` float(3,2) unsigned NOT NULL DEFAULT '0.01',
`cloud_scroll_y_lock` tinyint(1) unsigned NOT NULL DEFAULT '0',
`draw_classic_clouds` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`region_id`)
);
:VERSION 33 #---------------------
BEGIN;
ALTER TABLE regionsettings ADD map_tile_ID CHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 34 #---------------------
BEGIN;
ALTER TABLE `regionwindlight` CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` FLOAT(4,2) NOT NULL DEFAULT '0.20' AFTER `cloud_detail_density`, CHANGE COLUMN `cloud_scroll_y` `cloud_scroll_y` FLOAT(4,2) NOT NULL DEFAULT '0.01' AFTER `cloud_scroll_x_lock`;
COMMIT;
:VERSION 35 #---------------------
BEGIN;
ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
ALTER TABLE primshapes ADD COLUMN Media TEXT;
COMMIT;
:VERSION 36 #---------------------
BEGIN;
ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ;
ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
COMMIT;
:VERSION 37 #---------------------
BEGIN;
ALTER TABLE `prims` MODIFY COLUMN `CreatorID` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `primitems` MODIFY COLUMN `CreatorID` VARCHAR(255) NOT NULL DEFAULT '';
COMMIT;
:VERSION 38 #---------------------
BEGIN;
alter table land ENGINE = MyISAM;
alter table landaccesslist ENGINE = MyISAM;
alter table migrations ENGINE = MyISAM;
alter table primitems ENGINE = MyISAM;
alter table prims ENGINE = MyISAM;
alter table primshapes ENGINE = MyISAM;
alter table regionban ENGINE = MyISAM;
alter table regionsettings ENGINE = MyISAM;
alter table terrain ENGINE = MyISAM;
COMMIT;
:VERSION 39 #--------------- Telehub support
BEGIN;
CREATE TABLE IF NOT EXISTS `spawn_points` (
`RegionID` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
`Yaw` float NOT NULL,
`Pitch` float NOT NULL,
`Distance` float NOT NULL,
KEY `RegionID` (`RegionID`)
) ENGINE=Innodb;
ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL;
COMMIT;
:VERSION 40 #---------------- Parcels for sale
BEGIN;
ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 41 #---------------- Timed bans/access
BEGIN;
ALTER TABLE `landaccesslist` ADD COLUMN `Expires` INTEGER NOT NULL DEFAULT 0;
COMMIT;
:VERSION 42 #--------------------- Region Covenant changed time
BEGIN;
ALTER TABLE regionsettings ADD COLUMN covenant_datetime int unsigned NOT NULL DEFAULT '0';
COMMIT;
:VERSION 43 #---------------------
BEGIN;
ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 44 #--------------------- Environment Settings
BEGIN;
CREATE TABLE `regionenvironment` (
`region_id` varchar(36) NOT NULL,
`llsd_settings` TEXT NOT NULL,
PRIMARY KEY (`region_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;
:VERSION 45
BEGIN;
CREATE TABLE `regionextra` (`RegionID` char(36) not null, `Name` varchar(32) not null, `value` text, primary key(`RegionID`, `Name`));
COMMIT;
:VERSION 46 #---------------- Dynamic attributes
BEGIN;
ALTER TABLE prims ADD COLUMN DynAttrs TEXT;
COMMIT;
:VERSION 47 #---------------- Extra physics params
BEGIN;
ALTER TABLE prims ADD COLUMN `PhysicsShapeType` tinyint(4) NOT NULL default '0';
ALTER TABLE prims ADD COLUMN `Density` double NOT NULL default '1000';
ALTER TABLE prims ADD COLUMN `GravityModifier` double NOT NULL default '1';
ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6';
ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5';
COMMIT;
:VERSION 48 #---------------- Keyframes
BEGIN;
ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob;
COMMIT;

View File

@@ -0,0 +1,47 @@
:VERSION 1 # -------------------------
BEGIN;
CREATE TABLE `UserAccounts` (
`PrincipalID` CHAR(36) NOT NULL,
`ScopeID` CHAR(36) NOT NULL,
`FirstName` VARCHAR(64) NOT NULL,
`LastName` VARCHAR(64) NOT NULL,
`Email` VARCHAR(64),
`ServiceURLs` TEXT,
`Created` INT(11)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
COMMIT;
:VERSION 2 # -------------------------
BEGIN;
INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, lastname AS LastName, email as Email, CONCAT('AssetServerURI=', userAssetURI, ' InventoryServerURI=', userInventoryURI, ' GatewayURI= HomeURI=') AS ServiceURLs, created as Created FROM users;
COMMIT;
:VERSION 3 # -------------------------
BEGIN;
CREATE UNIQUE INDEX PrincipalID ON UserAccounts(PrincipalID);
CREATE INDEX Email ON UserAccounts(Email);
CREATE INDEX FirstName ON UserAccounts(FirstName);
CREATE INDEX LastName ON UserAccounts(LastName);
CREATE INDEX Name ON UserAccounts(FirstName,LastName);
COMMIT;
:VERSION 4 # -------------------------
BEGIN;
ALTER TABLE UserAccounts ADD COLUMN UserLevel integer NOT NULL DEFAULT 0;
ALTER TABLE UserAccounts ADD COLUMN UserFlags integer NOT NULL DEFAULT 0;
ALTER TABLE UserAccounts ADD COLUMN UserTitle varchar(64) NOT NULL DEFAULT '';
COMMIT;

View File

@@ -0,0 +1,83 @@
:VERSION 1 # -------------------------------
begin;
CREATE TABLE IF NOT EXISTS `classifieds` (
`classifieduuid` char(36) NOT NULL,
`creatoruuid` char(36) NOT NULL,
`creationdate` int(20) NOT NULL,
`expirationdate` int(20) NOT NULL,
`category` varchar(20) NOT NULL,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`parceluuid` char(36) NOT NULL,
`parentestate` int(11) NOT NULL,
`snapshotuuid` char(36) NOT NULL,
`simname` varchar(255) NOT NULL,
`posglobal` varchar(255) NOT NULL,
`parcelname` varchar(255) NOT NULL,
`classifiedflags` int(8) NOT NULL,
`priceforlisting` int(5) NOT NULL,
PRIMARY KEY (`classifieduuid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `usernotes` (
`useruuid` varchar(36) NOT NULL,
`targetuuid` varchar(36) NOT NULL,
`notes` text NOT NULL,
UNIQUE KEY `useruuid` (`useruuid`,`targetuuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userpicks` (
`pickuuid` varchar(36) NOT NULL,
`creatoruuid` varchar(36) NOT NULL,
`toppick` enum('true','false') NOT NULL,
`parceluuid` varchar(36) NOT NULL,
`name` varchar(255) NOT NULL,
`description` text NOT NULL,
`snapshotuuid` varchar(36) NOT NULL,
`user` varchar(255) NOT NULL,
`originalname` varchar(255) NOT NULL,
`simname` varchar(255) NOT NULL,
`posglobal` varchar(255) NOT NULL,
`sortorder` int(2) NOT NULL,
`enabled` enum('true','false') NOT NULL,
PRIMARY KEY (`pickuuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `userprofile` (
`useruuid` varchar(36) NOT NULL,
`profilePartner` varchar(36) NOT NULL,
`profileAllowPublish` binary(1) NOT NULL,
`profileMaturePublish` binary(1) NOT NULL,
`profileURL` varchar(255) NOT NULL,
`profileWantToMask` int(3) NOT NULL,
`profileWantToText` text NOT NULL,
`profileSkillsMask` int(3) NOT NULL,
`profileSkillsText` text NOT NULL,
`profileLanguages` text NOT NULL,
`profileImage` varchar(36) NOT NULL,
`profileAboutText` text NOT NULL,
`profileFirstImage` varchar(36) NOT NULL,
`profileFirstText` text NOT NULL,
PRIMARY KEY (`useruuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
commit;
:VERSION 2 # -------------------------------
begin;
CREATE TABLE IF NOT EXISTS `userdata` (
`UserId` char(36) NOT NULL,
`TagId` varchar(64) NOT NULL,
`DataKey` varchar(255),
`DataVal` varchar(255),
PRIMARY KEY (`UserId`,`TagId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
commit;

View File

@@ -0,0 +1,168 @@
:VERSION 1 # -----------------------------
BEGIN;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for agents
-- ----------------------------
CREATE TABLE `agents` (
`UUID` varchar(36) NOT NULL,
`sessionID` varchar(36) NOT NULL,
`secureSessionID` varchar(36) NOT NULL,
`agentIP` varchar(16) NOT NULL,
`agentPort` int(11) NOT NULL,
`agentOnline` tinyint(4) NOT NULL,
`loginTime` int(11) NOT NULL,
`logoutTime` int(11) NOT NULL,
`currentRegion` varchar(36) NOT NULL,
`currentHandle` bigint(20) unsigned NOT NULL,
`currentPos` varchar(64) NOT NULL,
PRIMARY KEY (`UUID`),
UNIQUE KEY `session` (`sessionID`),
UNIQUE KEY `ssession` (`secureSessionID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Create schema avatar_appearance
--
CREATE TABLE `avatarappearance` (
Owner char(36) NOT NULL,
Serial int(10) unsigned NOT NULL,
Visual_Params blob NOT NULL,
Texture blob NOT NULL,
Avatar_Height float NOT NULL,
Body_Item char(36) NOT NULL,
Body_Asset char(36) NOT NULL,
Skin_Item char(36) NOT NULL,
Skin_Asset char(36) NOT NULL,
Hair_Item char(36) NOT NULL,
Hair_Asset char(36) NOT NULL,
Eyes_Item char(36) NOT NULL,
Eyes_Asset char(36) NOT NULL,
Shirt_Item char(36) NOT NULL,
Shirt_Asset char(36) NOT NULL,
Pants_Item char(36) NOT NULL,
Pants_Asset char(36) NOT NULL,
Shoes_Item char(36) NOT NULL,
Shoes_Asset char(36) NOT NULL,
Socks_Item char(36) NOT NULL,
Socks_Asset char(36) NOT NULL,
Jacket_Item char(36) NOT NULL,
Jacket_Asset char(36) NOT NULL,
Gloves_Item char(36) NOT NULL,
Gloves_Asset char(36) NOT NULL,
Undershirt_Item char(36) NOT NULL,
Undershirt_Asset char(36) NOT NULL,
Underpants_Item char(36) NOT NULL,
Underpants_Asset char(36) NOT NULL,
Skirt_Item char(36) NOT NULL,
Skirt_Asset char(36) NOT NULL,
PRIMARY KEY (`Owner`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for users
-- ----------------------------
CREATE TABLE `userfriends` (
`ownerID` VARCHAR(37) NOT NULL,
`friendID` VARCHAR(37) NOT NULL,
`friendPerms` INT NOT NULL,
`datetimestamp` INT NOT NULL,
UNIQUE KEY (`ownerID`, `friendID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for users
-- ----------------------------
CREATE TABLE `users` (
`UUID` varchar(36) NOT NULL default '',
`username` varchar(32) NOT NULL,
`lastname` varchar(32) NOT NULL,
`passwordHash` varchar(32) NOT NULL,
`passwordSalt` varchar(32) NOT NULL,
`homeRegion` bigint(20) unsigned default NULL,
`homeLocationX` float default NULL,
`homeLocationY` float default NULL,
`homeLocationZ` float default NULL,
`homeLookAtX` float default NULL,
`homeLookAtY` float default NULL,
`homeLookAtZ` float default NULL,
`created` int(11) NOT NULL,
`lastLogin` int(11) NOT NULL,
`userInventoryURI` varchar(255) default NULL,
`userAssetURI` varchar(255) default NULL,
`profileCanDoMask` int(10) unsigned default NULL,
`profileWantDoMask` int(10) unsigned default NULL,
`profileAboutText` text,
`profileFirstText` text,
`profileImage` varchar(36) default NULL,
`profileFirstImage` varchar(36) default NULL,
`webLoginKey` varchar(36) default NULL,
PRIMARY KEY (`UUID`),
UNIQUE KEY `usernames` (`username`,`lastname`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records
-- ----------------------------
COMMIT;
:VERSION 2 # -----------------------------
BEGIN;
ALTER TABLE users add homeRegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 3 # -----------------------------
BEGIN;
ALTER TABLE users add userFlags integer NOT NULL default 0;
ALTER TABLE users add godLevel integer NOT NULL default 0;
COMMIT;
:VERSION 4 # -----------------------------
BEGIN;
ALTER TABLE users add customType varchar(32) not null default '';
ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000';
COMMIT;
:VERSION 5 # -----------------------------
BEGIN;
CREATE TABLE `avatarattachments` (`UUID` char(36) NOT NULL, `attachpoint` int(11) NOT NULL, `item` char(36) NOT NULL, `asset` char(36) NOT NULL) ENGINE=InnoDB;
COMMIT;
:VERSION 6 # -----------------------------
BEGIN;
ALTER TABLE agents add currentLookAt varchar(36) not null default '';
COMMIT;
:VERSION 7 # -----------------------------
BEGIN;
ALTER TABLE users add email varchar(250);
COMMIT;
:VERSION 8 # -----------------------------
BEGIN;
ALTER TABLE users add scopeID char(36) not null default '00000000-0000-0000-0000-000000000000';
COMMIT;

View File

@@ -0,0 +1,27 @@
# -----------------
:VERSION 1
BEGIN;
CREATE TABLE `XAssetsMeta` (
`ID` char(36) NOT NULL,
`Hash` binary(32) NOT NULL,
`Name` varchar(64) NOT NULL,
`Description` varchar(64) NOT NULL,
`AssetType` tinyint(4) NOT NULL,
`Local` tinyint(1) NOT NULL,
`Temporary` tinyint(1) NOT NULL,
`CreateTime` int(11) NOT NULL,
`AccessTime` int(11) NOT NULL,
`AssetFlags` int(11) NOT NULL,
`CreatorID` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1';
CREATE TABLE `XAssetsData` (
`Hash` binary(32) NOT NULL,
`Data` longblob NOT NULL,
PRIMARY KEY (`hash`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Version 1';
COMMIT;

View File

@@ -0,0 +1,115 @@
:VERSION 1 # --------------------------
BEGIN;
CREATE TABLE `os_groups_groups` (
`GroupID` char(36) NOT NULL default '',
`Location` varchar(255) NOT NULL default '',
`Name` varchar(255) NOT NULL default '',
`Charter` text NOT NULL,
`InsigniaID` char(36) NOT NULL default '',
`FounderID` char(36) NOT NULL default '',
`MembershipFee` int(11) NOT NULL default '0',
`OpenEnrollment` varchar(255) NOT NULL default '',
`ShowInList` int(4) NOT NULL default '0',
`AllowPublish` int(4) NOT NULL default '0',
`MaturePublish` int(4) NOT NULL default '0',
`OwnerRoleID` char(36) NOT NULL default '',
PRIMARY KEY (`GroupID`),
UNIQUE KEY `Name` (`Name`),
FULLTEXT KEY `Name_2` (`Name`)
) ENGINE=MyISAM;
CREATE TABLE `os_groups_membership` (
`GroupID`char(36) NOT NULL default '',
`PrincipalID` VARCHAR(255) NOT NULL default '',
`SelectedRoleID` char(36) NOT NULL default '',
`Contribution` int(11) NOT NULL default '0',
`ListInProfile` int(4) NOT NULL default '1',
`AcceptNotices` int(4) NOT NULL default '1',
`AccessToken` char(36) NOT NULL default '',
PRIMARY KEY (`GroupID`,`PrincipalID`),
KEY `PrincipalID` (`PrincipalID`)
) ENGINE=MyISAM;
CREATE TABLE `os_groups_roles` (
`GroupID` char(36) NOT NULL default '',
`RoleID` char(36) NOT NULL default '',
`Name` varchar(255) NOT NULL default '',
`Description` varchar(255) NOT NULL default '',
`Title` varchar(255) NOT NULL default '',
`Powers` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`GroupID`,`RoleID`),
KEY `GroupID` (`GroupID`)
) ENGINE=MyISAM;
CREATE TABLE `os_groups_rolemembership` (
`GroupID` char(36) NOT NULL default '',
`RoleID` char(36) NOT NULL default '',
`PrincipalID` VARCHAR(255) NOT NULL default '',
PRIMARY KEY (`GroupID`,`RoleID`,`PrincipalID`),
KEY `PrincipalID` (`PrincipalID`)
) ENGINE=MyISAM;
CREATE TABLE `os_groups_invites` (
`InviteID` char(36) NOT NULL default '',
`GroupID` char(36) NOT NULL default '',
`RoleID` char(36) NOT NULL default '',
`PrincipalID` VARCHAR(255) NOT NULL default '',
`TMStamp` timestamp NOT NULL,
PRIMARY KEY (`InviteID`),
UNIQUE KEY `PrincipalGroup` (`GroupID`,`PrincipalID`)
) ENGINE=MyISAM;
CREATE TABLE `os_groups_notices` (
`GroupID` char(36) NOT NULL default '',
`NoticeID` char(36) NOT NULL default '',
`TMStamp` int(10) unsigned NOT NULL default '0',
`FromName` varchar(255) NOT NULL default '',
`Subject` varchar(255) NOT NULL default '',
`Message` text NOT NULL,
`HasAttachment` int(4) NOT NULL default '0',
`AttachmentType` int(4) NOT NULL default '0',
`AttachmentName` varchar(128) NOT NULL default '',
`AttachmentItemID` char(36) NOT NULL default '',
`AttachmentOwnerID` varchar(255) NOT NULL default '',
PRIMARY KEY (`NoticeID`),
KEY `GroupID` (`GroupID`),
KEY `TMStamp` (`TMStamp`)
) ENGINE=MyISAM;
CREATE TABLE `os_groups_principals` (
`PrincipalID` VARCHAR(255) NOT NULL default '',
`ActiveGroupID` char(36) NOT NULL default '',
PRIMARY KEY (`PrincipalID`)
) ENGINE=MyISAM;
COMMIT;
:VERSION 2 # --------------------------
BEGIN;
INSERT INTO `os_groups_groups` SELECT * from `diva_groups_groups`;
DROP TABLE `diva_groups_groups`;
INSERT INTO `os_groups_membership` SELECT * from `diva_groups_membership`;
DROP TABLE `diva_groups_membership`;
INSERT INTO `os_groups_roles` SELECT * from `diva_groups_roles`;
DROP TABLE `diva_groups_roles`;
INSERT INTO `os_groups_rolemembership` SELECT * from `diva_groups_rolemembership`;
DROP TABLE `diva_groups_rolemembership`;
INSERT INTO `os_groups_invites` SELECT * from `diva_groups_invites`;
DROP TABLE `diva_groups_invites`;
INSERT INTO `os_groups_notices` SELECT * from `diva_groups_notices`;
DROP TABLE `diva_groups_notices`;
INSERT INTO `os_groups_principals` SELECT * from `diva_groups_principals`;
DROP TABLE `diva_groups_principals`;
DELETE FROM `migrations` WHERE name='diva_im_Store';
COMMIT;

0
OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs Executable file → Normal file
View File

View File

0
OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs Executable file → Normal file
View File

View File

View File

0
OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs Executable file → Normal file
View File

0
OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs Executable file → Normal file
View File

0
OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs Executable file → Normal file
View File

View File

View File

0
OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs Executable file → Normal file
View File

View File

@@ -1,26 +1,26 @@
/*
* Copyright (c) Contributors, http://aurora-sim.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Aurora-Sim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) Contributors, http://aurora-sim.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Aurora-Sim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

0
bin/lib32/libopenjpeg-dotnet.so Executable file → Normal file
View File

0
bin/lib32/libsqlite3_32.so Executable file → Normal file
View File

Binary file not shown.

Binary file not shown.

0
bin/lib64/libopenjpeg-dotnet-x86_64.so Executable file → Normal file
View File

0
bin/lib64/libopenjpeg-dotnet.dylib Executable file → Normal file
View File

0
bin/lib64/libsqlite3.dylib Executable file → Normal file
View File

0
bin/lib64/libsqlite3_64.so Executable file → Normal file
View File

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

0
bin/pCampBot.exe.config Executable file → Normal file
View File

6
syncneb.bat Normal file
View File

@@ -0,0 +1,6 @@
rem git remote add upstream https://github.com/nebadon2025/opensimulator.git
git fetch upstream
git merge upstream/master