1
0
Fork 0
Manager/cron/regionChecker.php

26 lines
1.0 KiB
PHP

<?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']]);
}
}
?>