eZ Community » Blogs » Brookins Consulting » Mastery of eZ Publish Cronjob Mode...

By

Mastery of eZ Publish Cronjob Mode and Cronjob Part Subtree Content Fetches!

Sunday 12 October 2014 12:05:15 am

  • Currently 4 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Hello eZ Community! We write today to talk to you briefly about a little known feature in eZ Publish Legacy called 'Cronjob Mode'.

The introduction

We were working on some bugfix improvements for bcgooglesitemaps [0] internationalization when we first discovered this feature.

This feature has been part of eZ Publish Legacy since around eZ publish version 3.8.0.

Before our cronojob part bugfixes, the cronjob in bcgooglesitemaps would generate a sitemap with content in all available languages ignoring our fetch subtree parameters to fetch content only in siteaccess specific languages.

For us and a fellow eZ Publish Legacy Community Project release user this was a pretty big bug for multilingual installations that had never been reported before.

After exhaustive multilingual testing we found a solid solution which righted this wrong both quickly and painlessly.

We will share just how to use this feature to provide you more granular control to your content subtree fetches.

 

About Cronjob Mode

The 'Cronjob Mode' is enabled by default on all eZ Publish Legacy cronjob parts. [1]

The 'Cronjob Mode' does one thing that most people who know eZ Publish do not know about, it overrides your fetch parameters and fetches content in all available / possible languages (all content).

This is a problem if you are say using an eZ Publish cronjob part to fetch only specific content in a specific set of languages of a multilingual content tree.

For the record eZ Publish cli scripts are not affected by this feature as it is specific to cronjob parts only.

 

A solution

The solution for us working on internationalization bugfix improvements to bcgooglesitemaps was to 'clear' cronjob mode (disable cronjob mode) [2,3].

/**
 * BC: In testing multi-lingual sites with single language siteaccess installations
 * we have found it is typically best for the cronjob mode to be disabled. Otherwise
 * content in all possible languages is returned in subtree results.
 */
eZContentLanguage::clearCronjobMode();

This allowed our existing subtree content fetch to return only the content in specific languages we were requesting in the fetch parameters.

 

Summary

So if your using an eZ Publish cronjob part, need to fetch only specific content language content and not content in all available languages then remember to use the above code snippet at the top of your cronjob part php code.

Thank you for reading this post and learning a bit more about eZ Publish.

Have a brilliant weekend :)

Cheers,
Brookins Consulting

 

References

Proudly Developed with from