Jump to content

How to tell if a sub-page has been modified, with no nesting depth limit


CaelanStewart
 Share

Recommended Posts

Hi,

We have a client, who's website has grown quite large now. With a custom blog implementation, various resources sections, 434+ users registered (via a custom, designed registration UI that allows only company/associate employees to register.

There is an accompanying mobile app for it, I have written an API so that the app and ProcessWire can communicate. What I need to do is check if any sub-pages within parent page (with no limit to depth) have been edited with the least processing possible, and the only way I can think of right now is to iterate through the pages, and check every lastEdited date against a set cached dates stored by the app. We just want to reduce the amount of processing required by the apps requests.

Link to comment
Share on other sites

Hi,

If you have a lot of pages, I'd go with a direct SQL query. The query would be something like this:

SELECT id FROM pages
INNER JOIN pages_parents ON (pages_parents.pages_id = pages.id AND pages_parents.parents_id = 'YOUR_PARENT_ID')
WHERE pages.modified > 'YOUR_MODIFIED_DATE'

Cheers

Link to comment
Share on other sites

Hi,

If you have a lot of pages, I'd go with a direct SQL query. The query would be something like this:

SELECT id FROM pages
INNER JOIN pages_parents ON (pages_parents.pages_id = pages.id AND pages_parents.parents_id = 'YOUR_PARENT_ID')
WHERE pages.modified > 'YOUR_MODIFIED_DATE'

Cheers

Hi,

Half an hour after I posted this I came up with a similar solution, except using ProcessWire's Selector API. It's quick enough, and we've throttled the app to only check for new content every couple of hours.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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