1
0
Fork 0

add region checker cron

master
Chris 2021-01-08 13:36:55 +01:00
parent ca9bb849a0
commit 4e889de090
1 changed files with 26 additions and 0 deletions

26
cron/regionChecker.php Normal file
View File

@ -0,0 +1,26 @@
<?php
$statement = $RUNTIME['PDO']->prepare("SELECT * FROM regions");
$statement->execute();
ini_set('default_socket_timeout', 3);
$ctx = stream_context_create(array('http'=>
array(
'timeout' => 3, //1200 Seconds is 20 Minutes
)
));
while($row = $statement->fetch())
{
$result = @file_get_contents($row['serverURI']."jsonSimStats", false, $ctx);
if($result == FALSE || $result == "")
{
sendInworldIM("00000000-0000-0000-0000-000000000000", $row['owner_uuid'], "Inventory", $RUNTIME['GRID']['HOMEURL'], "WARNUNG: Deine Region '".$row['regionName']."' ist nicht erreichbar und wurde deshalb aus dem Grid entfernt.");
echo "Die Region ".$row['regionName']." von ".$RUNTIME['OPENSIM']->getUserName($row['owner_uuid'])." ist nicht erreichbar.\n";
$statementUpdate = $RUNTIME['PDO']->prepare('DELETE FROM regions WHERE uuid = :uuid');
$statementUpdate->execute(['uuid' => $row['uuid']]);
}
}
?>