I enabled the `xmlsitemap_custom` module. When adding more custom links, the same link would keep being overridden causing only 1 link to be added.

Proposed resolution

I will attach a patch shortly... but I discovered the reason the same link was being overridden was because there was a `$query->addExpression('MAX(id)');` It would always give me 999 as the max. Looking at the table in the db, I noticed it was set to varchar. Proposing to change to int and add an update hook to fix this issue.

Remaining tasks


Data model changes

`id` field will be changed from `varchar` to `int`.

Members fund testing for the Drupal project. Drupal Association Learn more


evanjenkins created an issue. See original summary.

evanjenkins’s picture

keats76’s picture

Ugh, I just ran into this as well. An integer key stored as a varchar? Scary. Anyway, please add this patch to the dev release. It's pretty bad when the code is calling "MAX(id)" on a varchar field and returns a "max" that is based on a string and is incorrect. It will overwrite existing data and corrupt the database table. :(

daften’s picture

I've added an updated patch with an additional use statement, since the one from #2 failed for me.

evanjenkins’s picture

daften’s picture

My bad, my patch was applied against alpha2, sorry :s

sjerdo’s picture

This issue was duplicated in #2881219: XML sitemap custom adds only one link, deleting the previous one. The same problem occurred: The same id is used for each sitemap link.

sjerdo’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2735127: New custom link replacing old one

This issue is already fixed in #2735127: New custom link replacing old one