1
0
Fork 0
Manager/cron/checkInventar.php

42 lines
2.5 KiB
PHP
Raw Normal View History

2020-06-03 15:31:18 +00:00
<?php
$InventarObjektStatement = $RUNTIME['PDO']->prepare("SELECT * FROM inventoryitems ORDER BY avatarID ASC LIMIT 50000");
$InventarObjektStatement->execute();
while($InventarObjektRow = $InventarObjektStatement->fetch())
{
//echo "Check Inventory Item '".$InventarObjektRow['inventoryName']."' from '".$InventarObjektRow['avatarID']."'.\n";
$AssetMetaDataStatement = $RUNTIME['PDO']->prepare("SELECT * FROM fsassets WHERE id = ?");
$AssetMetaDataStatement->execute(array($InventarObjektRow['assetID']));
if($AssetMetaDataStatement->rowCount() == 0)
{
2020-06-08 19:13:20 +00:00
if($InventarObjektRow['assetType'] != '24')
2020-06-03 15:31:18 +00:00
{
2020-06-08 19:13:20 +00:00
if(!(left($InventarObjektRow['inventoryName'], 8) == '[DEFEKT]'))
{
$renameQuery = $RUNTIME['PDO']->prepare("UPDATE inventoryitems SET inventoryName = ? WHERE inventoryID = ? AND assetID = ?");
$renameQuery->execute(array(substr('[DEFEKT] '.$InventarObjektRow['inventoryName'], 0, 64), $InventarObjektRow['inventoryID'], $InventarObjektRow['assetID']));
echo "Found new missing asset for item '".$InventarObjektRow['inventoryName']."' from '".$RUNTIME['OPENSIM']->getUserName($InventarObjektRow['avatarID'])."'.\n";
sendInworldIM("00000000-0000-0000-0000-000000000000", $InventarObjektRow['avatarID'], "Inventory", $RUNTIME['GRID']['HOMEURL'], "WARNUNG: Die Assetdaten von einem deiner Inventarobjekte wurden nicht in der DB gefunden! Item Name: '".$InventarObjektRow['inventoryName']."'.");
}else{
echo "Found missing asset for item '".$InventarObjektRow['inventoryName']."' from '".$RUNTIME['OPENSIM']->getUserName($InventarObjektRow['avatarID'])."'.\n";
}
2020-06-03 15:31:18 +00:00
}else{
2020-06-08 19:13:20 +00:00
if((left($InventarObjektRow['inventoryName'], 8) == '[DEFEKT]'))
{
2020-06-08 19:17:52 +00:00
$newName = str_replace("[DEFEKT] ", "", $InventarObjektRow['inventoryName']);
$renameQuery = $RUNTIME['PDO']->prepare("UPDATE inventoryitems SET inventoryName = ? WHERE inventoryID = ? AND assetID = ?");
$renameQuery->execute(array(substr($newName, 0, 64), $InventarObjektRow['inventoryID'], $InventarObjektRow['assetID']));
echo " ==> Rename '".$InventarObjektRow['inventoryName']."' -> '".$newName."'\n";
2020-06-08 19:13:20 +00:00
}
2020-06-03 15:31:18 +00:00
}
}else{
2020-06-08 19:13:20 +00:00
//echo "Checking asset for item '".$InventarObjektRow['inventoryName']."' from '".$RUNTIME['OPENSIM']->getUserName($InventarObjektRow['avatarID'])."'.\n";
2020-06-03 15:31:18 +00:00
}
}
?>