2018-09-24 13:53:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Grocy\Controllers;
|
|
|
|
|
|
|
|
use \Grocy\Services\DatabaseService;
|
2019-02-09 13:41:40 +01:00
|
|
|
use \Grocy\Services\ApplicationService;
|
2018-09-24 13:53:18 +02:00
|
|
|
|
|
|
|
class SystemApiController extends BaseApiController
|
|
|
|
{
|
|
|
|
public function __construct(\Slim\Container $container)
|
|
|
|
{
|
|
|
|
parent::__construct($container);
|
|
|
|
$this->DatabaseService = new DatabaseService();
|
2019-02-09 13:41:40 +01:00
|
|
|
$this->ApplicationService = new ApplicationService();
|
2018-09-24 13:53:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected $DatabaseService;
|
2019-02-09 13:41:40 +01:00
|
|
|
protected $ApplicationService;
|
2018-09-24 13:53:18 +02:00
|
|
|
|
|
|
|
public function GetDbChangedTime(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
|
|
|
{
|
|
|
|
return $this->ApiResponse(array(
|
|
|
|
'changed_time' => $this->DatabaseService->GetDbChangedTime()
|
|
|
|
));
|
|
|
|
}
|
2018-09-30 13:02:07 +02:00
|
|
|
|
|
|
|
public function LogMissingLocalization(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
|
|
|
{
|
|
|
|
if (GROCY_MODE === 'dev')
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$requestBody = $request->getParsedBody();
|
|
|
|
|
|
|
|
$this->LocalizationService->LogMissingLocalization(GROCY_CULTURE, $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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-02-09 13:41:40 +01:00
|
|
|
|
|
|
|
public function GetSystemInfo(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
|
|
|
{
|
|
|
|
return $this->ApiResponse($this->ApplicationService->GetSystemInfo());
|
|
|
|
}
|
2018-09-24 13:53:18 +02:00
|
|
|
}
|