Change way version numbering is handled

This commit is contained in:
zontreck 2024-05-16 22:49:22 -07:00
parent 15d03e8402
commit 0ea9ae9936
2 changed files with 19 additions and 2 deletions

View file

@ -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"),

View file

@ -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'");
}
}
}