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.
When a cron is run by itself for this it fails to keep the Taxonomy set and also fails to create a revision or any logs so I do not know what went wrong. Is there some permission I need to enable to make it work properly? Or is this a bug?
Comments
Comment #1
hass CreditAttribution: hass commentedI'm not sure what exactly you are talking about.
Comment #2
omaster CreditAttribution: omaster commentedIt is quite a hard issue to explain really. But what basicly happens is if a cron job is run by the system then any page with a link that is getting updated by link checker because it was recorded as "moved permanently" loses any extra information like which Taxonomy it belonged to. It also does not actually create a revision of this updated page which makes it hard to see what changes link checker actually made to the page.
Comment #3
hass CreditAttribution: hass commentedI looked into the code and I think this is a permission issue. The cron task need to load the user 1 user object or it may have not enough permissions. What type of restrictions are you using in taxonomy?
Comment #4
omaster CreditAttribution: omaster commenteduser 1 has full admin permission on everything. The same as my user. If I run the cron myself manually then it works. I get a new revision and I get the correct taxonomy. but if I let it run by cron itself then both of those do not happen.
Comment #5
hass CreditAttribution: hass commentedYeah, that is what I mean. There is a bug in the module as cron runs unter anonymous user account and do not have permission. I need to load the admin user; if the cron job updates your nodes.
For now, please disable the auto update until we have a working fix implemented.
Comment #6
hass CreditAttribution: hass commentedComment #7
hass CreditAttribution: hass commentedhttp://drupal.org/node/218104
Comment #8
achtonI want to help with this issue, but I can't replicate the bug.
I installed D6.25 using
drush si
and installed latest 6.x-2.x-dev. I then used devel generate to create content and assign taxonomy automatically. I edited a node and added a 301 link to the body, and then proceeded to call cron thus:wget --no-check-certificate -O - -q -t 1 http://dev.site/an/drupal-6.25/cron.php
As you can see from attached screenshots, cron ran as Anonymous, adding a new revision and watchdog log. The node was updated correctly, retaining all taxonomy.
So what am I missing? Are there other access restrictions in place in the original bug report that could muddy the waters?
Comment #9
hass CreditAttribution: hass commentedThan we need more infos.
Comment #10
omaster CreditAttribution: omaster commentedIn my site Anonymous users are not allowed to edit pages so that may be where the issue comes.
You may need to remove all permissions from Anonymous to replicate the issue. Infact the site has no anonymous accessibility at all.
I think you are right about the issue being permission and it is probably in the effect that this does need to be run as admin user as opposed to anonymous.
Comment #11
omaster CreditAttribution: omaster commentedI have actually managed to fix it using the link to safely impersonating another user.
I will do a patch and submit it for testing.
Comment #12
hass CreditAttribution: hass commentedI think we should allow users to configure a custom user account for the updates. So we don't need to force user/1 in this case. Something like recommending to create a Linkchecker user or Automatic Link Updater. For this we need a setting in linkchecker settings page. We can start with an integer (user/1), but usability wise we should make it more an autocomplete field or something like this that shows the username behind the userID.
Comment #13
omaster CreditAttribution: omaster commentedThat shouldn't be too hard. Just need to add the field to the admin page for selecting the user and have it so that if a user is selected in there then that is the user to add in the function _linkchecker_status_handling which is where I placed the user fix.
Then have it that where it uses $user= user_load(1) that the 1 can be the value for the user in that field. The only issue with it is that a user can be impersonated without any authentication what so ever which is not a good thing. But I think that is more a drupal issue then a link checker one ;).
Comment #14
achtonI just thought of another issue in relation to this today. On a site that I maintain, admin users are able to render unpublished nodes (might be Panels that makes this possible), but most regular users will not, and will instead receive a HTTP 403 (should be 404, I know).
In any case, when LC runs as user/1, links to this content won't show in the reports, since user/1 has access to the content.
So it seems perfectly valid for LC to assume the anonymous role when visiting content, and find another solution for the permissions issue, if it is indeed valid as described in the OP.
I like the feature on specifying a specific user, but I think these are seperate issues.
Comment #15
hass CreditAttribution: hass commentedUnpublished nodes or links in them are not checked, updated, etc. This logic has nothing to do with permissions.
Comment #16
achton@hass: I'm talking about published nodes that contain links to unpublished nodes. If user/1 has permissions/is able to render an unpublished node, Link Checker will never tell me about links to unpublished content.
It is my understanding that on a vanilla Drupal site, links to unpublished content will be detected by Link Checker. But maybe I'm wrong?
Comment #17
hass CreditAttribution: hass commentedWe only impersonate the content updates. The check is not impersonated. It's still an anonymous http request.
Comment #18
omaster CreditAttribution: omaster commentedYeah the location that I placed the impersonation only affects the after effects of the check. So when an action must be performed.
Comment #19
achtonAh, okay - thanks for clearing that up. That seems obvious now that I think about it. Sorry for hijacking the thread, then :-/
Still want to help with the bug/feature/patch though :)
Comment #20
hass CreditAttribution: hass commented@omaster: Are you working on the D6 and D7 patches? Please assign case to you if you do.
Comment #21
omaster CreditAttribution: omaster commentedI have found one more problem now. It appears that it is not actually doing the changes. Merely creating the revision and adding a comment to it. But not actually changing the link. I have to look at it further.
I will work on testing the D6 a little more and creating a patch for this.
Comment #22
omaster CreditAttribution: omaster commentedI am attaching my patch that I did for now that does not fully work but allows impersonating a user so maybe if anyone else wants to test as well and see where it is going wrong they can.
Comment #23
omaster CreditAttribution: omaster commentedComment #24
omaster CreditAttribution: omaster commentedComment #25
omaster CreditAttribution: omaster commentedI am guessing that the problem may be that is loses it's impersonation when it changes functions. So we may need to impersonate multiple times. But I will test and let you know.
Comment #26
omaster CreditAttribution: omaster commentedAdding it to sub functions did not help. Need to work out why it is not editing the nodes.
Not sure if it is related or not.
Comment #27
hass CreditAttribution: hass commentedPlease keep in mind that the module is currently not able to update internal or relative links automatically. Don't waste time on this task. :-)
Comment #28
hass CreditAttribution: hass commentedThere are many unrelated changes in the patch and the UI option is missing.
Comment #29
omaster CreditAttribution: omaster commentedYeah I noticed the unrelated changes. Have no idea how that happens when I just downloaded the copy I compared to and made no changes to those files. Will try and rectify and yes UI option is the next step. Just wasn't sure about the function because my links do not change. ;)
Ok so obviously once this is finished I will need all links to be able to be updated so I am thinking that it may end up as my next task unless something is already happening on it? :D
Comment #30
hass CreditAttribution: hass commentedWe should add one more patch that compare if node content has changed. If not, don't save a new revision. Changing local links can be quite tricky...
Comment #31
omaster CreditAttribution: omaster commentedYes it sounds like a good idea.
And then work on the local links. Because that is where my biggest issue is seeing as my site in an Intranet so majority of linking is internal. :) With 1500 pages having been created and still active in 1 year of it being live and about 1000 documents linked to the pages it means there is a lot of links flying around. :D. And at present 95% of all broken / moved links are internal. :)
BTW for me it is both External and Internal links that are not changing. Not sure why.
Comment #32
hass CreditAttribution: hass commentedExternal must really work. You can debug in the link replace function. Dump $text before and after.
Replacing internal links is extremly difficult. I think it would be best to replace internal links with drupal raw paths, but this requires pathologic module. So the result depends on what we have installed on the system and can break fairly soon as it's nearly impossible to reproduce all user entered path variants. I don't like to educatate everyone to install pathologic and never use aliases, etc. I strongly suggest You to use pathologic and you will never run into this issue again.
Comment #33
omaster CreditAttribution: omaster commentedI am not sure I understand the problem.
Is it not possible to just change the text in question with the correct Alias. I mean if there is a redirection to the correct page and the system has been able to determine this should this not just be a case of swapping the information.
Or am I not understanding something?
Like for example if I change the alias and a redirection is created by the Path redirect module then shouldn't it just be able to change any reference to the old link to the new link?
Comment #34
hass CreditAttribution: hass commentedThe problems come mainly all from input filters and I'm sure I cannot list or guess all variants that are possible. Some filters like pathologic will always show the correct link as long as the node exists. BBCode, markup are different and any other module makes more indivisual issues. Others people may use relative links, that are difficult to find on replace and so on and so on. Better safe than sorry.
Use pathologic for future and you will never run into internal path issues again... I'm using it everywhere.
Comment #35
omaster CreditAttribution: omaster commentedSo I have done a dump now and the before and after end up the same. Going to investigate why.
Comment #36
omaster CreditAttribution: omaster commentedOk now I am done testing. I found out the issue. The pages I was testing with were missing the a tag. The link was because the text was a https:// and it automatically was creating the link which linkchecker found but did not change because of the fact the link was in the main body text not a tag.... It should be possible to make this change also though?
Comment #37
hass CreditAttribution: hass commentedWe should go with #287292: Add functionality to impersonate a user and use http://drupal.org/node/42552 autocomplete in admin settings form.
Comment #38
hass CreditAttribution: hass commentedPatch attached.
Comment #40
hass CreditAttribution: hass commentedNew patch.
Comment #42
hass CreditAttribution: hass commentedHopefully that's it.
Comment #43
hass CreditAttribution: hass commentedHere is a D6 version.
Comment #44
hass CreditAttribution: hass commentedD6: http://drupalcode.org/project/linkchecker.git/commit/b40ab09
D7: http://drupalcode.org/project/linkchecker.git/commit/8b61719
Comment #45
hass CreditAttribution: hass commentedComment #46
hass CreditAttribution: hass commentedFollow up issue reported by omaster in #21: #1867460: Prevent save on automatic updates, if content has not changed