diff --git a/gsitemap.php b/gsitemap.php index 92121c5..bf986fd 100755 --- a/gsitemap.php +++ b/gsitemap.php @@ -277,45 +277,41 @@ public function addLinkToSitemap(&$link_sitemap, $new_link, $lang, &$index, &$i, ++$i; return true; - } else { - $this->recursiveSitemapCreator($link_sitemap, $lang, $index); - if ($index % 20 == 0 && !$this->cron) { - $this->context->smarty->assign([ - 'gsitemap_number' => (int) $index, - 'gsitemap_refresh_page' => $this->context->link->getAdminLink('AdminModules', true, [], [ - 'tab_module' => $this->tab, - 'module_name' => $this->name, - 'continue' => 1, - 'type' => $new_link['type'], - 'lang' => $lang, - 'index' => $index, - 'id' => (int) $id_obj, - 'id_shop' => $this->context->shop->id, - ]), - ]); + } - return false; - } elseif ($index % 20 == 0 && $this->cron) { - header('Refresh: 5; url=http' . (Configuration::get('PS_SSL_ENABLED') ? 's' : '') . '://' . Tools::getShopDomain(false, true) . __PS_BASE_URI__ . 'modules/gsitemap/gsitemap-cron.php?continue=1&token=' . Tools::substr(Tools::hash('gsitemap/cron'), 0, 10) . '&type=' . $new_link['type'] . '&lang=' . $lang . '&index=' . $index . '&id=' . (int) $id_obj . '&id_shop=' . $this->context->shop->id); - exit(); - } else { - if ($this->cron) { - Tools::redirect($this->context->link->getBaseLink() . 'modules/gsitemap/gsitemap-cron.php?continue=1&token=' . Tools::substr(Tools::hash('gsitemap/cron'), 0, 10) . '&type=' . $new_link['type'] . '&lang=' . $lang . '&index=' . $index . '&id=' . (int) $id_obj . '&id_shop=' . $this->context->shop->id); - } else { - Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true, [], [ - 'tab_module' => $this->tab, - 'module_name' => $this->name, - 'configure' => $this->name, - 'continue' => 1, - 'type' => $new_link['type'], - 'lang' => $lang, - 'index' => $index, - 'id' => (int) $id_obj, - 'id_shop' => $this->context->shop->id, - ])); - } - exit(); - } + $this->recursiveSitemapCreator($link_sitemap, $lang, $index); + if ($index % 20 == 0 && !$this->cron) { + $this->context->smarty->assign([ + 'gsitemap_number' => (int) $index, + 'gsitemap_refresh_page' => $this->context->link->getAdminLink('AdminModules', true, [], [ + 'tab_module' => $this->tab, + 'module_name' => $this->name, + 'continue' => 1, + 'type' => $new_link['type'], + 'lang' => $lang, + 'index' => $index, + 'id' => (int) $id_obj, + 'id_shop' => $this->context->shop->id, + ]), + ]); + + return false; + } + + if ($this->cron) { + Tools::redirect($this->context->link->getBaseLink() . 'modules/gsitemap/gsitemap-cron.php?continue=1&token=' . Tools::substr(Tools::hash('gsitemap/cron'), 0, 10) . '&type=' . $new_link['type'] . '&lang=' . $lang . '&index=' . $index . '&id=' . (int) $id_obj . '&id_shop=' . $this->context->shop->id); + } else { + Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true, [], [ + 'tab_module' => $this->tab, + 'module_name' => $this->name, + 'configure' => $this->name, + 'continue' => 1, + 'type' => $new_link['type'], + 'lang' => $lang, + 'index' => $index, + 'id' => (int) $id_obj, + 'id_shop' => $this->context->shop->id, + ])); } } diff --git a/views/templates/admin/configuration.tpl b/views/templates/admin/configuration.tpl index 959a65e..b9cd1f3 100644 --- a/views/templates/admin/configuration.tpl +++ b/views/templates/admin/configuration.tpl @@ -128,7 +128,9 @@
{l s='-or-' d='Modules.Gsitemap.Admin'}

2. {l s='Automatically:' d='Modules.Gsitemap.Admin'} {l s='Ask your hosting provider to setup a "Cron job" to load the following URL at the time you would like:' d='Modules.Gsitemap.Admin'} {$gsitemap_cron|escape:'htmlall':'UTF-8'}
- {l s='It will automatically generate your XML sitemaps.' d='Modules.Gsitemap.Admin'} + {l s='It will automatically generate your XML sitemaps.' d='Modules.Gsitemap.Admin'}
+ {l s='If you are using a cron job in combination with a command-line tool, such as curl, and your shop is so large to require a large amount of XML sitemap files generated, you might need to modify the tools default redirect limit.' d='Modules.Gsitemap.Admin'}
+ {l s='For example: curl follows up to 50 redirects by default. To increase this number further, you will have to add the parameter "-L --max-redirs 99" to the curl command line in your cron job, which increases the redirect limit to 99 redirects.' d='Modules.Gsitemap.Admin'}

{/if}