Jump to content

Recommended Posts

Posted

Hi Ryan,

I just noticed, that if you have programatically changed a page (via API), system seems to ignore this change;

Example:

  • I created page holding some JSON data
  • Although every 12 hours script changes this page, Page still has 'last modified' datestamp of the moment I created it, because every changed from that moment since now was done via API

I'm not sure whether this is intentional, or bug, but it would be nice if system modified the timestamp of last edit via API I think.

As for a user, which is shown (in 'modified ... by USER), there could be anything really – 'API', name of a template via which was this page modified, URL which modified this page... anything would be more helpful then ignored API modification.

Posted

PW updates the last modified date if you call $page->save() or $pages->save($page) -- those two commands functionally identical.

But if you save just one field from a page, like $page->save('body'), it doesn't update the last modified date or anything in the pages table. It only updates the 'field_body' table. Perhaps it makes sense for it to update the pages table too (something to talk about more), but the thought behind the current behavior is this: if you are just saving an individual field, you are likely doing so to limit overhead as much as possible. As a result, PW doesn't considers that a field save, not a page save.

I don't think that there would be much overhead in updating the modified date, so it's something to consider.

I'm not sure how you are seeing it modify the modified_user because the query that updates that is the same one that updates the modified date, and it doesn't get executed when you just save a field (2.1).

For a page save, the last modified user has to correspond go a user in the system. So if you want to show the user as "api" as the last modified user, then you'd have to add a user called "api" and set it to be the current user before you save your pages (full page saves), like this:

Wire::setFuel('user', $users->get('api')); 
Posted

Ah! Although I understand your reasoning, I think that page is modified whenever any of its fields is modified, so I really think that field saving ($page->save('field')) should modify last modified.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...