MySQLInventoryData.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. *
  27. */
  28. using System;
  29. using System.Collections.Generic;
  30. using libsecondlife;
  31. using MySql.Data.MySqlClient;
  32. using OpenSim.Framework.Console;
  33. namespace OpenSim.Framework.Data.MySQL
  34. {
  35. /// <summary>
  36. /// A MySQL interface for the inventory server
  37. /// </summary>
  38. public class MySQLInventoryData : IInventoryData
  39. {
  40. /// <summary>
  41. /// The database manager
  42. /// </summary>
  43. private MySQLManager database;
  44. /// <summary>
  45. /// Loads and initialises this database plugin
  46. /// </summary>
  47. public void Initialise()
  48. {
  49. IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
  50. string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
  51. string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
  52. string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
  53. string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
  54. string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
  55. string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
  56. database =
  57. new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
  58. settingPort);
  59. TestTables(database.Connection);
  60. }
  61. #region Test and initialization code
  62. private void UpgradeFoldersTable(string oldVersion)
  63. {
  64. // null as the version, indicates that the table didn't exist
  65. if (oldVersion == null)
  66. {
  67. database.ExecuteResourceSql("CreateFoldersTable.sql");
  68. return;
  69. }
  70. // if the table is already at the current version, then we can exit immediately
  71. // if (oldVersion == "Rev. 2")
  72. // return;
  73. // database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
  74. }
  75. private void UpgradeItemsTable(string oldVersion)
  76. {
  77. // null as the version, indicates that the table didn't exist
  78. if (oldVersion == null)
  79. {
  80. database.ExecuteResourceSql("CreateItemsTable.sql");
  81. return;
  82. }
  83. // if the table is already at the current version, then we can exit immediately
  84. // if (oldVersion == "Rev. 2")
  85. // return;
  86. // database.ExecuteResourceSql("UpgradeItemsTableToVersion2.sql");
  87. }
  88. private void TestTables(MySqlConnection conn)
  89. {
  90. Dictionary<string, string> tableList = new Dictionary<string, string>();
  91. tableList["inventoryfolders"] = null;
  92. tableList["inventoryitems"] = null;
  93. database.GetTableVersion(tableList);
  94. MainLog.Instance.Verbose("MYSQL", "Inventory Folder Version: " + tableList["inventoryfolders"]);
  95. MainLog.Instance.Verbose("MYSQL", "Inventory Items Version: " + tableList["inventoryitems"]);
  96. UpgradeFoldersTable(tableList["inventoryfolders"]);
  97. UpgradeItemsTable(tableList["inventoryitems"]);
  98. }
  99. #endregion
  100. /// <summary>
  101. /// The name of this DB provider
  102. /// </summary>
  103. /// <returns>Name of DB provider</returns>
  104. public string getName()
  105. {
  106. return "MySQL Inventory Data Interface";
  107. }
  108. /// <summary>
  109. /// Closes this DB provider
  110. /// </summary>
  111. public void Close()
  112. {
  113. // Do nothing.
  114. }
  115. /// <summary>
  116. /// Returns the version of this DB provider
  117. /// </summary>
  118. /// <returns>A string containing the DB provider</returns>
  119. public string getVersion()
  120. {
  121. return database.getVersion();
  122. }
  123. /// <summary>
  124. /// Returns a list of items in a specified folder
  125. /// </summary>
  126. /// <param name="folderID">The folder to search</param>
  127. /// <returns>A list containing inventory items</returns>
  128. public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
  129. {
  130. try
  131. {
  132. lock (database)
  133. {
  134. List<InventoryItemBase> items = new List<InventoryItemBase>();
  135. MySqlCommand result =
  136. new MySqlCommand("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid",
  137. database.Connection);
  138. result.Parameters.AddWithValue("?uuid", folderID.ToString());
  139. MySqlDataReader reader = result.ExecuteReader();
  140. while (reader.Read())
  141. items.Add(readInventoryItem(reader));
  142. reader.Close();
  143. result.Dispose();
  144. return items;
  145. }
  146. }
  147. catch (Exception e)
  148. {
  149. database.Reconnect();
  150. MainLog.Instance.Error(e.ToString());
  151. return null;
  152. }
  153. }
  154. /// <summary>
  155. /// Returns a list of the root folders within a users inventory
  156. /// </summary>
  157. /// <param name="user">The user whos inventory is to be searched</param>
  158. /// <returns>A list of folder objects</returns>
  159. public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
  160. {
  161. try
  162. {
  163. lock (database)
  164. {
  165. MySqlCommand result =
  166. new MySqlCommand(
  167. "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
  168. database.Connection);
  169. result.Parameters.AddWithValue("?uuid", user.ToString());
  170. result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToString());
  171. MySqlDataReader reader = result.ExecuteReader();
  172. List<InventoryFolderBase> items = new List<InventoryFolderBase>();
  173. while (reader.Read())
  174. items.Add(readInventoryFolder(reader));
  175. reader.Close();
  176. result.Dispose();
  177. return items;
  178. }
  179. }
  180. catch (Exception e)
  181. {
  182. database.Reconnect();
  183. MainLog.Instance.Error(e.ToString());
  184. return null;
  185. }
  186. }
  187. // see InventoryItemBase.getUserRootFolder
  188. public InventoryFolderBase getUserRootFolder(LLUUID user)
  189. {
  190. try
  191. {
  192. lock (database)
  193. {
  194. MySqlCommand result =
  195. new MySqlCommand(
  196. "SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid",
  197. database.Connection);
  198. result.Parameters.AddWithValue("?uuid", user.ToString());
  199. result.Parameters.AddWithValue("?zero", LLUUID.Zero.ToString());
  200. MySqlDataReader reader = result.ExecuteReader();
  201. List<InventoryFolderBase> items = new List<InventoryFolderBase>();
  202. while (reader.Read())
  203. items.Add(readInventoryFolder(reader));
  204. InventoryFolderBase rootFolder = null;
  205. // There should only ever be one root folder for a user. However, if there's more
  206. // than one we'll simply use the first one rather than failing. It would be even
  207. // nicer to print some message to this effect, but this feels like it's too low a
  208. // to put such a message out, and it's too minor right now to spare the time to
  209. // suitably refactor.
  210. if (items.Count > 0)
  211. {
  212. rootFolder = items[0];
  213. }
  214. reader.Close();
  215. result.Dispose();
  216. return rootFolder;
  217. }
  218. }
  219. catch (Exception e)
  220. {
  221. database.Reconnect();
  222. MainLog.Instance.Error(e.ToString());
  223. return null;
  224. }
  225. }
  226. /// <summary>
  227. /// Return a list of folders in a users inventory contained within the specified folder.
  228. /// This method is only used in tests - in normal operation the user always have one,
  229. /// and only one, root folder.
  230. /// </summary>
  231. /// <param name="parentID">The folder to search</param>
  232. /// <returns>A list of inventory folders</returns>
  233. public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
  234. {
  235. try
  236. {
  237. lock (database)
  238. {
  239. MySqlCommand result =
  240. new MySqlCommand("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid",
  241. database.Connection);
  242. result.Parameters.AddWithValue("?uuid", parentID.ToString());
  243. MySqlDataReader reader = result.ExecuteReader();
  244. List<InventoryFolderBase> items = new List<InventoryFolderBase>();
  245. while (reader.Read())
  246. items.Add(readInventoryFolder(reader));
  247. reader.Close();
  248. result.Dispose();
  249. return items;
  250. }
  251. }
  252. catch (Exception e)
  253. {
  254. database.Reconnect();
  255. MainLog.Instance.Error(e.ToString());
  256. return null;
  257. }
  258. }
  259. /// <summary>
  260. /// Reads a one item from an SQL result
  261. /// </summary>
  262. /// <param name="reader">The SQL Result</param>
  263. /// <returns>the item read</returns>
  264. private InventoryItemBase readInventoryItem(MySqlDataReader reader)
  265. {
  266. try
  267. {
  268. InventoryItemBase item = new InventoryItemBase();
  269. item.inventoryID = new LLUUID((string) reader["inventoryID"]);
  270. item.assetID = new LLUUID((string) reader["assetID"]);
  271. item.assetType = (int) reader["assetType"];
  272. item.parentFolderID = new LLUUID((string) reader["parentFolderID"]);
  273. item.avatarID = new LLUUID((string) reader["avatarID"]);
  274. item.inventoryName = (string) reader["inventoryName"];
  275. item.inventoryDescription = (string) reader["inventoryDescription"];
  276. item.inventoryNextPermissions = (uint) reader["inventoryNextPermissions"];
  277. item.inventoryCurrentPermissions = (uint) reader["inventoryCurrentPermissions"];
  278. item.invType = (int) reader["invType"];
  279. item.creatorsID = new LLUUID((string) reader["creatorID"]);
  280. item.inventoryBasePermissions = (uint) reader["inventoryBasePermissions"];
  281. item.inventoryEveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
  282. return item;
  283. }
  284. catch (MySqlException e)
  285. {
  286. MainLog.Instance.Error(e.ToString());
  287. }
  288. return null;
  289. }
  290. /// <summary>
  291. /// Returns a specified inventory item
  292. /// </summary>
  293. /// <param name="item">The item to return</param>
  294. /// <returns>An inventory item</returns>
  295. public InventoryItemBase getInventoryItem(LLUUID itemID)
  296. {
  297. try
  298. {
  299. lock (database)
  300. {
  301. Dictionary<string, string> param = new Dictionary<string, string>();
  302. MySqlCommand result =
  303. new MySqlCommand("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", database.Connection);
  304. result.Parameters.AddWithValue("?uuid", itemID.ToString());
  305. MySqlDataReader reader = result.ExecuteReader();
  306. InventoryItemBase item = null;
  307. if (reader.Read())
  308. item = readInventoryItem(reader);
  309. reader.Close();
  310. result.Dispose();
  311. return item;
  312. }
  313. }
  314. catch (Exception e)
  315. {
  316. database.Reconnect();
  317. MainLog.Instance.Error(e.ToString());
  318. }
  319. return null;
  320. }
  321. /// <summary>
  322. /// Reads a list of inventory folders returned by a query.
  323. /// </summary>
  324. /// <param name="reader">A MySQL Data Reader</param>
  325. /// <returns>A List containing inventory folders</returns>
  326. protected InventoryFolderBase readInventoryFolder(MySqlDataReader reader)
  327. {
  328. try
  329. {
  330. InventoryFolderBase folder = new InventoryFolderBase();
  331. folder.agentID = new LLUUID((string) reader["agentID"]);
  332. folder.parentID = new LLUUID((string) reader["parentFolderID"]);
  333. folder.folderID = new LLUUID((string) reader["folderID"]);
  334. folder.name = (string) reader["folderName"];
  335. folder.type = (short) reader["type"];
  336. folder.version = (ushort) ((int) reader["version"]);
  337. return folder;
  338. }
  339. catch (Exception e)
  340. {
  341. MainLog.Instance.Error(e.ToString());
  342. }
  343. return null;
  344. }
  345. /// <summary>
  346. /// Returns a specified inventory folder
  347. /// </summary>
  348. /// <param name="folder">The folder to return</param>
  349. /// <returns>A folder class</returns>
  350. public InventoryFolderBase getInventoryFolder(LLUUID folderID)
  351. {
  352. try
  353. {
  354. lock (database)
  355. {
  356. MySqlCommand result =
  357. new MySqlCommand("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", database.Connection);
  358. result.Parameters.AddWithValue("?uuid", folderID.ToString());
  359. MySqlDataReader reader = result.ExecuteReader();
  360. reader.Read();
  361. InventoryFolderBase folder = readInventoryFolder(reader);
  362. reader.Close();
  363. result.Dispose();
  364. return folder;
  365. }
  366. }
  367. catch (Exception e)
  368. {
  369. database.Reconnect();
  370. MainLog.Instance.Error(e.ToString());
  371. return null;
  372. }
  373. }
  374. /// <summary>
  375. /// Adds a specified item to the database
  376. /// </summary>
  377. /// <param name="item">The inventory item</param>
  378. public void addInventoryItem(InventoryItemBase item)
  379. {
  380. string sql =
  381. "REPLACE INTO inventoryitems (inventoryID, assetID, assetType, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions) VALUES ";
  382. sql +=
  383. "(?inventoryID, ?assetID, ?assetType, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions, ?invType, ?creatorID, ?inventoryBasePermissions, ?inventoryEveryOnePermissions)";
  384. try
  385. {
  386. MySqlCommand result = new MySqlCommand(sql, database.Connection);
  387. result.Parameters.AddWithValue("?inventoryID", item.inventoryID.ToString());
  388. result.Parameters.AddWithValue("?assetID", item.assetID.ToString());
  389. result.Parameters.AddWithValue("?assetType", item.assetType.ToString());
  390. result.Parameters.AddWithValue("?parentFolderID", item.parentFolderID.ToString());
  391. result.Parameters.AddWithValue("?avatarID", item.avatarID.ToString());
  392. result.Parameters.AddWithValue("?inventoryName", item.inventoryName);
  393. result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription);
  394. result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString());
  395. result.Parameters.AddWithValue("?inventoryCurrentPermissions",
  396. item.inventoryCurrentPermissions.ToString());
  397. result.Parameters.AddWithValue("?invType", item.invType);
  398. result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToString());
  399. result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions);
  400. result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.inventoryEveryOnePermissions);
  401. result.ExecuteNonQuery();
  402. result.Dispose();
  403. }
  404. catch (MySqlException e)
  405. {
  406. MainLog.Instance.Error(e.ToString());
  407. }
  408. }
  409. /// <summary>
  410. /// Updates the specified inventory item
  411. /// </summary>
  412. /// <param name="item">Inventory item to update</param>
  413. public void updateInventoryItem(InventoryItemBase item)
  414. {
  415. addInventoryItem(item);
  416. }
  417. /// <summary>
  418. ///
  419. /// </summary>
  420. /// <param name="item"></param>
  421. public void deleteInventoryItem(LLUUID itemID)
  422. {
  423. try
  424. {
  425. MySqlCommand cmd =
  426. new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection);
  427. cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
  428. cmd.ExecuteNonQuery();
  429. }
  430. catch (MySqlException e)
  431. {
  432. database.Reconnect();
  433. MainLog.Instance.Error(e.ToString());
  434. }
  435. }
  436. /// <summary>
  437. /// Creates a new inventory folder
  438. /// </summary>
  439. /// <param name="folder">Folder to create</param>
  440. public void addInventoryFolder(InventoryFolderBase folder)
  441. {
  442. string sql =
  443. "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES ";
  444. sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)";
  445. MySqlCommand cmd = new MySqlCommand(sql, database.Connection);
  446. cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString());
  447. cmd.Parameters.AddWithValue("?agentID", folder.agentID.ToString());
  448. cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString());
  449. cmd.Parameters.AddWithValue("?folderName", folder.name);
  450. cmd.Parameters.AddWithValue("?type", (short) folder.type);
  451. cmd.Parameters.AddWithValue("?version", folder.version);
  452. try
  453. {
  454. cmd.ExecuteNonQuery();
  455. }
  456. catch (Exception e)
  457. {
  458. MainLog.Instance.Error(e.ToString());
  459. }
  460. }
  461. /// <summary>
  462. /// Updates an inventory folder
  463. /// </summary>
  464. /// <param name="folder">Folder to update</param>
  465. public void updateInventoryFolder(InventoryFolderBase folder)
  466. {
  467. addInventoryFolder(folder);
  468. }
  469. /// Creates a new inventory folder
  470. /// </summary>
  471. /// <param name="folder">Folder to create</param>
  472. public void moveInventoryFolder(InventoryFolderBase folder)
  473. {
  474. string sql =
  475. "UPDATE inventoryfolders SET parentFolderID=?parentFolderID WHERE folderID=?folderID";
  476. MySqlCommand cmd = new MySqlCommand(sql, database.Connection);
  477. cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString());
  478. cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString());
  479. try
  480. {
  481. cmd.ExecuteNonQuery();
  482. }
  483. catch (Exception e)
  484. {
  485. MainLog.Instance.Error(e.ToString());
  486. }
  487. }
  488. /// <summary>
  489. /// Append a list of all the child folders of a parent folder
  490. /// </summary>
  491. /// <param name="folders">list where folders will be appended</param>
  492. /// <param name="parentID">ID of parent</param>
  493. protected void getInventoryFolders(ref List<InventoryFolderBase> folders, LLUUID parentID)
  494. {
  495. List<InventoryFolderBase> subfolderList = getInventoryFolders(parentID);
  496. foreach (InventoryFolderBase f in subfolderList)
  497. folders.Add(f);
  498. }
  499. /// <summary>
  500. /// Returns all child folders in the hierarchy from the parent folder and down
  501. /// </summary>
  502. /// <param name="parentID">The folder to get subfolders for</param>
  503. /// <returns>A list of inventory folders</returns>
  504. protected List<InventoryFolderBase> getFolderHierarchy(LLUUID parentID)
  505. {
  506. List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
  507. getInventoryFolders(ref folders, parentID);
  508. for (int i = 0; i < folders.Count; i++)
  509. getInventoryFolders(ref folders, folders[i].folderID);
  510. return folders;
  511. }
  512. protected void deleteOneFolder(LLUUID folderID)
  513. {
  514. try
  515. {
  516. MySqlCommand cmd =
  517. new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection);
  518. cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
  519. cmd.ExecuteNonQuery();
  520. }
  521. catch (MySqlException e)
  522. {
  523. database.Reconnect();
  524. MainLog.Instance.Error(e.ToString());
  525. }
  526. }
  527. protected void deleteItemsInFolder(LLUUID folderID)
  528. {
  529. try
  530. {
  531. MySqlCommand cmd =
  532. new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection);
  533. cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
  534. cmd.ExecuteNonQuery();
  535. }
  536. catch (MySqlException e)
  537. {
  538. database.Reconnect();
  539. MainLog.Instance.Error(e.ToString());
  540. }
  541. }
  542. /// <summary>
  543. /// Delete an inventory folder
  544. /// </summary>
  545. /// <param name="folderId">Id of folder to delete</param>
  546. public void deleteInventoryFolder(LLUUID folderID)
  547. {
  548. lock (database)
  549. {
  550. List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
  551. //Delete all sub-folders
  552. foreach (InventoryFolderBase f in subFolders)
  553. {
  554. deleteOneFolder(f.folderID);
  555. deleteItemsInFolder(f.folderID);
  556. }
  557. //Delete the actual row
  558. deleteOneFolder(folderID);
  559. deleteItemsInFolder(folderID);
  560. }
  561. }
  562. }
  563. }