[FIRE-31674] [OPENSIM] Skip validatiion of suitcase and its contents

meow-7.2.2
Beq 2022-05-25 00:17:30 +01:00
parent 67aa3bd9ac
commit 883890e3fb
2 changed files with 66 additions and 1 deletions

View File

@ -398,7 +398,50 @@ LLInventoryModel::EAnscestorResult LLInventoryModel::getObjectTopmostAncestor(co
result = object->getUUID();
return ANSCESTOR_OK;
}
// <FS:Beq> [OPENSIM] FIRE-31674 Exclude suitcase and descendents from validation when in OpenSim
#ifdef OPENSIM
bool LLInventoryModel::isInSuitcase(const LLInventoryCategory * cat) const
{
if(LLGridManager::getInstance()->isInSecondLife())
{
return false;
}
if (!cat)
{
LL_WARNS(LOG_INV) << "Unable to trace parentage of null cat " << LL_ENDL;
return false;
}
auto cat_id = cat->getUUID();
std::set<LLUUID> cat_ids{ cat_id }; // loop protection
if(cat->getPreferredType() == LLFolderType::FT_MY_SUITCASE)
return true;
while (cat->getParentUUID().notNull())
{
LLUUID parent_id = cat->getParentUUID();
if (cat_ids.find(parent_id) != cat_ids.end())
{
LL_WARNS(LOG_INV) << "Detected a loop on a cat " << parent_id << " when searching for ancestor of " << cat_id << LL_ENDL;
return false;
}
cat_ids.insert(parent_id);
auto parent_cat = getCategory(parent_id);
if (!parent_cat)
{
LL_WARNS(LOG_INV) << "unable to trace parentage of " << cat_id << ", missing item for uuid " << parent_id << LL_ENDL;
return false;
}
LL_DEBUGS(LOG_INV) << "Parent folder is " << parent_cat->getName() << "; Folder type " << parent_cat->getPreferredType() << LL_ENDL;
if(parent_cat->getPreferredType() == LLFolderType::FT_MY_SUITCASE)
{
return true;
}
cat = parent_cat;
cat_id = cat->getUUID();
}
return false;
}
#endif
// Get the object by id. Returns NULL if not found.
LLInventoryObject* LLInventoryModel::getObject(const LLUUID& id) const
{
@ -4474,6 +4517,15 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const
warnings++;
}
}
// <FS:Beq> FIRE-31674 Suitcase contents do not need checking.
#ifdef OPENSIM
if (isInSuitcase(cat))
{
LL_DEBUGS("Inventory") << "cat " << cat->getName() << " skipped because it is a child of Suitcase" << LL_ENDL;
continue;
}
#endif
// </FS:Beq>
cat_array_t* cats;
item_array_t* items;
getDirectDescendentsOf(cat_id,cats,items);
@ -4621,6 +4673,15 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const
}
if (!cat_is_in_library)
{
// <FS:Beq> FIRE-31674 [OPENSIM] don't count things underneath suitcase
#ifdef OPENSIM
if ( isInSuitcase(cat) )
{
LL_DEBUGS("Inventory") << "Under suitcase cat: " << getFullPath(cat) << " folder_type " << folder_type << LL_ENDL;
}
else
#endif
// </FS:Beq>
if (getRootFolderID().notNull() && (cat->getUUID()==getRootFolderID() || cat->getParentUUID()==getRootFolderID()))
{
ft_counts_under_root[folder_type]++;

View File

@ -312,7 +312,11 @@ public:
};
// Follow parent chain to the top.
EAnscestorResult getObjectTopmostAncestor(const LLUUID& object_id, LLUUID& result) const;
// <FS:Beq> FIRE-31674 ignore suitcase contents
#ifdef OPENSIM
bool isInSuitcase(const LLInventoryCategory * cat) const;
#endif
// </FS:Beq>
// <FS:Ansariel> Re-added because of start folder id
// Collect all items in inventory that are linked to item_id.
// Assumes item_id is itself not a linked item.