Drupal allows its core path.inc file that controls the way path aliases are fetched/stored/handled to be overridden, through the 'path_inc' variable. Some modules make use of this to add their own functionality - for example, the language_hierarchy_paths submodule in https://www.drupal.org/project/language_hierarchy (which leverages https://www.drupal.org/project/pathinc exists to make that easier), which allows fallbacks for languages. For example, so that a British English language can exist, but aliases can just be set in a 'parent' language, regular English, without needing to be duplicated into the 'child' language.
The https://www.drupal.org/project/redis project is another example of one that overrides Drupal's path alias handling.

Anyway, the option to prefetch path aliases may not be compatible with some of these path handling implementations - it's certainly not with the language hierarchy example explained above. If the option is enabled, then paths end up unaliased in the sitemap, when they ought to be.

Patch to follow...

Comments

james.williams created an issue. See original summary.

james.williams’s picture

The attached patch implements an override, so that any modules overriding the path_inc variable can also set their own override for prefetching, which will be used if prefetching is enabled. If a module overrides the core path handler without doing so, prefetching is disabled, as it is presumed to be incompatible with other path handlers.

james.williams’s picture

Status: Active » Needs review
james.williams’s picture

james.williams’s picture

james.williams’s picture

StatusFileSize
new3.98 KB

Sorry for the noise. Updated patch here resolves a mistake in the original path affecting the admin form for the prefetching setting.

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 3 year old patch in #6 does not apply to the latest xmlsitemap 7.x-2.x-dev and if still applicable needs a reroll.

Checking patch xmlsitemap.admin.inc...
Hunk #1 succeeded at 314 (offset 34 lines).
Checking patch xmlsitemap.generate.inc...
Hunk #1 succeeded at 105 (offset 3 lines).
error: while searching for:
  $lastmod_format = variable_get('xmlsitemap_lastmod_format', XMLSITEMAP_LASTMOD_MEDIUM);

  $url_options = $sitemap->uri['options'];
  $url_options += array(
    'absolute' => TRUE,
    'base_url' => variable_get('xmlsitemap_base_url', $GLOBALS['base_url']),
    'language' => language_default(),
    'alias' => variable_get('xmlsitemap_prefetch_aliases', TRUE),
  );

  $last_url = '';

error: patch failed: xmlsitemap.generate.inc:158
error: xmlsitemap.generate.inc: patch does not apply
Checking patch xmlsitemap.module...
Hunk #1 succeeded at 343 (offset 14 lines).
dave reid’s picture

I wrote the prefetching feature assuming that if a user did enable one of those modules, they would disable the prefetch setting themselves? Is that the easier solution forward?

james.williams’s picture

Hello from the future... #2697819: Language hierarchy isn't compatible with sitemap alias prefetching makes use of the idea to implement an override for one of those modules, so prefetching can still be done, just by another method. Disabling prefetching is certainly the easiest way forward of course, but prefetching is useful when possible.

I don't particularly mind if this never got moved forward, the patches are here for those of us brave enough to use them ;-)

james.williams’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new3.96 KB

Re-rolled :-)