From 0ea9ae9936f3e53402d60d9723405b4d083da3a1 Mon Sep 17 00:00:00 2001 From: zontreck Date: Thu, 16 May 2024 22:49:22 -0700 Subject: [PATCH] Change way version numbering is handled --- lib/pages/opensim/Inventory.dart | 6 +++++- php/MakeFolder.php | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/pages/opensim/Inventory.dart b/lib/pages/opensim/Inventory.dart index 189cbd0..b581478 100644 --- a/lib/pages/opensim/Inventory.dart +++ b/lib/pages/opensim/Inventory.dart @@ -7,13 +7,17 @@ import 'package:zontreck/Packets.dart'; import 'package:zontreck/Settings.dart'; enum InventoryFolder { + ROOT( + id: 8, + name: + "My Inventory"), // This needs to be first despite ID, due to the way we are incrementing the revision number. + Texture(id: 0, name: "Textures"), Sound(id: 1, name: "Sounds"), CallingCard(id: 2, name: "Calling Cards"), Landmark(id: 3, name: "Landmarks"), Clothing(id: 5, name: "Clothing"), Objects(id: 6, name: "Objects"), - ROOT(id: 8, name: "My Inventory"), Scripts(id: 10, name: "Scripts"), BodyParts(id: 13, name: "Body Parts"), Trash(id: 14, name: "Trash"), diff --git a/php/MakeFolder.php b/php/MakeFolder.php index fc1f264..4281f60 100644 --- a/php/MakeFolder.php +++ b/php/MakeFolder.php @@ -18,9 +18,22 @@ if($clientKey == md5(CLIENTPSK)) { $owner = $js['owner']; $id = $js['id']; - $res = $DB->query("INSERT INTO `inventoryfolders` (folderName, type, version, folderID, agentID, parentFolderID ) VALUES ('$name', '$type', 0, '$id', '$owner', '$parent');"); + $res = $DB->query("INSERT INTO `inventoryfolders` (folderName, type, version, folderID, agentID, parentFolderID ) VALUES ('$name', '$type', 1, '$id', '$owner', '$parent');"); if(!$res) $complete=false; + else { + // Let's bump the parent folder version number now + $pfres = $DB->query("SELECT * FROM `inventoryfolders` WHERE folderID='$parent'"); + if($pfres){ + // The parent folder is valid. + $row = $pfres->fetch_assoc(); + $parentVersion = $row['version']; + $parentVersion++; + + $DB->query("UPDATE `inventoryfolders` SET `version` = '$parentVersion' WHERE folderID='$parent'"); + + } + } }