2018-09-24 13:53:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Grocy\Controllers;
|
|
|
|
|
|
|
|
class SystemApiController extends BaseApiController
|
|
|
|
{
|
2020-02-11 17:42:03 +01:00
|
|
|
public function __construct(\DI\Container $container)
|
2018-09-24 13:53:18 +02:00
|
|
|
{
|
|
|
|
parent::__construct($container);
|
|
|
|
}
|
|
|
|
|
2020-02-11 17:42:03 +01:00
|
|
|
public function GetDbChangedTime(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
2018-09-24 13:53:18 +02:00
|
|
|
{
|
2020-03-01 23:47:47 +07:00
|
|
|
return $this->ApiResponse($response, array(
|
|
|
|
'changed_time' => $this->getDatabaseService()->GetDbChangedTime()
|
|
|
|
));
|
2018-09-24 13:53:18 +02:00
|
|
|
}
|
2018-09-30 13:02:07 +02:00
|
|
|
|
2020-02-11 17:42:03 +01:00
|
|
|
public function LogMissingLocalization(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
2018-09-30 13:02:07 +02:00
|
|
|
{
|
|
|
|
if (GROCY_MODE === 'dev')
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$requestBody = $request->getParsedBody();
|
|
|
|
|
2020-03-01 23:47:47 +07:00
|
|
|
$this->getLocalizationService()->CheckAndAddMissingTranslationToPot($requestBody['text']);
|
2019-01-19 14:51:51 +01:00
|
|
|
return $this->EmptyApiResponse($response);
|
2018-09-30 13:02:07 +02:00
|
|
|
}
|
|
|
|
catch (\Exception $ex)
|
|
|
|
{
|
2019-01-19 14:51:51 +01:00
|
|
|
return $this->GenericErrorResponse($response, $ex->getMessage());
|
2018-09-30 13:02:07 +02:00
|
|
|
}
|
2020-03-01 23:47:47 +07:00
|
|
|
}
|
2018-09-30 13:02:07 +02:00
|
|
|
}
|
2019-02-09 13:41:40 +01:00
|
|
|
|
2020-02-11 17:42:03 +01:00
|
|
|
public function GetSystemInfo(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
2019-02-09 13:41:40 +01:00
|
|
|
{
|
2020-03-01 23:47:47 +07:00
|
|
|
return $this->ApiResponse($response, $this->getApplicationService()->GetSystemInfo());
|
2019-02-09 13:41:40 +01:00
|
|
|
}
|
2018-09-24 13:53:18 +02:00
|
|
|
}
|