1
0
Fork 0

save stats in db

master
Chris 2021-01-08 14:56:38 +01:00
parent 4e889de090
commit da1fad0ae1
1 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,7 @@
<?php <?php
$createStatement = $RUNTIME['PDO']->prepare("CREATE TABLE IF NOT EXISTS `regions_info` (`regionID` VARCHAR(36) NOT NULL COLLATE 'utf8_unicode_ci', `RegionVersion` VARCHAR(128) NOT NULL DEFAULT '' COLLATE 'utf8_unicode_ci', `ProcMem` INT(11) NOT NULL, `Prims` INT(11) NOT NULL, `SimFPS` INT(11) NOT NULL, `PhyFPS` INT(11) NOT NULL, PRIMARY KEY (`regionID`) USING BTREE) COLLATE='utf8_unicode_ci' ENGINE=InnoDB;");
$createStatement->execute();
$statement = $RUNTIME['PDO']->prepare("SELECT * FROM regions"); $statement = $RUNTIME['PDO']->prepare("SELECT * FROM regions");
$statement->execute(); $statement->execute();
@ -6,7 +9,7 @@
$ctx = stream_context_create(array('http'=> $ctx = stream_context_create(array('http'=>
array( array(
'timeout' => 3, //1200 Seconds is 20 Minutes 'timeout' => 3,
) )
)); ));
@ -21,6 +24,11 @@
$statementUpdate = $RUNTIME['PDO']->prepare('DELETE FROM regions WHERE uuid = :uuid'); $statementUpdate = $RUNTIME['PDO']->prepare('DELETE FROM regions WHERE uuid = :uuid');
$statementUpdate->execute(['uuid' => $row['uuid']]); $statementUpdate->execute(['uuid' => $row['uuid']]);
}else{
$regionData = json_decode($result);
$statementAccounts = $RUNTIME['PDO']->prepare('REPLACE INTO `regions_info` (`regionID`, `RegionVersion`, `ProcMem`, `Prims`, `SimFPS`, `PhyFPS`) VALUES (:regionID, :RegionVersion, :ProcMem, :Prims, :SimFPS, :PhyFPS)');
$statementAccounts->execute(['regionID' => $row['uuid'], 'RegionVersion' => $regionData->Version, 'ProcMem' => $regionData->ProcMem, 'Prims' => $regionData->Prims, 'SimFPS' => $regionData->SimFPS, 'PhyFPS' => $regionData->PhyFPS]);
} }
} }
?> ?>