Allow to check link status on demand

Created on 7 March 2024, over 1 year ago

Problem/Motivation

It would be nice to add link to check status code of the link manually (not via cron). Let's say, I made changes of link setup and now I want to confirm that it works as I expected. This should be possible for single links.

Proposed resolution

Add views field (@ViewsField). If it's needed, then you can always modify reports view by adding this field to it.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland gugalamaciek

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @gugalamaciek
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    86 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    86 pass
  • I think "Check status of the link" is too long of a default label. How about "Retest" or "Check" or something?

  • Status changed to Needs work over 1 year ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    joseph.olstad β†’ made their first commit to this issue’s fork.

  • Merge request !111Resolve #3426268 "Allow to check" β†’ (Open) created by joseph.olstad
  • Pipeline finished with Failed
    5 months ago
    Total: 253s
    #488537
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    hmm, I tested in my view, seeing this:

    Error: Call to a member function label() on null in Drupal\linkchecker\Controller\LinkcheckerStatusController->checkStatus() (line 56 of modules/contrib/linkchecker/src/Controller/LinkcheckerStatusController.php).
    
  • Pipeline finished with Failed
    5 months ago
    #488538
  • Pipeline finished with Failed
    5 months ago
    Total: 286s
    #489696
  • Pipeline finished with Canceled
    5 months ago
    Total: 147s
    #489699
  • Pipeline finished with Success
    5 months ago
    Total: 277s
    #489701
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    This latest patch adds a "Check links" button on the Maintenance accordion on the linkchecker settings form /admin/config/content/linkchecker

    This button is back by popular demand, clients asked , they get.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Credit should go to @jamesyao for the Check links button functionality.

  • First commit to issue fork.
  • Pipeline finished with Success
    5 months ago
    #490095
  • Pipeline finished with Canceled
    5 months ago
    #490305
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

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

  • Pipeline finished with Success
    5 months ago
    #490308
  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    Using the MR with 2.1.x, I'm seeing the following error when trying to view a report:

    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 142 of /web/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

    The issue seems to come from here:

    /web/modules/contrib/linkchecker/src/LinkCheckerLinkAccessControlHandler.php(68): Drupal\linkchecker\Entity\LinkCheckerLink->getParentEntity()
    /web/modules/contrib/linkchecker/src/LinkCheckerLinkAccessControlHandler.php(58): Drupal\linkchecker\LinkCheckerLinkAccessControlHandler->checkParentEntityAccess()

    Does the view need to be modified before this feature can be used?

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    Clearing the links and rechecking fixed the problem.

  • Issue was unassigned.
  • Status changed to Needs review 2 months ago
  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    There'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.

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    RE #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.

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    @joelpittet, yes I'm using MR !114 on 2.1.x.

  • I agree, rescanning the entity is 100% more useful.

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    I guess this would probably be a more appropriate status.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    For us we want to do a full scan with button press without waiting for cron.

    Sounds like #26 is a new feature requests. Should be a new issue.

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    @joseph.olstad

    For us we want to do a full scan with button press without waiting for cron.

    Yes, that's what we want as well.

    The current MR allows you to check the remote links again, however usually the problem with remote links is that they've changed 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?

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    That said, I'm curious as to how you are using this MR. Are you checking internal, external or both types of links?

    We're checking both types of links.

    How does the MR help?

    We're clicking the re-analyze button (a real Snoozer) before clicking the "Check links" button (another snoozer).

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    I 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?

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    I'm using the views field to recheck individual links, but the link is no longer valid so always returns an error.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    How does this MR help

    We don't have to wait a week for cron to re-scan when we're testing out linkchecker releases and or other patches.

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

    There 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.)

  • πŸ‡¨πŸ‡¦Canada 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.

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

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

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    setting to 2.1.x
    (what is 3.0.x)? maybe 3.0.x instead?

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

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

  • πŸ‡¦πŸ‡ΊAustralia imclean Tasmania

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

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    We'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.

Production build 0.71.5 2024