Closed (fixed)
Project:
Link checker
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Plan
Assigned:
Reporter:
Created:
7 Feb 2015 at 15:36 UTC
Updated:
31 Dec 2020 at 11:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
hass commentedYes, but I'd like to get the views integration done first. So that the port may be easier.
Comment #2
rootworkHas there been any progress on this?
Comment #3
hass commentedNothing happend until now. Do you like to sponsor the port?
Comment #4
rootworkI can check with my client; possibly.
It might also be good to put a notice on the project page that you're looking for sponsors for the D8 port, if that's the main issue. That way if we can only partially sponsor it, others could make up the difference.
Comment #5
andrew.mikhailov commentedComment #6
rakesh.gectcrIs there any update on this project, I would like to help
Comment #7
yukare commentedI want to help, maybe just create a sandbox project and work there ?
Comment #8
mgiffordI can do some testing if someone's got some rough code available in a sandbox.
Comment #9
hass commentedWe need to get some D7 patches in first as it makes the upgrade a lot easier.
Comment #10
hass commentedComment #11
larowlanHi @hass
I am expecting to have some time to work on this in the coming month or so.
I thought I'd propose some high-level architecture for your approval before I start the port as follows:
Step 1 - port the tests. When they go green, we know we're close
Step 2 - create a new entity-type called Link. This will replace the linkchecker_link table and contain all the existing fields. Add a new base field to it by depending on the contributed dynamic_entity_reference module. This field will hold a reference to the entity the link was found in. This will allow referencing any content-entity from the Link entity. This will also replace the linkchecker_block_custom, linkchecker_comment and linkchecker_node tables and allow support for any entity-type, including e.g. paragraphs, field_collection, users etc. This module's functionality is proposed for inclusion in a later version of 8.x - see #2407587: Allow multiple target entity types in the entity reference field. Failing that, we could use the approach comment module takes, storing entity_id and entity_type properties and making each Link bundle only reference one entity-type. Using an entity to store links gives us all the advantages of core's entity APIS - Views integration as standard, action API, REST integration etc. Additionally linkchecker_link_edit_form becomes the entity edit form.
Step 3 - move the admin form to a ConfigForm object and add routing, schema etc
Step 4 - move the batch API callbacks to batch workers objects.
Step 5 - move the per-entity type logic into a new entity handler class 'link checker'. E.g. Workbench moderation adds a new handler to each relevant entity type 'moderation info'. We can add a 'link checker' handler to each entity-type. These would all inherit from a base-class with only the entity-type specific logic in the children. This includes all of the hook_{entity_type}_{hook} and the _linkchecker_(add|delete|cleanup|extract|missing)_{entity_type}_links functions. See workbench_moderation on D8 for how this might look.
Step 7 - move _linkchecker_extract_links to an extraction service and _linkchecker_link_replace to a replacement service
Step 8 - move _linkchecker_parse_fields and _linkchecker_replace_fields to field parsing and replacing services.
Step 9 - Port elements to D8 paradigms, e.g. permissions to yml file, .info to yml file, links to yml files, routing.
Step 10 - port hook_menu access callbacks to AccessCheck objects
Step 11 - port _linkchecker_link_access to an AccessControlHandler for the Link entity
Step 12 - port _linkchecker_check_links to queue processing
Step 13 - Make the queue processor that replaces _linkchecker_check_links fire an event, split _linkchecker_status_handling into event handlers to allow it to be broken up and also other modules to interact
Step 14 - move _linkchecker_cleanup_links to a cleanup service
Step 15 - move linkchecker_admin_report_page and linkchecker_user_report_page to views
Step 16 - move linkchecker.redirect.inc to a service that is only enabled (via a ServiceProviderInterface implementation) if redirect module is enabled
Step 17 - port the drush commands
I'm happy to do all this in a sandbox with atomic commits that could later be merged/squashed or do it via patches here.
Thoughts?
Comment #12
hass commentedBefore we start porting we need to get #2060243: Split linkchecker_scan_nodetypes as content type specific in. Than we can easier migrate to D8.
Not really. Test coverage is really weak.
Will this not conflict with Link module? I'm not sure what the reasons are for this, but core entity stuff may not fast enough for this module. We need unique keys, hashes and so on to find the links and we cannot load every entity just to search for a link. You need to expect a few million of links. My expierence with core is not so positive if it comes to special requirements. This is not about beeing able to save the data... it is all about performance and flexibility.
Never heard of this... looking forward to your patch.
Sounds good.
Sounds good.
You mean with actions? That would be useful, I'm just not sure about performance. Keep in mind we are using HTTPRL with parallel link checking and a very high hit rate. We also need to limit requests per server to not killing servers. As I have said HTTPRL I do not think Guzzle has the features of HTTPRL and HTTPRL is not yet available for D8.
What is the benefit of a service here?
YES, please. I do not care any longer if we get this into D7, but access checking is very difficult... just as a note.
I like to make smaller commits. Commits that are reviewable. I made the expierence that the module was broken in several ways after I started to trust one guy. The reason was mainly the patches have been too large to review.
Whatever, this looks all very promising and I'm looking forward to your patches to review. Please let us cleanup the D7 setting stuff upfront (#2060243: Split linkchecker_scan_nodetypes as content type specific).
Comment #13
larowlanOk, will check in over there
Comment #14
naveenvalechaAs the #2060243: Split linkchecker_scan_nodetypes as content type specific went in, Can we finalize the proposed port plan and create the child issues.
Let me know I would like to help.
Comment #15
hass commentedYes. I already started porting. Need your help now.
Comment #16
naveenvalechagreat hass!
can you create the issues and we'll work on them later soon.
Comment #17
naveenvalechaFound the code in the d8 branch.looked at the code and filing couple of issues to get it ported to d8
@hass,
can you create the d8 development snapshot so that we'll choose the version to 8.x-1.x-dev in issues.
Thanks for the great module and your help
Comment #18
hass commentedComment #19
naveenvalechawe have development snapshot out :) yay!
Changing the issue status from needs review to active as we're not doing any coding here.
(I'm not sure about how the issue statues of the plans change, probably Lee knows better)
Comment #20
larowlanlooks like help wasn't needed
Comment #21
hass commentedNo, it is still needed. I only made the things I know how to implement, now things are more complicated and require a lot of re-factoring.
Comment #22
larowlanoh neat - any particular issues I can look at?
Comment #23
naveenvalechaLee, could you update the #2780873: Add a new entity type linkchecker with your proposed plan including the technical details with DER and we can work on if hass would be happy. I'll try to work on the rest of the issues soon to get's this devil released.
Comment #24
hass commentedYeah, that seems to be the most important next step as it is all the module depends on.
Comment #25
keesje commentedI curious at the status of the port and the roadmap for it. Looking at the code I see l there's loads of work to do. Since there is discussion about architectural choices e.g. #2780873: Add a new entity type linkchecker, I'm not sure where to start?
Comment #26
hass commentedAs said in#24, enity type is the next step.
Comment #27
dianacastillo commentedDoes this module work at all even in a minimum capacity? if so can I get a document on how this can work. Or how can i help to make this work in a minimal capacity since i have time to work on it now?
Comment #28
hass commented#2780873: Add a new entity type linkchecker need to be done next.
Comment #29
dianacastillo commented@hass I am not sure what needs to be done to add a new entity. Can I get more specific instructions ?
Comment #30
dianacastillo commentedany thoughts as to how to make this work without httprl ? since HTTPRL is not yet available for D8?
Comment #31
yukare commented@hass it is not better drop the change to entity and just upgrade everything from drupal 7 to 8 using tables as before? The people that proposed this did not any visible work on it for months and everyone else is just waiting. Anyway, we can just replace the classes to use entities latter when it is ready.
Comment #32
larowlan@dianacastillo you can generate a new entity type using Drupal console.
Actually, the people that proposed this are working porting your other modules to Drupal 8. The code is open source, the documentation is too. If this module matters to you, work on patches or sponsor someone who can. Demanding more free work from volunteers and casting aspersions about the amount of work they have/haven't put in doesn't write code.
</rant>Happy friday morning
Comment #33
yukare commentedThe only thing i said is this: people proposed a change that @hass do not know how to make, he hinself said this on other comment, and this same people did not work on it. So simple, make it with @hass know. But i will not discuss about this.
Comment #34
vegantriathlete(Good news: I am working on a port to D8. Bad news: I'm not likely to be able to contribute my work to the community.)
I'd still like to give you a heads up about something I just encountered. TL;DR: Multilingual is different in D8. Each translation has the same entity ID.
First off, I decided to do a more or less straight port for my first version. Therefore, I have stuck with the hook_schema approach instead of going the entity route. I've kept all of the same tables.
Here's what I've just run into. I brought the linkchecker_node table across with just nid and lid. Unfortunately, that doesn't cut it. Not only do I need to track nid and lid, I also need to track the language code to know which translation I'm referencing. I don't know if you'll run into the same thing if you go the entity route; I don't know how you're planning to deal with the translation(s) of your entity.
Since I'm still planning to continue with the hook_schema route, here's what I'm planning to do. I'm going to consolidate linkchecker_node, linkchecker_comment and linkchecker_block_custom into a linkchecker_entity table. That table will have the fields: entity_id, entity_type, bundle, langcode and lid.
Comment #35
vegantriathleteHere is another multilingual issue you'll need to address.
In addition to dealing with (depending on the route you go)
hook_entity_delete --
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
hook_ENTITY_TYPE_delete --
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
you'll also need to deal with (depending on the route you go)
hook_entity_translation_delete --
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
hook_ENTITY_TYPE_translation_delete --
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
Comment #36
keesje commented"I'm not likely to be able to contribute my work to the community", can happen. Whats blocking?
Comment #37
vegantriathleteThe client is not currently willing to give permission for me to contribute the code.
Comment #38
keesje commentedbeen there too ;-). some arguments like "if other chip in it could be cheaper/faster" or "community maintenance" can help sometimes.
Comment #39
henry tran commentedPorting to Drupal 8.
- Convert code from D7 -> D8.
- Fix errors.
- Basic function works(All node content types)
- Build report page content.
Comment #40
rootworkDon't have time to review this myself at the moment but setting status in case someone else can.
Comment #41
henry tran commentedI added some more fixing in code.
Comment #42
henry tran commentedI fixed hashBase64 bug.
Comment #43
hass commentedThis is not ready for review. Many changes are straight forward, but there are other in modules file that are simply incorrect. e.g. variable get() no longer has a default as I know. In one place $node->type is upgraded with $node->getType() in other place with $node->bundle()? Use of GuzzleHttp cannot removed. There are lots of comments from db connections that could be removed. We need to check if we may need to remove httprl support as this module does not exists yet - or at least comment it. The upgrade of $response->uri['fragment'] looks very unreliable to me if we rely on indexes. A keyed name would be better. Not tested, but an url is not a header. I think it may be more something like $uri = $request->getUri(); per https://github.com/guzzle/guzzle3/blob/master/src/Guzzle/Http/Url.php there is also a getParts() that returns fragment. I also never use target in html links. This is up to the user to open something in a new tab. If fetchObject() is used this cannot be an array ($link['urlhash']). Please remove the lot of added blank lines.
'linkchecker_scan_node_' . $typeis not a linkchecker variable.However there are lot of lines I could take over one by one that seems codewise safe. Maybe the patch could be cleaned up first a little bit.
Comment #44
adammaloneAdding in a further pass as the patch in #42 was erroring when nodes were saved with nested menu items. This is definitely not a finished patch - rather an incremental fix that should help the progression of this issue.
Comment #45
adammaloneFound another small issue here relating to status of TRUE/FALSE and MySQL expecting an integer 0 or 1.
Comment #46
henry tran commentedFixing duplicate entry in node_linkchecker insert.
Comment #47
mgiffordWhat's the status on committing these up to the git repo? I can understand not putting out a release but seems there are a few patches to improve what's in git.
Comment #48
hass commentedPatches that contain incorrect changes, cannot committed.
Comment #49
pguillard commentedThis patch addesses a part of @hass comments at #43 :
And I added support to Drush9 with drush.services.yml and src/Commands/LinkcheckerCommands.php files.
(As needed for Drupal 8.4.0 / Symfony 3.2)
I guess next steps are :
Comment #50
hass commentedThanks for following up. Next step seems to be entity implementation...
Comment #51
hass commentedWhat is this?
Where is $link gone?
Why is this commented?
?
Indendation. Just a guess, ->uid is now id(). But we can do this in next step. This way it is easier to read.
?
?
?
?
?
extra blank before $query.
Indendation
Newline before "elseif"
Indendation
Indendation
Newline before else.
newline?
That looks not like clean code.
??
Indendation
That line cannot correct. The error text comes from the remote server.
Add TODO comment, please.
At least a space is missing.
?
Looks like FIXME comment required. Not sure how this need to be changed for content_moderation that goes into D8.5
Is this info part of the $comment object in D8?
?
?
unrelated changes
Indendation
Indendation
indendation
?
?
?
remove blank line
remove blank line
remove blank lines
indendation
remove blank line
indendation
indendation
indendation
indendation
remove blank lines
? and indendation
remove blank lines
remove blank lines
remove double space
remove blank line
indendation
?
remove blank lines
remove blank line
Why is this changed to integer?
remove blank line
May needs a todo/fixme comment
Let's move this ->toString() to Url::fromUri()->toString()
Add newline
remove empty line
remove empty line
?
?
?
Comment #52
mgiffordI had to disable this module because I ran into this problem while editing text:
Error: Call to undefined function variable_get() in linkchecker_scan_node_types() (line 2478 of /modules/linkchecker/linkchecker.module)
Thanks @hass for this thorough review & the response to my post in #47.
@pguillard you able to put out another patch?
Comment #53
pguillard commented@mgifford I'm on it, but this needs time
Comment #54
pguillard commentedHere is an improvement according to most of comments at #51
$comment->nidwith$comment->getCommentedEntityId(), not tested$response->error = t('Page not found');linkchecker_node_prepare()replaced withlinkchecker_node_prepare_form()if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'edit' && isset($nid))withif (!$node->isNew())There is still a lot of work to be done !
Comment #55
pguillard commentedI added :
array() => []conversions$account->uid => $account->id()conversionsComment #56
hass commentedThanks for the cleanup. I reviewed it code wise and will commit this first step soon with some changes. It will require some more smaller iterations to get to a working module, but this is a great step forward.
Please try to post smaller patches that can be easier and faster reviewed. May split up in sub cases, please.
Still unclear to me what happened with $link. It's not saved to log.
Does this work? $user may not exists here after the patch.
That looks code wise not correct to me. What has this to do with view edit tab?
I guess this needs work, too. Comment->status may no longer exists with the constant.
Any reason to change this to an array?
Need to review this closer later.
Review if we may use faster truncate over delete.
This is now in core. Need verificiation if all code is still the same. At least it required documentation changes in the code.
Remove empty line.
Rollback to boolean. No idea why this was changed.
Comment #57
pguillard commentedCool, thanks @hass too for your hints. I'll work on that
Comment #58
pguillard commentedSome more cleanup, from #56 :
1. It seems
$variable['%link']is set in $variable before the function call (I didn't test all cases)2. This was added at the beginning of the function
3. arg(0) beeing D7, the new way I guess is to detect that the node already exists, that means we are in edit mode. At least this is my way, I tested that it works.
4. Right
$comment->statusis D7, replaced$comment->status => $comment->getStatus()5. I guess this is the reason somebody did that before :
TypeError: Argument 1 passed to Drupal\Core\Database\Query\Insert::fields() must be of the type array, object given, called in /home/dev/projet/web/modules/contrib/linkchecker/linkchecker.module on line 1322 in Drupal\Core\Database\Query\Insert->fields() (line 70 of core/lib/Drupal/Core/Database/Query/InsertTrait.php).6. Did not work on it
7. Added a todo
// @todo: Review if we may use faster truncate over delete.8. Right, I changed that part that was D7
9. Empty line removed
10. Rollback to boolean done. There was also a FALSE translated to a 1 (Not tested)
And I found some others (managed in this patch) :
$form_state['values']=>$form_state->getValues()arg(0)=>\Drupal::service('path.current')->getPath()[1];Comment #60
hass commented#58 I reviewed this monster patch and committed the attached one. I changed some things, fixed leftovers and reverted the incorrect drupal_write_record() migration. Please see https://www.drupal.org/node/2340291 how drupal_write_record() will be upgraded (merge query). This merge query looks a lot simpler than the proposed code change.
The smaller followup patch from #58 needs a re-role now.
Comment #61
merauluka commentedI'm attaching a patch with work I've started on cleaning up the linkchecker.batch.inc file.
Still TODO: Handle blocks now that they've been split into config and entity blocks.
Comment #62
mpotter commentedGiven that code was committed in #59 iI'd recommend that this issue should be closed/fixed and new issues opened against 8.x branch. If you want this to be a "META" issue for the D8 status then just create related issue links. The intent of D8 module migration was never to try and handle the entire module port in a single giant issue.
Comment #63
pguillard commentedI agree with @mpotter
I will reroll my work in #58 next sunday, back at home.
Comment #64
hass commented@merauluka:
I have some objections on this patch. I have never heard "\Drupal::query() and I cannot find any documentation about this supported. Not tested.
Arrays need to be ":types[]" in "IN" statements as I know.
COMMENT_PUBLISHEDneeds migration, see https://www.drupal.org/node/2156155.There is also the same array / IN statement bug
Comment #65
hass commentedI think we should keep this case open as meta as otherwise someone will open another one for this :-).
Let's go for individual sub cases as already suggested.
Comment #66
hass commentedComment #67
merauluka commented@hass So should I move my work (and updates after your review) into a new ticket for the install file or leave them and continue work for it here?
Comment #68
hass commentedPlease create new tickets.
Comment #69
shubhangi1995hi is there a ticket related to the progress and task left in the port so that we can track the status and do the left over of issues
Comment #70
hass commentedAs noted earlier the #2780873: Add a new entity type linkchecker need to be the next step as it affects nearly everything.
Comment #71
shubhangi1995hi hass,
Just a query: for having a basic functioning of the module is it necessary to have the entity linkchecker , or first we can have a basic functionality covered in alpha release and then go on with this implementation for next release?
Comment #72
henry tran commentedFixing Error: Call to undefined function drupal_write_record() in _linkchecker_add_node_links() (line 1317 of /var/www/mw/docroot/modules/contrib/linkchecker/linkchecker.module) #0 /var/www/mw/docroot/modules/contrib/linkchecker/linkchecker.module(973): _linkchecker_add_node_links(Object(Drupal\node\Entity\Node)) #1 [internal function]: linkchecker_node_update(Object(Drupal\node\Entity\Node)) #2 /var/www/mw/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(402): call_user_func_array('linkchecker_nod...', Array) #3 /var/www/mw/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(167): Drupal\Core\Extension\ModuleHandler->invokeAll('node_update', Array) #4 /var/www/mw/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(730): Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node)) #5
Comment #73
henry tran commentedFixing Error: Call to undefined function drupal_write_record() in _linkchecker_add_node_links() (line 1317 of /var/www/mw/docroot/modules/contrib/linkchecker/linkchecker.module) #0 /var/www/mw/docroot/modules/contrib/linkchecker/linkchecker.module(973): _linkchecker_add_node_links(Object(Drupal\node\Entity\Node)) #1 [internal function]: linkchecker_node_update(Object(Drupal\node\Entity\Node)) #2 /var/www/mw/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(402): call_user_func_array('linkchecker_nod...', Array) #3 /var/www/mw/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(167): Drupal\Core\Extension\ModuleHandler->invokeAll('node_update', Array) #4 /var/www/mw/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(730): Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node)) #5
Comment #74
kellyimagined commentedCurrent error: Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "dblog.overview" does not exist." at /mnt/www/html/si/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php line 201 request_id="v-e98fe8b2-c734-11e8-b5b1-2f95e838bff8"
Happens when going to admin page.
Comment #75
laravz commented@kellyimagined, I'm not getting this error with a fresh install. I assume it's on the admin/config/content/linkchecker page? The only field that uses this would be "Update permanently moved links". Do you have any specific settings? And do you have the dblog module enabled? Your issue might be related to issue #2572285.
Comment #76
c-logemannI think the most work is done. I will take a look at the related issues in this issue. But there a new one for preparing a first alpha release: #3107765: Create first D8 alpha release
Comment #77
jeroentI guess we can close this issue now that the modules has an alpha release.