The last_status field, which weblinks checker uses to store the most recent url status value, is defined as 4 characters. However, I have received status values of -1002 for example, when there is no url to test. This is clearly a faulty weblink but drupal_write_record() cannot store this value, so no status is recorded and the fact that the link is bad never gets stored.

The simple solution is to increase the field to 5 characters. I've tried this, and it works fine, the value of -1002 is recorded, and in due course the link gets unpublished as intended. Patch to follow

Comments

jonathan1055’s picture

Status: Active » Needs review
StatusFileSize
new900 bytes

Patch against 7.x-1.0-alpha1+6

I could not get any return value from the call to db_change_field(), so cannot give any useful message. But we need to pass back something otherwise it looks like the update failed.

To retest the update, you can use:

db_update('system')->fields(array('schema_version' => 7000))->condition('type', 'module', '=')->condition('name', 'weblinks', '=')->execute();
gstegemann’s picture

Will test your patch next week.

But wouldn't it be better to increase the length of the last_status field right away to 6 characters to cover also 5 digit status codes?

jonathan1055’s picture

StatusFileSize
new900 bytes

Yes you are probably right. It's not a great overhead to have six chars. Here's an updated patch.

gstegemann’s picture

Status: Needs review » Reviewed & tested by the community

Patch tested.

  • jonathan1055 committed 8bc483d on 7.x-1.x
    Issue #2386455 by jonathan1055: Increase url status field to cater for 5...
jonathan1055’s picture

Title: Increase last_status db field from 4 to 5 chars » Increase last_status db field from 4 to 6 chars
Status: Reviewed & tested by the community » Fixed

Thanks for testing. Committed.
This has added weblinks_update_7001()

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.