Last active
December 16, 2015 00:59
-
-
Save orakili/5351866 to your computer and use it in GitHub Desktop.
Drupal XML sitemap cron background batch patch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/xmlsitemap.module b/xmlsitemap.module | |
| index 93e935f..c48ac31 100644 | |
| --- a/xmlsitemap.module | |
| +++ b/xmlsitemap.module | |
| @@ -243,7 +243,16 @@ function xmlsitemap_cron() { | |
| // Regenerate the sitemap XML files. | |
| module_load_include('generate.inc', 'xmlsitemap'); | |
| - xmlsitemap_run_unprogressive_batch('xmlsitemap_regenerate_batch'); | |
| + | |
| + // Try to launch the batch process in the background. | |
| + if (module_exists('background_batch')) { | |
| + $batch = xmlsitemap_regenerate_batch(); | |
| + batch_set($batch); | |
| + background_batch_process_batch(); | |
| + } | |
| + else { | |
| + xmlsitemap_run_unprogressive_batch('xmlsitemap_regenerate_batch'); | |
| + } | |
| } | |
| /** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment