#102104Migration of sys_log entries to a JSON formatted value failes
Description
Hi,
when the sys_log table has a lot records, the migration of sys_log entries to a JSON formatted value failes due to memory limitations.
The process has to be converted using rather the result object than the result array list.
The following will solve the issue in TYPO3\CMS\Install\Updates\SysLogSerializationUpdate
$queryBuilder = $this->getPreparedQueryBuilder();
$result = $queryBuilder
->select('uid', 'log_data')
->where(
$queryBuilder->expr()->like('log_data', $queryBuilder->createNamedParameter('a:%'))
)
->executeQuery();
while ($record = $result->fetchAssociative()) {
$logData = $this->unserializeLogData($record['log_data'] ?? '');
$connection->update(
self::TABLE_NAME,
['log_data' => json_encode($logData)],
['uid' => (int)$record['uid']]
);
}
// foreach ($this->getRecordsToUpdate() as $record) {
// $logData = $this->unserializeLogData($record['log_data'] ?? '');
// $connection->update(
// self::TABLE_NAME,
// ['log_data' => json_encode($logData)],
// ['uid' => (int)$record['uid']]
// );
// }
Thanks for fixing the issue.