Skip to content

Commit

Permalink
[TASK] Drop Extbase usage for logs, resolves #362
Browse files Browse the repository at this point in the history
  • Loading branch information
fsuter committed Jan 2, 2025
1 parent 754e795 commit c32d95b
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 431 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2025-01-02 Francois Suter (Idéative) <[email protected]>

* Drop Extbase usage for logs, resolves #362

2024-12-31 Francois Suter (Idéative) <[email protected]>

* Adapt to changes in connector services 6.0.0, resolves #351

2024-12-27 Francois Suter (Idéative) <[email protected]>

* Add a delete reaction, resolves #361
Expand Down
22 changes: 10 additions & 12 deletions Classes/Controller/LogAjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class LogAjaxController
* @return ResponseInterface
* @throws \JsonException
*/
public function getAction(ServerRequestInterface $request, ?ResponseInterface $response): ResponseInterface
public function getAction(ServerRequestInterface $request): ResponseInterface
{
// Process query parameters
$queryParameters = GeneralUtility::makeInstance(
Expand All @@ -48,7 +48,7 @@ public function getAction(ServerRequestInterface $request, ?ResponseInterface $r
$logRepository = GeneralUtility::makeInstance(LogRepository::class);

// Get the count of all the log entries
$totalEntries = $logRepository->findAll()->count();
$totalEntries = $logRepository->countAll();
// Get the filtered entries and their count
$logs = [];
$logCount = 0;
Expand All @@ -61,13 +61,13 @@ public function getAction(ServerRequestInterface $request, ?ResponseInterface $r
/** @var \Cobweb\ExternalImport\Domain\Model\Log $logEntry */
foreach ($logEntries as $logEntry) {
$logs[] = [
'status' => $logEntry->getStatus(),
'crdate' => $logEntry->getCrdate()->format('U'),
'username' => $logEntry->getCruserId() ? $logEntry->getCruserId()->getUserName() : '-',
'configuration' => $logEntry->getConfiguration(),
'context' => $logEntry->getContext(),
'message' => $logEntry->getMessage(),
'duration' => $logEntry->getDuration(),
'status' => $logEntry['status'],
'crdate' => $logEntry['crdate'],
'username' => (string)$logEntry['cruser_id'] . ' TODO: retrieve user name',
'configuration' => $logEntry['configuration'],
'context' => $logEntry['context'],
'message' => $logEntry['message'],
'duration' => $logEntry['duration'],
];
}
} catch (\Exception $e) {
Expand All @@ -85,9 +85,7 @@ public function getAction(ServerRequestInterface $request, ?ResponseInterface $r
'recordsFiltered' => $logCount,
'error' => $error,
];
if ($response === null) {
$response = GeneralUtility::makeInstance(JsonResponse::class);
}
$response = GeneralUtility::makeInstance(JsonResponse::class);
$response->getBody()->write(json_encode($fullResponse, JSON_THROW_ON_ERROR));
return $response;
}
Expand Down
176 changes: 0 additions & 176 deletions Classes/Domain/Model/Log.php

This file was deleted.

Loading

0 comments on commit c32d95b

Please sign in to comment.