Override generate_sitemap job in 5.6.3.3
Permalink
I can't get a job override working in 5.6.3.3.
I have a generate_sitemap.php file in the root /jobs folder with this code:
The only changes are the few lines between the KRD comments.
The override appears in Environment, but it's pretty clear the core file is still being used to generate the sitemap.
What am I missing?
I have a generate_sitemap.php file in the root /jobs folder with this code:
<?php defined('C5_EXECUTE') or die("Access Denied."); class GenerateSitemap extends Concrete5_Job_GenerateSitemap { private static function addPage($xmlDoc, $cID, $instances) { $page = Page::getByID($cID, 'ACTIVE'); // KRD: exclude all pages in /r/ directory $cPath = $instances['navigation']->getLinkToCollection($page); if (strpos($cPath, '/r/') !== false) return; // end KRD if($page->isSystemPage()) { return; } if($page->isExternalLink()) { return; }
Viewing 15 lines of 62 lines. View entire code block.
The only changes are the few lines between the KRD comments.
The override appears in Environment, but it's pretty clear the core file is still being used to generate the sitemap.
What am I missing?
Do you need to clear the overrides cache?
Tried clearing all the caches and turned off all the caches, with no success.
I'm not totally sure I'm using the right class names and structure. Seems right, but I'm hoping someone who has done it before with 5.6.3.3 can verify that.
I made a small change to the core generate_sitemap.php file to test whether that was the version being used, and it is. Rats.
I'm not totally sure I'm using the right class names and structure. Seems right, but I'm hoping someone who has done it before with 5.6.3.3 can verify that.
I made a small change to the core generate_sitemap.php file to test whether that was the version being used, and it is. Rats.
The filename and class look OK. The environment report is generated in a completely different way to overrides, so doesn't mean that much.
I have never tried to override a job (always simply created a new job, even if it inherited from a core job), so I don't have experience of a job override working or not.
I have never tried to override a job (always simply created a new job, even if it inherited from a core job), so I don't have experience of a job override working or not.
Just a thought. Maybe you could uninstall the core job, then use the 'restore jobs' addon to reinstall. Perhaps the override is only worked out at install time. Take a backup first just in case....
Thanks for the replies and the attention. I think I might just find another way around the issue entirely.
I had a play with this and couldn't get it to work either. I have reported a bug at
https://www.concrete5.org/index.php?cID=751781...
if you would like to add anything to or confirm the bug report.
https://www.concrete5.org/index.php?cID=751781...
if you would like to add anything to or confirm the bug report.
Thanks, John. I added a comment to the bug report.
I can't seem to find any obvious documentation on overriding an automated job so I'm truly stuck on this one. Hoping someone with more c5 know-how can save the day with a quick tip!