Rather than ask to the user to manually rebuild the sitemap content, it would be good if the code would do it automatically.

Maybe it's a silly idea, but creating a file similar to cron.php could be a solution; the file would be invoked from cron, in the same way cron.php is normally invoked, and it would rebuild the sitemap cache files.

Comments

dave reid’s picture

The module never asks a user to manually rebuild the sitemap. It should only show a warning when cron hasn't run when it should, hence it needs a manual rebuild. xmlsitemap_node and xmlsitemap_menu() both implement hook_cron() which adds content at cron, and xmlsitemap_node adds the node links when they are created.

avpaderno’s picture

Title: Provide a system to automatically rebuild the content of the sitemap » Provide a system to generate the cache files before the sitemap is viewed

I ask my apologies; I thought that the warning meant that the module needed to rebuild the sitemap cache files.

By manually rebuild I meant the same thing you mean by manual rebuild; I didn't mean the module is asking the user to create himself the sitemap (even if that would not be a bad idea ;-)).

The point is that the code does create cache files that are then served when the sitemap content is requested. Those cache files are created when the menu callback xmlsitemap_output() is invoked, and it calls xmlsitemap_generate($chunk).

dave reid’s picture

It only tries to do it if 1. the cache files don't currently exist or 2. if the users goes to sitemap.xml?refresh and has the 'administer xmlsitemap' permission. The second reason is mostly for testing and development right now. Even then, it will only generate a the specific sitemap chunk and not all the pages.

dave reid’s picture

Status: Active » Fixed

The system to generate the files on cron already exists. The current code in xmlsitemap_output_chunk() is mostly for testing and development purposes and should not execute for normal users. As such, I am marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.