D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
psa
/
admin
/
plib
/
modules
/
rest-api
/
v2
/
externals
/
Handler
/
Filename :
Server.php
back
Copy
<?php // Copyright 1999-2024. WebPros International GmbH. All rights reserved. namespace PleskExt\RestApi\v2\Handler; use PleskExt\RestApi\v2\Annotation\Producer; use PleskExt\RestApi\v2\Helper\InvokableHandler; use PleskExt\RestApi\v2\SDK; use PleskExt\RestApi\v2\Entity\ServerMeta; use PleskRestApi\Slim\Psr7\Request; use PleskRestApi\Slim\Psr7\Response; class Server extends InvokableHandler { protected function get(Request $request, Response $response) { $entity = new ServerMeta(); $entity->platform = SDK\pm_ProductInfo::getPlatform(); $entity->hostname = SDK\pm_Server::getHostname(); $entity->guid = SDK\pm_Server::getGuid(); $entity->panel_version = SDK\pm_ProductInfo::getVersion(); $entity->panel_revision = SDK\pm_ProductInfo::getRevision(); $entity->panel_build_date = \date('Y-m-d', SDK\pm_ProductInfo::getBuildDate()); $entity->panel_update_version = SDK\pm_ProductInfo::getLastInstalledUpdate(); $extension = \pm_Extension::getById('rest-api'); $entity->extension_version = $extension->getVersion(); $entity->extension_release = $extension->getRelease(); $response->getBody()->write($this->serialize($entity)); return $response; } }