Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Now linkchecker_scan_nodetypes
store all enabled content type in a single array, so difficult to use features to manage it per individual content type.
Similar as diff_form_node_type_form_alter, we can move the enabled content type from admin/config/content/linkchecker
to admin/structure/types/manage/*
, so replace linkchecker_scan_nodetypes
as linkchecker_scan_node_*
per content type.
All similar 3rd party modules patch with same idea as this issue:
Comment | File | Size | Author |
---|---|---|---|
#51 | Issue-2060243-by-hswong3i-hass-Split-linkcheckerscan.patch | 18.01 KB | hass |
#45 | 2060243-node-type-scanning.43.patch | 19.35 KB | hass |
#43 | 2060243-node-type-scanning.43.patch | 19.35 KB | larowlan |
#43 | interdiff.txt | 974 bytes | larowlan |
#42 | 2060243-node-type-scanning.41.patch | 19.34 KB | larowlan |
Comments
Comment #1
hswong3i CreditAttribution: hswong3i commentedPatch via 7.x-1.x, changes include:
admin/structure/types/manage/*
Comment #2
hass CreditAttribution: hass commentedThat sounds very useful. Where have you moved the batch scan that fires if you enabled a content type for scanning?
Comment #3
hswong3i CreditAttribution: hswong3i commentedHonestly, patch from #1 now skip the fire of
batch_set(_linkchecker_batch_import_nodes($node_types))
because I guess we can do so manually by clicking the re-scan button (BTW, it change the original logic, design and implementation...).My suggestion is to fire that individually after
linkchecker_form_node_type_form_alter()
, add a submit hook to do so. Any idea?Comment #4
hass CreditAttribution: hass commentedBut we need to fire it. Beginners will not understand it and I also do not like to scan manually, too. This must be changed.
Comment #5
hswong3i CreditAttribution: hswong3i commentedAdd a custom submit handler for node type form, so once submit it will check *that* content type only ;-)
Comment #6
hass CreditAttribution: hass commentedWhy has variable_get() no default? That may be a problem if it has never set.
I guess we also need to add a hook_node_type_delete() to delete the variable or we have stale variables as node_type_get_names() in hook_uninstall() will not return deleted node types.
Aside, why not using hook_node_type_insert/update() for the batch? May be easier than the submit handler.
Comment #7
hswong3i CreditAttribution: hswong3i commentedTypo, fixed.
Add with hook_node_type_delete().
Now replaced as hook_node_type_insert/update().
Additional changes goes to 2nd part of patch file by git format-patch, please kindly review ;-)
Comment #8
hass CreditAttribution: hass commentedNo longer needed, isn't it?
Let's try not duplicating code. Just call the update function from the insert. Aside - calling it on insert makes not so much sense as there is no content yet... I believe we can remove the insert completely. and we should not re-run it with every update. Only if the setting has been changed to enabled.
?
Comment #9
hswong3i CreditAttribution: hswong3i commentedMost likely not possible if we are using hook_node_type_update(), because the variable pass in *already* updated as new version before goes into hook_node_type_update(), so may not have the idea about *change*?
Comment #10
hass CreditAttribution: hass commentedvariable_get('linkchecker_scan_node_' . $type, $linkchecker_scan_node); in update hook and compare with the form value and set it afterwards... aside the save of the variable seems missing in the node type update hook.
Comment #11
hswong3i CreditAttribution: hswong3i commentedRemove linkchecker_node_type_insert(), reformat patch.
Comment #12
hass CreditAttribution: hass commentedWhy not moving the comment scan checkbox to the node type, too? So we have all settings together.
Comment #13
hswong3i CreditAttribution: hswong3i commentedBut currently linkchecker_scan_comments control on/off of ALL comment scan for ALL enabled content types; and if a content type already disable link checking, _linkchecker_batch_import_comments() will not trigger for corresponding comment link checking, too.
I guess unless we detail split the comment scan options into per content type, or else may be over design for this issue (originally request: linkchecker_scan_nodetypes handle all content type in single array so not features export per content type friendly)?
Comment #14
hass CreditAttribution: hass commentedI believe keeping the settings splitted is a usability fail. It looks really confusing to me that one setting is inside content type and the other in linkchecker setting, but both are about the content type. Your patch is a good usability improvement for sure, but if we change this now, we should keep both together.
Comment #15
hswong3i CreditAttribution: hswong3i commentedComplete changes since #11 can be found from https://github.com/pantarei/drupal-linkchecker/commit/9dadd54852f91d9d44..., include:
linkchecker_scan_comments
into per content typelinkchecker_scan_comment_*
, also move it into content type formComment #16
hswong3i CreditAttribution: hswong3i commentedComment #17
hass CreditAttribution: hass commentedPlease do not change Maintenance. A user should normally not use it. There are only rare exceptions.
Comment #18
hswong3i CreditAttribution: hswong3i commented@hass:
Complete changeset goes to https://github.com/pantarei/drupal-linkchecker/commit/6f8a289e0c86687e35..., include:
Up to this point I have already consolidate all similar 3rd party modules patch with same idea into this issue (and even the most complete version here, thank you very much for your comment which make it more mature):
Final patch attached already applied to DruStack for more than a week, and perfectly handle my initial request on this issue with numbers of client's project:
Please feel free to improve this issue according to overall project design concern (which always a weakness for a contributor besides original author), and it is my pleasure to remove the manual patch within distribution once changes goes into mainstream. Thank you very much and looking for any good news ;-)
Regards,
Edison Wong
Comment #19
hass CreditAttribution: hass commentedGreat patch. Thanks a lot for this. I'm missing the already discussed batch scan in the code once the _node_type_form_alter() form is submitted. Maybe I missed it, but it seems not there. If I remember correctly you had it inside in past!?
What do you think about static caching of the arrays in
linkchecker_scan_node_types()
andlinkchecker_scan_comment_types()
?Comment #20
hass CreditAttribution: hass commentedChanges:
linkchecker-node-form.js
likecomment-node-form.js
linkchecker_scan_comments
leftover. This also shows that there is a problem if linkchecker_scan_comment_types() will always return data if the comment module is disabled. However we may need to add a module_exists('comment') check to linkchecker_scan_comment_types().Bugs:
Comment #20.0
hass CreditAttribution: hass commentedAdd more reference links
Comment #21
hass CreditAttribution: hass commentedComment #22
hass CreditAttribution: hass commentedComment #23
hass CreditAttribution: hass commented@hswong3i: Are you able to finish the patch, please?
Comment #24
hswong3i CreditAttribution: hswong3i commented@hass: Sorry that recently I am focusing on TWBS R&D so may not able to complete with this issue debug yet...
BTW, at least I give a re-roll of your patch via latest GIT, and will apply to drustack_seo.make now. Therefore all of my clients use case will benefit with this patch and able to figure out how to fix it ;-)
P.S. Soon I will handle another client project R&D and MUST use linkchecker for that, will come back ASAP~~
Comment #25
hass CreditAttribution: hass commented#20 was against latest dev.
Comment #26
hswong3i CreditAttribution: hswong3i commentedBut I do face a .rej during git apply so just simply re-roll it without any changes.
Comment #27
hass CreditAttribution: hass commentedThere are lot of differences to mine.
Comment #28
hass CreditAttribution: hass commentedMissed the new JS file in last patch
Comment #29
hswong3i CreditAttribution: hswong3i commentedPatch from #28 reroll via latest dev with minor cleanup.
Comment #30
hswong3i CreditAttribution: hswong3i commentedComment #31
hass CreditAttribution: hass commentedhas been removed. This is a new bug and not a cleanup.
The bug in #20 is not fixed.
Will you fix the remaining bugs or should be won't fix now?
Comment #32
hswong3i CreditAttribution: hswong3i commented@hass: refer to your comment on #28 and #29 patched result, I found that
Add custom submit handler to custom block delete form.
not appear in #29 patch file just because of different patch file format. There should be no new bug nor changes introduced.Patch re-roll via latest 7.x-1.x changes.
Comment #33
hass CreditAttribution: hass commentedMarking this critical to make sure this goes in soon and before we start porting to D8.
Comment #34
hass CreditAttribution: hass commentedThe patch does not apply.
Comment #35
hass CreditAttribution: hass commentedComment #36
hass CreditAttribution: hass commentedThis suxx so much. This part is missing in the patch.
Comment #37
larowlanJust confirming that #36 is all that remains here?
Comment #38
hass CreditAttribution: hass commentedYes, as I know.
Comment #39
larowlanthanks
Comment #40
larowlanSo the approach here would be to just re scan when a content-type had its setting turned on?
Comment #41
hass CreditAttribution: hass commentedYes. If we do not scan the content type - only links from new content would be checked.
Comment #42
larowlanAdded back block hunk, as that is unchanged.
Added in submit handler for node form to trigger batch scanning on the one node-type on submit.
Comment #43
larowlanAnd with support for old php versions
Comment #45
hass CreditAttribution: hass commentedComment #51
hass CreditAttribution: hass commentedComment #53
hass CreditAttribution: hass commented