#106211'tstamp' is hardcoded
Description
In LinkAnalyzer.php function recheckLinks ‘tstamp’ is hardcoded.
$row = $queryBuilder->select('uid', 'pid', $GLOBALS['TCA'][$table]['ctrl']['label'], $field, 'tstamp')
->from($table)
->where(
$queryBuilder->expr()->eq(
'uid',
$queryBuilder->createNamedParameter($recordUid, Connection::PARAM_INT)
)
)
->executeQuery()
->fetchAssociative();
if (!$row) {
// missing record: remove existing links
$this->brokenLinkRepository->removeBrokenLinksForRecord($table, $recordUid);
return;
}
if (($row['tstamp'] ?? 0) && $timestamp && ((int)($row['tstamp']) < $timestamp)) {
// timestamp has not changed: no need to recheck
return;
}
‘tstamp’ should be derived from TCA[‘ctrl’][‘tstamp’]….
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 10
-
Georg Ringer commented and changed assigned to Georg Ringer 02/19/25, 14:19
-
Claus Harup commented 02/19/25, 14:22
Georg Ringer wrote in #note-1:
> fixed in 13.4 at least, will check if we backport that to 12Brillant!!
-
Georg Ringer commented and changed status
NewRejected 02/19/25, 14:51just checked with benni. There are a lot of places where this is hardcoded and this is fixed in 13 using the schema API.
therefore we won’t fix it in 12.hope that is still ok for you
-
Claus Harup commented 02/19/25, 14:54
Georg Ringer wrote in #note-3:
> just checked with benni. There are a lot of places where this is hardcoded and this is fixed in 13 using the schema API.
> therefore we won’t fix it in 12.
>
> hope that is still ok for youUnfortunately I cannot add the link validator functionality to my clients…. :-(
-
Claus Harup commented 02/19/25, 14:57
This would fix it :-)
$tstamp = $GLOBALS['TCA'][$table]['ctrl']['tstamp']; $row = $queryBuilder->select('uid', 'pid', $GLOBALS['TCA'][$table]['ctrl']['label'], $field, $tstamp) ->from($table) ->where( $queryBuilder->expr()->eq( 'uid', $queryBuilder->createNamedParameter($recordUid, Connection::PARAM_INT) ) ) ->executeQuery() ->fetchAssociative(); if (!$row) { // missing record: remove existing links $this->brokenLinkRepository->removeBrokenLinksForRecord($table, $recordUid); return; } if (($row[$tstamp] ?? 0) && $timestamp && ((int)($row[$tstamp]) < $timestamp)) { // timestamp has not changed: no need to recheck return; } -
Garvin Hicking commented 02/20/25, 01:12
clausharupclaush (that would only work when ‘tstamp’ is really available, it would still fail on tables having no timestamp at all) -
Claus Harup commented 02/20/25, 07:26
There you go :-)
... $selects = ['uid', 'pid', $GLOBALS['TCA'][$table]['ctrl']['label'], $field]; $tstamp = $GLOBALS['TCA'][$table]['ctrl']['tstamp'] ?? false; if ($tstamp) { $selects[] = $tstamp; } $row = $queryBuilder->select(...$selects) ->from($table) ->where( $queryBuilder->expr()->eq( 'uid', $queryBuilder->createNamedParameter($recordUid, Connection::PARAM_INT) ) ) ->executeQuery() ->fetchAssociative(); if (!$row) { // missing record: remove existing links $this->brokenLinkRepository->removeBrokenLinksForRecord($table, $recordUid); return; } if ($tstamp) { if (($row[$tstamp] ?? 0) && $timestamp && ((int)($row[$tstamp]) < $timestamp)) { // timestamp has not changed: no need to recheck return; } } ... -
Garvin Hicking commented 02/20/25, 07:41
Great, thank you for sharing this so that users affected by this in v12 could patch it like this!
-
Georg Ringer commented 02/20/25, 08:09
just a final comment: use XCLASS or composer patches to provide that change to your site. or update to v13 in the long run.
-
Claus Harup commented 02/20/25, 13:08
Everything works like a charm using composer patch!!!
fixed in 13.4 at least, will check if we backport that to 12