use sql
parent
4174e202f3
commit
20353e1a0a
|
@ -1,42 +1,21 @@
|
|||
<?php
|
||||
$InventarObjektStatement = $RUNTIME['PDO']->prepare("SELECT * FROM inventoryitems ORDER BY avatarID ASC");
|
||||
$InventarObjektStatement->execute();
|
||||
$InventarCheckStatement = $RUNTIME['PDO']->prepare("UPDATE inventoryitems i SET
|
||||
i.inventoryName = concat('[DEFEKT] ', i.inventoryName)
|
||||
WHERE
|
||||
i.assetID IN (
|
||||
SELECT
|
||||
i.assetID
|
||||
FROM inventoryitems i
|
||||
WHERE
|
||||
NOT EXISTS( SELECT *
|
||||
FROM fsassets fs
|
||||
WHERE
|
||||
fs.id = i.assetID
|
||||
)
|
||||
AND NOT i.inventoryName LIKE '[DEFEKT] %'
|
||||
AND i.assetType <> 24
|
||||
)");
|
||||
|
||||
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)
|
||||
{
|
||||
if($InventarObjektRow['assetType'] != '24')
|
||||
{
|
||||
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, 55), $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";
|
||||
}
|
||||
}else{
|
||||
if((left($InventarObjektRow['inventoryName'], 8) == '[DEFEKT]'))
|
||||
{
|
||||
$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";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//echo "Checking asset for item '".$InventarObjektRow['inventoryName']."' from '".$RUNTIME['OPENSIM']->getUserName($InventarObjektRow['avatarID'])."'.\n";
|
||||
}
|
||||
}
|
||||
$InventarCheckStatement->execute();
|
||||
|
||||
?>
|
Loading…
Reference in New Issue