fix: [audit log] error due to compressible fields not being streams when compression not enabled

cli-modification-summary
iglocska 2022-09-18 18:16:34 +02:00
parent 3857de8499
commit 370995ab50
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@ use Cake\ORM\TableRegistry;
use \Cake\Database\Expression\QueryExpression;
use Cake\Http\Exception\UnauthorizedException;
use Cake\Core\Configure;
use PhpParser\Node\Stmt\Echo_;
class AuditLogsController extends AppController
{
@ -22,8 +23,10 @@ class AuditLogsController extends AppController
'filters' => $this->filterFields,
'quickFilters' => $this->quickFilterFields,
'afterFind' => function($data) {
$data['request_ip'] = inet_ntop(stream_get_contents($data['request_ip']));
$data['changed'] = stream_get_contents($data['changed']);
$request_ip = is_resource($data['request_ip']) ? stream_get_contents($data['request_ip']) : $data['request_ip'];
$change = is_resource($data['change']) ? stream_get_contents($data['change']) : $data['change'];
$data['request_ip'] = inet_ntop($request_ip);
$data['changed'] = $change;
return $data;
}
]);