aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-05-09 17:02:22 +0100
committerMelanie2010-05-09 17:02:22 +0100
commit9b22393cf308507dc751704c8b0d3e65ac1d4323 (patch)
tree4e7605aa485d79bb429ca5965fd6415bb53cb635 /OpenSim
parent* Added missing loggout notification to home grid upon agents logging out in ... (diff)
downloadopensim-SC_OLD-9b22393cf308507dc751704c8b0d3e65ac1d4323.zip
opensim-SC_OLD-9b22393cf308507dc751704c8b0d3e65ac1d4323.tar.gz
opensim-SC_OLD-9b22393cf308507dc751704c8b0d3e65ac1d4323.tar.bz2
opensim-SC_OLD-9b22393cf308507dc751704c8b0d3e65ac1d4323.tar.xz
Add a field asset_flags and a corresponding enum to the asset database. This
CHANGES THE ASSET SERVER PROTOCOL and means you CAN NOT MIX PRIOR VERSIONS WITH LATER ONES. It may also eat your babies, yada, yada, yada. The usual cautions for migrations to the assets table apply. Coding: Can not guarantee nut free.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs8
-rw-r--r--OpenSim/Data/MySQL/Resources/007_AssetStore.sql5
-rw-r--r--OpenSim/Framework/AssetBase.cs22
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs1
4 files changed, 33 insertions, 3 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index d55369a..5a2af4f 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -161,8 +161,8 @@ namespace OpenSim.Data.MySQL
161 161
162 MySqlCommand cmd = 162 MySqlCommand cmd =
163 new MySqlCommand( 163 new MySqlCommand(
164 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" + 164 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, data)" +
165 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)", 165 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?data)",
166 dbcon); 166 dbcon);
167 167
168 string assetName = asset.Name; 168 string assetName = asset.Name;
@@ -194,6 +194,7 @@ namespace OpenSim.Data.MySQL
194 cmd.Parameters.AddWithValue("?temporary", asset.Temporary); 194 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
195 cmd.Parameters.AddWithValue("?create_time", now); 195 cmd.Parameters.AddWithValue("?create_time", now);
196 cmd.Parameters.AddWithValue("?access_time", now); 196 cmd.Parameters.AddWithValue("?access_time", now);
197 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
197 cmd.Parameters.AddWithValue("?data", asset.Data); 198 cmd.Parameters.AddWithValue("?data", asset.Data);
198 cmd.ExecuteNonQuery(); 199 cmd.ExecuteNonQuery();
199 cmd.Dispose(); 200 cmd.Dispose();
@@ -302,7 +303,7 @@ namespace OpenSim.Data.MySQL
302 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 303 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
303 { 304 {
304 dbcon.Open(); 305 dbcon.Open();
305 MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id FROM assets LIMIT ?start, ?count", dbcon); 306 MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags FROM assets LIMIT ?start, ?count", dbcon);
306 cmd.Parameters.AddWithValue("?start", start); 307 cmd.Parameters.AddWithValue("?start", start);
307 cmd.Parameters.AddWithValue("?count", count); 308 cmd.Parameters.AddWithValue("?count", count);
308 309
@@ -317,6 +318,7 @@ namespace OpenSim.Data.MySQL
317 metadata.Description = (string)dbReader["description"]; 318 metadata.Description = (string)dbReader["description"];
318 metadata.Type = (sbyte)dbReader["assetType"]; 319 metadata.Type = (sbyte)dbReader["assetType"];
319 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. 320 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
321 metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
320 metadata.FullID = new UUID((string)dbReader["id"]); 322 metadata.FullID = new UUID((string)dbReader["id"]);
321 323
322 // Current SHA1s are not stored/computed. 324 // Current SHA1s are not stored/computed.
diff --git a/OpenSim/Data/MySQL/Resources/007_AssetStore.sql b/OpenSim/Data/MySQL/Resources/007_AssetStore.sql
new file mode 100644
index 0000000..f06121a
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/007_AssetStore.sql
@@ -0,0 +1,5 @@
1BEGIN;
2
3ALTER TABLE assets ADD COLUMN asset_flags INTEGER NOT NULL DEFAULT 0;
4
5COMMIT;
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 19ca232..7ecf198 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -33,6 +33,15 @@ using OpenMetaverse;
33 33
34namespace OpenSim.Framework 34namespace OpenSim.Framework
35{ 35{
36 [Flags]
37 public enum AssetFlags : int
38 {
39 Normal = 0,
40 Maptile = 1,
41 Rewritable = 2,
42 Collectable = 4
43 }
44
36 /// <summary> 45 /// <summary>
37 /// Asset class. All Assets are reference by this class or a class derived from this class 46 /// Asset class. All Assets are reference by this class or a class derived from this class
38 /// </summary> 47 /// </summary>
@@ -206,6 +215,12 @@ namespace OpenSim.Framework
206 set { m_metadata.Temporary = value; } 215 set { m_metadata.Temporary = value; }
207 } 216 }
208 217
218 public AssetFlags Flags
219 {
220 get { return m_metadata.Flags; }
221 set { m_metadata.Flags = value; }
222 }
223
209 [XmlIgnore] 224 [XmlIgnore]
210 public AssetMetadata Metadata 225 public AssetMetadata Metadata
211 { 226 {
@@ -233,6 +248,7 @@ namespace OpenSim.Framework
233 private bool m_local; 248 private bool m_local;
234 private bool m_temporary; 249 private bool m_temporary;
235 private string m_creatorid; 250 private string m_creatorid;
251 private AssetFlags m_flags;
236 252
237 public UUID FullID 253 public UUID FullID
238 { 254 {
@@ -330,5 +346,11 @@ namespace OpenSim.Framework
330 get { return m_creatorid; } 346 get { return m_creatorid; }
331 set { m_creatorid = value; } 347 set { m_creatorid = value; }
332 } 348 }
349
350 public AssetFlags Flags
351 {
352 get { return m_flags; }
353 set { m_flags = value; }
354 }
333 } 355 }
334} 356}
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 4e512e7..2114933 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -181,6 +181,7 @@ namespace OpenSim.Services.AssetService
181 MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description)); 181 MainConsole.Instance.Output(String.Format("Description: {0}", asset.Description));
182 MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type)); 182 MainConsole.Instance.Output(String.Format("Type: {0}", asset.Type));
183 MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType)); 183 MainConsole.Instance.Output(String.Format("Content-type: {0}", asset.Metadata.ContentType));
184 MainConsole.Instance.Output(String.Format("Flags: {0}", asset.Metadata.Flags.ToString()));
184 185
185 for (i = 0 ; i < 5 ; i++) 186 for (i = 0 ; i < 5 ; i++)
186 { 187 {