Commit e1ebaee0 authored by Dave Reid's avatar Dave Reid

by Dave Reid: Added an option to disable URL alias pre-fetching to save PHP memory.

parent d86de50b
......@@ -253,6 +253,12 @@ function xmlsitemap_settings_form() {
// @todo This description is not clear.
'#description' => t('If there are problems with rebuilding the sitemap, you may want to manually set this value. If you have more than 50,000 links, an index with multiple sitemap pages will be generated. There is a maximum of 1000 sitemap pages.'),
);
$form['advanced']['xmlsitemap_prefetch_aliases'] = array(
'#type' => 'checkbox',
'#title' => t('Prefetch URL aliases during sitemap generation.'),
'#description' => t('This will help increase performance for sitemap generation on sites with a small to medium number of URL alises.'),
'#default_value' => TRUE,
);
$form['advanced']['xmlsitemap_batch_limit'] = array(
'#type' => 'select',
'#title' => t('Maximum number of sitemap links to process at once'),
......
......@@ -278,8 +278,8 @@ function xmlsitemap_generate_chunk($handle, &$status, $chunk, array $context) {
$url_options += array(
'absolute' => TRUE,
'base_url' => xmlsitemap_var('base_url'),
'alias' => TRUE,
'language' => language_default(),
'alias' => variable_get('xmlsitemap_prefetch_aliases', TRUE),
);
$last_url = '';
......@@ -304,8 +304,10 @@ function xmlsitemap_generate_chunk($handle, &$status, $chunk, array $context) {
while ($link = $links->fetchAssoc()) {
$link['language'] = $link['language'] != LANGUAGE_NONE ? xmlsitemap_language_load($link['language']) : $url_options['language'];
$link['alias'] = xmlsitemap_get_path_alias($link['loc'], $link['language']->language);
$link_url = url($link['alias'], array('language' => $link['language']) + $url_options);
if ($url_options['alias']) {
$link['loc'] = xmlsitemap_get_path_alias($link['loc'], $link['language']->language);
}
$link_url = url($link['loc'], array('language' => $link['language']) + $url_options);
// Skip this link if it was a duplicate of the last one.
// @todo Figure out a way to do this before generation so we can report
......
......@@ -653,6 +653,7 @@ function xmlsitemap_variables() {
'xmlsitemap_max_chunks' => 0,
'xmlsitemap_max_filesize' => 0,
'xmlsitemap_lastmod_format' => 'Y-m-d\TH:i\Z',
'xmlsitemap_prefetch_aliases' => TRUE,
// Removed variables are set to NULL so they can still be deleted.
'xmlsitemap_gz' => FALSE,
'xmlsitemap_regenerate_last' => NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment