Bug #93895

Linkvalidator report doesn't list discovered bad links if the page is hidden

Added by Paul Hansen 8 months ago. Updated 8 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Linkvalidator
Target version:
-
Start date:
2021-04-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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
#1

Updated by Paul Hansen 8 months 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.

#2

Updated by Paul Hansen 8 months 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
#3

Updated by Sybille Peters 8 months 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):

#4

Updated by Sybille Peters 8 months 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.

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

  1. 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.

#5

Updated by Paul Hansen 8 months 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.

List of broken links does not match counts

#6

Updated by Sybille Peters 8 months ago

Thank you very much. Much clearer now.

Also available in: Atom PDF