diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-09-27 01:21:19 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-27 01:21:19 +0300 |
commit | f3e381f5a052db77ea1dce3e85c7e9f5ddc97400 (patch) | |
tree | 4600d3a920fbd2a91d6b79693d9b6ce3e0e083b5 | |
parent | 71e5df88bb52931f0e9fd0db4696576b629a8d60 (diff) |
Log data to survey.log
-rw-r--r-- | api/externalapi.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/api/externalapi.php b/api/externalapi.php index 033a813..8207460 100644 --- a/api/externalapi.php +++ b/api/externalapi.php @@ -25,15 +25,16 @@ namespace OCA\Survey_Server\Api; use OCA\Survey_Server\Service\StatisticService; use OCP\AppFramework\Http; +use OCP\IConfig; use OCP\IRequest; class ExternalApi { - /** @var IRequest */ private $request; - /** @var StatisticService */ private $service; + /** @var IConfig */ + private $config; /** * OCSAuthAPI constructor. @@ -43,10 +44,12 @@ class ExternalApi { */ public function __construct( IRequest $request, - StatisticService $service + StatisticService $service, + IConfig $config ) { $this->request = $request; $this->service = $service; + $this->config = $config; } /** @@ -60,6 +63,9 @@ class ExternalApi { $array = json_decode($data, true); + $logFile = \OC::$server->getConfig()->getSystemValue('datadirectory') . '/survey.log'; + file_put_contents($logFile, $data . PHP_EOL, FILE_APPEND); + if ($array === null) { return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST, 'Invalid data supplied.'); } |