Bug #93895
closedLinkvalidator report doesn't list discovered bad links if the page is hidden
Added by Paul Hansen over 3 years ago. Updated 5 months ago.
100%
Description
As an editor, I want to view the list of bad links even if the selected page is hidden.
Bug: I can see that there are N number of bad links, but they are not listed in the report until I unhide the page. Link detection works fine if the target is hidden, but not the report.
Files
link_to_hidden_page.png (37.8 KB) link_to_hidden_page.png | Sybille Peters, 2021-04-10 06:54 | ||
clipboard-202104100940-d42ut.png (18.9 KB) clipboard-202104100940-d42ut.png | List of broken links does not match counts | Paul Hansen, 2021-04-10 13:40 |
Updated by Paul Hansen over 3 years ago
The issue is that with mod.linkvalidator.linkhandler.reportHiddenRecords = 0, the Linkvalidator will still (manually) check links on hidden pages, and the editor can see there are bad links in the numbers shown in the badge. But they won't be listed in the report until the page is unhidden.
The solution may be to only show a count of links that would be reported when reportHiddenRecords is false. Otherwise the editor will see the number and wonder why they can't list them.
Updated by Paul Hansen over 3 years ago
- Subject changed from Linkvalidator report doesn't list bad links if the page is hidden to Linkvalidator report doesn't list discovered bad links if the page is hidden
Updated by Sybille Peters over 3 years ago
You are talking about links TO hidden pages (records, ...) etc. not links ON hidden pages, right?
This is off the top of my head - I will investigate ...
The option `mod.linkvalidator.linkhandler.reportHiddenRecords` was removed and has effectively not been used (for a while). It was only used in the Linkhandler linktype which was not really used (anymore) - the InternalLinktype was used instead (to check links to pages and content elements).
That being said, what I think we should do is reintroduce the option reportHiddenRecords and use it in all linktypes which point to records (which is currently only InternalLinktype).
If you urgently need the functionality now, you would have to override the InternalLinktype yourself and implement the feature. This is not a hack, but actually supported (but not really documented right now):
You can effectively create an extension (or add this to your sitepackage or whatever), copy InternalLinktype.php (your class should inherit from AbstractLinktype, not InternalLinktype as that is not public API), and make this change in ext_localconf.php:
//$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['db'] = \TYPO3\CMS\Linkvalidator\Linktype\InternalLinktype::class;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['db'] = \TYPO3\CMS\Linkvalidator\Linktype\MyInternalLinktype::class;
More information (about the now unused option):
Updated by Sybille Peters over 3 years ago
- File link_to_hidden_page.png link_to_hidden_page.png added
The issue is that with mod.linkvalidator.linkhandler.reportHiddenRecords = 0, the Linkvalidator will still (manually) check links on hidden pages, and the editor can see there are bad links in the numbers shown in the badge. But they won't be listed in the report until the page is unhidden.
I cannot reproduce this in TYPO3 version 10. As said, the option reportHiddenRecords is only used in the LinkHandler linktype which is not used by default. Effectively, this determines which linktypes are used:
1. TSconfig
- this is the default
mod.linkvalidator.linktypes = db,file,external
2. Configuration in ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['db'] = \TYPO3\CMS\Linkvalidator\Linktype\InternalLinktype::class; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['file'] = \TYPO3\CMS\Linkvalidator\Linktype\FileLinktype::class; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['external'] = \TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::class; $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['linkhandler'] = \TYPO3\CMS\Linkvalidator\Linktype\LinkHandler::class;
As you can see, the LinkHandler link type is configured in ext_localconf.php but not used in TSconfig (by default). In the InternalLinktype the option reportHiddenRecords is not used.
Can you please add your configuration and describe a reproducible test case? Check if changing the mod.linkvalidator.linktypes to the default helps.
Updated by Paul Hansen over 3 years ago
I'm sorry about the lack of detail in my report.
Steps to reproduce (v10.4.14, core only, default Page TSconfig):
1. Create a hidden page, with a visible CE, with a bad internal link or link to a hidden page.
2. Run the link checker manually for that page. The bad link will be found even though mod.linkvalidator.checkhidden = 0 by default. (bug)
3. Switch to the report. You can see there is a bad link (badge says 1), but below, it says that there are no broken links to show. (bug)
4. Unhide the page. Now the bad link(s) will be listed.
5. Hide the page again. Now the numbers will all be zero with no listed links. This is the expected behavior with the default Page TSconfig (mod.linkvalidator.checkhidden = 0).
The # of bad links listed should equal the number of links listed for the selected types.
Perhaps it is something to do with the way the linkvalidator cache is used. The checkhidden condition is checked differently for the badges vs. the actual list.
Updated by Sybille Peters over 3 years ago
Thank you very much. Much clearer now.
Updated by Gerrit Code Review over 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80539
Updated by Sybille Peters over 1 year ago
- Related to Bug #101243: Fix in linkvalidator PagesRepository::doesRootLineContainHiddenPages added
Updated by Gerrit Code Review over 1 year ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80539
Updated by Gerrit Code Review about 1 year ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80661
Updated by Gerrit Code Review about 1 year ago
Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80661
Updated by Sybille Peters about 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset d21cb595f53f9ee5529ca5ba761d442f6cde4726.