Refactor xmlsitemap_generate_chunk

Created on 27 September 2021, almost 3 years ago
Updated 30 April 2023, about 1 year ago

Problem/Motivation

On large sites cron runs into memory and performance problems.

xmlsitemap_get_path_alias() is a bad function because it loads the whole URL alias table which will not scale on large sites.

This patch refactors xmlsitemap_generate_chunk, the place that call xmlsitemap_get_path_alias(). It overrides the query which collects aliases.

πŸ“Œ Task
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom jbodony

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΈπŸ‡°Slovakia poker10

    Looking at tests, this patch introduced a short array syntax, which will not work on older PHP still supported by this module. Classic array need to be used here.

    @@ -177,6 +165,9 @@ function xmlsitemap_generate_chunk(stdClass $sitemap, XMLSitemapWriter $writer,
     
       $last_url = '';
       $link_count = 0;
    +  $sources['language'] = [];
    +  $sources['loc'] = [];
    +  $linkcollection = [];
    

    I have not reviewed the whole patch yet.

Production build 0.69.0 2024