Jump to content

Recommended Posts

Posted

I have some functionality on an intranet site that uses Lazy Cron to query an external API and then update a bunch of pages based on the API response.
 
A problem I've noticed is that this breaks our author / editor tracking – whenever a user triggers the Lazy Cron job, the page metadata for `$page->modified` and `$page->modifiedUser` is (naturally) updated, so it now looks like that user edited the page at that moment in time, even if the content of the page was edited months ago by someone else.

It seems like the ideal solution here would be to somehow exempt certain fields (the ones that get updated by this external API) from triggering a timestamp update... Any ideas on how I'd go about hooking into that?

Posted

Looks like saving the Page 'quietly' is sufficient.

<?php
// 'quiet' => boolean - When true, modified date and modified_users_id won't be updated
$pages->save($your_page, array(quiet => true));
  • Like 6

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...