add schema and register
This commit is contained in:
parent
f3dfe78cb5
commit
39202ad906
|
@ -1,5 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
$data = json_decode(file_get_contents('php://input'), true);
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
file_put_contents("debug.txt", print_r($data, true));
|
||||||
file_put_contents("debug_".time().".txt", print_r($data, true));
|
|
||||||
?>
|
//Add User to DB if not exist
|
||||||
|
$QueueStatement = $RUNTIME['PDO']->prepare("INSERT IGNORE INTO users VALUES (?, ?, ?)");
|
||||||
|
$QueueStatement->execute(array($data['RegionOwnerID'], $data['RegionOwnerName'], $data['RegionOwnerMail']));
|
||||||
|
|
||||||
|
//Add Grid to DB if not exist
|
||||||
|
$rawGridInfo = getDataFromHTTP(@$data['RegionOwnerURL']['HomeURI']."get_grid_info");
|
||||||
|
$gridInfo = new SimpleXMLElement($rawGridInfo);
|
||||||
|
|
||||||
|
$QueueStatement = $RUNTIME['PDO']->prepare("INSERT IGNORE INTO grids VALUES (?, ?, ?, ?)");
|
||||||
|
$QueueStatement->execute(array($gridInfo->gridname, @$data['RegionOwnerURL']['HomeURI'], @$data['RegionOwnerURL']['AssetServerURI'], @$data['RegionOwnerURL']['IMServerURI']));
|
||||||
|
|
||||||
|
//Add Region to DB if not exist
|
||||||
|
$QueueStatement = $RUNTIME['PDO']->prepare("INSERT INTO queue VALUES (?, ?, ?)");
|
||||||
|
$QueueStatement->execute(array(guidv4(), "addRegion", json_encode($data)));
|
||||||
|
|
||||||
|
//Set LastSeen online time from Region.
|
||||||
|
RegionManager::setOnlineTime($data['UUID']);
|
||||||
|
?>
|
|
@ -16,11 +16,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRegionCount()
|
|
||||||
{
|
|
||||||
return count($this->allRegions);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNextRegion()
|
function getNextRegion()
|
||||||
{
|
{
|
||||||
return array_shift($this->allRegions);
|
return array_shift($this->allRegions);
|
||||||
|
@ -41,5 +36,10 @@
|
||||||
$removeRegionStatement = $RUNTIME['PDO']->prepare("DELETE regions, onlinetimes FROM regions INNER JOIN onlinetimes ON regions.RegionUUID = onlinetimes.RegionUUID WHERE regions.RegionUUID = ?");
|
$removeRegionStatement = $RUNTIME['PDO']->prepare("DELETE regions, onlinetimes FROM regions INNER JOIN onlinetimes ON regions.RegionUUID = onlinetimes.RegionUUID WHERE regions.RegionUUID = ?");
|
||||||
$removeRegionStatement->execute(array($uuid));
|
$removeRegionStatement->execute(array($uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function addRegion($name, $uuid, $grid, $image, $ownerid, $hostname, $port, $version)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -51,9 +51,9 @@ function getDataFromHTTP($URL, $contend = "", $requestTyp = "application/text")
|
||||||
{
|
{
|
||||||
if($contend != "")
|
if($contend != "")
|
||||||
{
|
{
|
||||||
return @file_get_contents($URL, true, stream_context_create(array('http' => array('header' => 'Content-type: '.$requestTyp, 'method' => 'POST', 'timeout' => 0.5, 'content' => $contend))));
|
return @file_get_contents($URL, true, stream_context_create(array('http' => array('header' => 'Content-type: '.$requestTyp, 'method' => 'POST', 'timeout' => 1.0, 'content' => $contend))));
|
||||||
}else{
|
}else{
|
||||||
return @file_get_contents($URL);
|
return @file_get_contents($URL, true, stream_context_create(array('http' => array('timeout' => 1.0))));
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo "(HTTP REQUEST) error while conntect to remote server. : ".$URL;
|
echo "(HTTP REQUEST) error while conntect to remote server. : ".$URL;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
$QueueStatement->execute(array($queueData->UUID, time(), $REGIONDATA['Avatare']));
|
$QueueStatement->execute(array($queueData->UUID, time(), $REGIONDATA['Avatare']));
|
||||||
|
|
||||||
$QueueStatement = $RUNTIME['PDO']->prepare("REPLACE INTO regions VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
$QueueStatement = $RUNTIME['PDO']->prepare("REPLACE INTO regions VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||||
$QueueStatement->execute(array($queueData->RegionName, $queueData->UUID, $queueData->GridName, $REGIONDATA['Image'], "00000000-0000-0000-0000-000000000000", $queueData->Hostname, $queueData->Port, $REGIONDATA['Version']));
|
$QueueStatement->execute(array($queueData->RegionName, $queueData->UUID, $queueData->GridName, $REGIONDATA['Image'], $queueData->RegionOwnerID, $queueData->Hostname, $queueData->Port, $REGIONDATA['Version']));
|
||||||
|
|
||||||
if(isset($queueData->Image))
|
if(isset($queueData->Image))
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,19 @@
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
[RegionName] => Twix
|
||||||
|
[UUID] => fd77f089-6a70-40fa-99a2-dde697edb860
|
||||||
|
[Hostname] => inc.li
|
||||||
|
[Port] => 7000
|
||||||
|
[RegionOwnerID] => ea78a956-6ba4-4b4a-805d-71faa0555db6
|
||||||
|
[RegionOwnerName] => Bla Bla
|
||||||
|
[RegionOwnerMail] => test@bla.de
|
||||||
|
[RegionOwnerURL] => Array
|
||||||
|
(
|
||||||
|
[HomeURI] => http://inc.li:8002/
|
||||||
|
[AssetServerURI] => http://inc.li:8002/
|
||||||
|
[IMServerURI] => http://inc.li:8002/
|
||||||
|
)
|
||||||
|
|
||||||
|
[GridName] => Inc.li
|
||||||
|
[HomeURL] => http://inc.li:8002
|
||||||
|
)
|
|
@ -0,0 +1,119 @@
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
-- Host: 127.0.0.1
|
||||||
|
-- Server Version: 10.4.17-MariaDB - mariadb.org binary distribution
|
||||||
|
-- Server Betriebssystem: Win64
|
||||||
|
-- HeidiSQL Version: 11.2.0.6213
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
/*!50503 SET NAMES utf8mb4 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
|
||||||
|
-- Exportiere Struktur von Tabelle opensim.land.grids
|
||||||
|
CREATE TABLE IF NOT EXISTS `grids` (
|
||||||
|
`GridName` varchar(128) NOT NULL DEFAULT '',
|
||||||
|
`GridHomeURL` varchar(128) DEFAULT NULL,
|
||||||
|
`GridAssetServer` varchar(128) DEFAULT NULL,
|
||||||
|
`GridIMServer` varchar(128) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`GridName`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Daten Export vom Benutzer nicht ausgewählt
|
||||||
|
|
||||||
|
-- Exportiere Struktur von Tabelle opensim.land.objects
|
||||||
|
CREATE TABLE IF NOT EXISTS `objects` (
|
||||||
|
`ObjectUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ObjectParcelUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ObjectName` varchar(256) NOT NULL,
|
||||||
|
`ObjectDescription` varchar(256) DEFAULT NULL,
|
||||||
|
`ObjectImage` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ObjectInSearch` int(1) NOT NULL DEFAULT 0,
|
||||||
|
`ObejctForSale` int(1) NOT NULL DEFAULT 0,
|
||||||
|
`ObjectPrice` int(8) NOT NULL DEFAULT 0,
|
||||||
|
`ObjectFreeForCopy` int(1) NOT NULL DEFAULT 0,
|
||||||
|
`ObjectPosition` varchar(30) NOT NULL,
|
||||||
|
`ObjectOwnerID` varchar(38) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
PRIMARY KEY (`ObjectUUID`,`ObjectParcelUUID`),
|
||||||
|
KEY `ObjectName` (`ObjectName`),
|
||||||
|
KEY `ObjectDescription` (`ObjectDescription`),
|
||||||
|
KEY `ObjectInSearch` (`ObjectInSearch`),
|
||||||
|
KEY `ObejctForSale` (`ObejctForSale`),
|
||||||
|
KEY `ObjectFreeForCopy` (`ObjectFreeForCopy`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Daten Export vom Benutzer nicht ausgewählt
|
||||||
|
|
||||||
|
-- Exportiere Struktur von Tabelle opensim.land.onlinetimes
|
||||||
|
CREATE TABLE IF NOT EXISTS `onlinetimes` (
|
||||||
|
`RegionUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`RegionLastSeen` int(11) NOT NULL DEFAULT 0,
|
||||||
|
`RegionOnlineUser` int(3) NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (`RegionUUID`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Daten Export vom Benutzer nicht ausgewählt
|
||||||
|
|
||||||
|
-- Exportiere Struktur von Tabelle opensim.land.parcels
|
||||||
|
CREATE TABLE IF NOT EXISTS `parcels` (
|
||||||
|
`ParcelRegionUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ParcelUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ParcelName` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ParcelDescription` text DEFAULT NULL,
|
||||||
|
`ParcelForSale` int(1) NOT NULL DEFAULT 0,
|
||||||
|
`ParcelInSearch` int(1) NOT NULL DEFAULT 0,
|
||||||
|
`ParcelPrice` int(16) DEFAULT NULL,
|
||||||
|
`ParcelOwnerID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ParcelImage` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`ParcelBitmap` text DEFAULT NULL,
|
||||||
|
`ParcelTraffic` int(16) NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (`ParcelUUID`),
|
||||||
|
KEY `ParcelRegionUUID` (`ParcelRegionUUID`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Daten Export vom Benutzer nicht ausgewählt
|
||||||
|
|
||||||
|
-- Exportiere Struktur von Tabelle opensim.land.queue
|
||||||
|
CREATE TABLE IF NOT EXISTS `queue` (
|
||||||
|
`QueueID` varchar(38) NOT NULL,
|
||||||
|
`QueueType` varchar(24) NOT NULL,
|
||||||
|
`QueueData` text NOT NULL,
|
||||||
|
PRIMARY KEY (`QueueID`),
|
||||||
|
KEY `QueueType` (`QueueType`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Daten Export vom Benutzer nicht ausgewählt
|
||||||
|
|
||||||
|
-- Exportiere Struktur von Tabelle opensim.land.regions
|
||||||
|
CREATE TABLE IF NOT EXISTS `regions` (
|
||||||
|
`RegionName` varchar(128) NOT NULL,
|
||||||
|
`RegionUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`RegionGridName` varchar(128) NOT NULL,
|
||||||
|
`RegionImage` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`RegionOwner` varchar(50) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`RegionHostname` varchar(128) NOT NULL,
|
||||||
|
`RegionPort` int(8) NOT NULL DEFAULT 7000,
|
||||||
|
`RegionVersion` varchar(256) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`RegionUUID`),
|
||||||
|
KEY `RegionName` (`RegionName`),
|
||||||
|
KEY `RegionOwner` (`RegionOwner`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Daten Export vom Benutzer nicht ausgewählt
|
||||||
|
|
||||||
|
-- Exportiere Struktur von Tabelle opensim.land.users
|
||||||
|
CREATE TABLE IF NOT EXISTS `users` (
|
||||||
|
`UserUUID` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
|
||||||
|
`UserName` varchar(128) NOT NULL,
|
||||||
|
`UserMail` varchar(50) NOT NULL,
|
||||||
|
PRIMARY KEY (`UserUUID`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
-- Daten Export vom Benutzer nicht ausgewählt
|
||||||
|
|
||||||
|
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
|
Loading…
Reference in New Issue