Needs review
Project:
Link checker
Version:
2.1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Mar 2024 at 07:13 UTC
Updated:
10 Apr 2026 at 08:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gugalamaciek commentedComment #3
gugalamaciek commentedComment #4
gugalamaciek commentedComment #5
solideogloria commentedI think "Check status of the link" is too long of a default label. How about "Retest" or "Check" or something? When editing an entity, the button/link is just "Edit" rather than "Edit the node".
Comment #6
solideogloria commentedComment #9
joseph.olstadhmm, I tested in my view, Drupal 11.1.x with PHP 8.3.20+ seeing this:
Comment #10
joseph.olstadComment #11
joseph.olstadComment #12
joseph.olstadComment #13
joseph.olstadSame as https://git.drupalcode.org/project/linkchecker/-/merge_requests/111.diff
Comment #14
joseph.olstadComment #15
joseph.olstadComment #16
joseph.olstadThis latest patch adds a "Check links" button on the Maintenance accordion on the linkchecker settings form
/admin/config/content/linkcheckerThis button is back by popular demand, clients asked , they get.
Comment #17
joseph.olstadCredit should go to @jamesyao for the Check links button functionality.
Comment #20
joseph.olstadMR 111 is for 2.0.x
MR 114 is for 2.1.x
I highly recommend that everyone use 2.1.x instead of 2.0.x, 2.0.x has a dependency on der , a very heavy module that should be avoided whenever possible.
Comment #21
imclean commentedUsing the MR with 2.1.x, I'm seeing the following error when trying to view a report:
The issue seems to come from here:
Does the view need to be modified before this feature can be used?
Comment #22
imclean commentedClearing the links and rechecking fixed the problem.
Comment #23
imclean commentedThere's a problem with this approach.
When there's a broken link on a page, usually the page needs to be updated with the new link or the link is removed altogether.
Using this MR, you can recheck a single link or all links, which it does, but it will continue to return the same error if the remote link isn't valid any more.
It might be more useful to rescan the entity/entities the link was on.
In other words, the broken link itself isn't the problem, the problem is the entity which contains the broken link.
Comment #24
joelpittetRE #23 I agree with you @imclean — re-scanning the entity on this manual task would make it significantly more useful. Just to confirm, which MR are you reviewing? Based on Joseph’s comment and yours, I’m guessing it’s MR !114, but want to be sure we’re all looking at the same thing.
Comment #25
imclean commented@joelpittet, yes I'm using MR !114 on 2.1.x.
Comment #26
solideogloria commentedI agree, rescanning the entity is 100% more useful.
Comment #27
imclean commentedI guess this would probably be a more appropriate status.
Comment #28
joseph.olstadFor us we want to do a full scan with button press without waiting for cron.
Sounds like #26 is a new feature request. Should be therefore a new issue.
It's been years already we've used this (as per merge request and patch) for a few years now.
Comment #29
imclean commented@joseph.olstad
Yes, that's what we want as well.
The current MR allows you to check the remote links again, however usually the problem with dead remote links is that they don't work any more so rescanning the links stored in the database will continually return the same error.
Dead/broken links are changed by updating the entity with new links, or just removing the broken links. After that, the entity needs to be checked again.
There is already a way to do a full scan of all entities. On the linkchecker config screen, under "Maintenance", it's the button "Clear link data and analyze content for links". This could take a while on larger sites.
Being able to rescan individual entities on demand could be useful. It would need to also verify the dead link isn't on any other pages before removing it from the broken link report.
That said, I'm curious as to how you are using this MR. Are you checking internal, external or both types of links? How does the MR help?
Comment #30
joseph.olstadWe're checking both types of links.
We're clicking the re-analyze button (a real Snoozer) before clicking the "Check links" button (another snoozer).
Comment #31
imclean commentedI mean, what's the objective of the MR? For example, say you have some external links on your site which are no longer working. How does this MR help?
Comment #32
imclean commentedI'm using the views field to recheck individual links, but the link is no longer valid so always returns an error.
Comment #33
joseph.olstadWe don't have to wait a week for cron to re-scan when we're testing out linkchecker releases and or other patches.
Comment #34
imclean commentedThere already is a button for rescanning on demand: "Clear link data and analyze content for links"
What problem is this issue addressing? (Taking into account my previous comments above.)
Comment #35
joseph.olstad@imclean , ya when you're using the above merge request or patch there's a "Check links" button which when pressed will check links. This means you won't have to wait for cron which is often set as weekly on a set interval for instance. No waiting, want it to happen right now then click the button.
This is very helpful for developers like me that occasionally have to do deep dives into this module or look into specific configurations and or folks that for some reason do not want to wait for cron or deal with cron settings or requiring a specific extra cron related module that triggers cron for linkchecker.
Comment #36
joelpittetI agree with @joseph.olstad this is starting to feel like scope creep. While adding a manual rescan for entity links (to catch false positives on already corrected links on the content entity) would definitely be useful, it's a larger change. What we have now is already valuable: it allows us to manually verify that a broken link is still broken, without waiting for cron.
@solideogloria @iamclean — I'm resetting the title to reflect the current scope. If we decide to include the rescan functionality, it should be as a follow-up to this patch. My preference is to get this in as-is and open a separate issue for the manual rescan enhancement to this. If you'd strongly prefer to combine them, I'd urge you to fork the current MR and explore that approach on top of what's here in a separate MR... but I find it a bit clearer to make them new issues.
I hope that helps and doesn't muddy the waters — feel free to disagree, I am not the maintainer here.
Comment #37
joseph.olstadsetting to 2.1.x
(what is 3.0.x)? maybe 3.0.x instead?
Comment #38
imclean commented@joelpittet, that's fine, I'm just struggling to understand the use case for the original issue, which makes it hard to review.
Going back to first principles, can the IS be updated with a detailed explanation beyond just avoiding cron. For example, when a link on an entity is no longer valid - what are the next steps?
And, as I said, we don't need another "rescan all links" button, because there already is one.
Comment #39
imclean commentedFrom the IS: "Let's say, I made changes of link setup and now I want to confirm that it works as I expected."
I missed the significance of this. OK this makes sense.
Comment #40
joseph.olstadWe're also using this patch, I'm not sure if it's needed for the check button functionality though, might be overkill.
#3212816: Interval of 86400 (one day) is impractical for debugging using GUI
We're also using other linkchecker patches that are unrelated to this.
Comment #41
anybody#3471860: Add action to immediately update a 301 URL to the new target is slightly related and contains some more ideas, maybe it could be a nice follow-up.
Comment #42
anybodythanks @joseph.olstad I added a comment to the MRs (while it's also in the header technically) to make this clear, because I was also wondering which is the right MR.
Rebased both and agree this would be totally useful in real-world scenarios ;) LGTM!
Comment #43
anybodyComment #44
anybodyMaybe it would make sense to add an action to allow this as bulk operation? (Or as follow-up?)
Comment #45
joel_osc commented@anybody if people are interested in a VBO action here is a start on it - we are already testing it on a few sites. The action provides a broken link report as a CSV when complete.
Comment #46
anybodyThanks, but I'm not a big fan of such "alternative approaches", let's better get a clean solution finished here.
Comment #47
anybodyComment #48
tomefa commentedI tried the PR together with many others patchs and got this error:
TypeError: Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm::__construct(): Argument #6 ($checkerBatch) must be of type Drupal\linkchecker\Form\LinkCheckerBatch, Drupal\linkchecker\LinkCheckerBatch given, called in /app/docroot/modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php on line 120 in Drupal\linkchecker\Form\LinkCheckerAdminSettingsForm->__construct() (line 102 of modules/contrib/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php).
Comment #49
solideogloria commented@tomefa You might just need to clear your cache. There's no such thing as
Drupal\linkchecker\Form\LinkCheckerBatchComment #50
tomefa commentedYes you are right, it was due to some other patchs that were conflicting.
I tried this patch alone and it was applying as expected.