on_page_update not fired

Permalink
I'm trying to use on_page_update to hook into the update process but it never gets called.

(ENABLE_APPLICATION_EVENTS is enabled)

Page::update never gets called too and due to this the event doesn't get fired...

Any ideas why Page::update isn't used when I "update" the page"?

Thanks!

Remo
 
Remo replied on at Permalink Reply
Remo
Okay, I think I get the impression that Page::update is only used for metadata and not the actual page content update.

When I look at startup/process ~line 716 you should find an update but it only gets called if you change page properties.

The documentation isn't very clear about it:
http://www.concrete5.org/help/building_with_concrete5/developers/mv...

Can anyone confirm this?
Is there a way to hook into the "real update process"?
Remo replied on at Permalink Reply
Remo
is there really no one interested in helping me to improve c5's performance?
okhayat replied on at Permalink Reply
okhayat
Very true. It's only fired when you update meta_data.
IMHO, we need to know (or define) what to be considered a page update. Could be:
- A page's (collection) direct updates, e.g. page properties, permissions, versions, design, and maybe other stuff.
- Any update related to the page, e.g. block add/remove/edit
My 2 cents: Since most of the work is actually on block level, it may help to have block level events, from which you can derive the page where the block is located, and then do the required action.
ScottC replied on at Permalink Reply
ScottC
i think on block's parent collection version update might be more appropriate as that would encompass any meaningful change to a page object and thus it's collection via it's area and block associations.
okhayat replied on at Permalink Reply
okhayat
Another thing. Since there is a on_page_version_approve, this may help a little in knowing of change.
Remo replied on at Permalink Reply
Remo
Thanks, already found it yesterday, added a comment in the doc section. It seems to work just fine.
ScottC replied on at Permalink Reply
ScottC
thanks for adding that Remo. I almost dropped a bunch of code before seeing that one. In my case on_page_add wouldn't be useful in my case as a page/collection is added with zero content which while useful in some instances wouldn't be for what I am looking at doing, more about actually approved content.
ScottC replied on at Permalink Reply
ScottC
or if a page is added and is approved and thus actually on the site. Okhayat I wanted to personally thank you for bringing that inadvertenly to my attention as that is exactly the event I wanted to tie into.

-Scott
okhayat replied on at Permalink Reply
okhayat
Thank Remo :) I really just noticed his comment, tested it, and mentioned it here!
dvodvo replied on at Permalink Reply
dvodvo
This thread ended a little specifically -- on_page_version_approve is nice but not always all we need. For example I currently have a client wanting admin users to be notified when an underling makes updates to a page (and that page becomes pending approval). Clearly on_page_version_approve is useless to me as I need something triggered before that.

Any ideas?
dvodvo replied on at Permalink Reply
dvodvo
So given I'm under a tight schedule, I hacked in my mailing routine to run from the check-in process script under the else condition, which is for these purposes thrown when a user hits Preview My Edits. Not very elegant, but it'll do the job for now.

If anyone else feels like doing the work to find a more graceful way to invent this event, please feel free to post.
Mnkras replied on at Permalink Reply
Mnkras
then use on_page_update
jordanlev replied on at Permalink Reply
jordanlev
Mnkras, check out the first few posts in the thread -- on_page_update only fires when metadata is updated, not page content itself.
Mnkras replied on at Permalink Reply
Mnkras
lemme check that...

i thought that since this post is really old it was most likely fixed ;)
Mnkras replied on at Permalink Reply
Mnkras
just checked the code in the trunk, and it looks like it should fire, look at the update function in /models/page.php its at the bottom of the function
dvodvo replied on at Permalink Reply
dvodvo
Should, but don't!
synlag replied on at Permalink Reply
synlag
ok,
so anyone figured it out already?

I'm generating blocks dynamically on page properties and want them to get updated if page properties have changed.
5fly replied on at Permalink Reply
5fly
Looks like this thread stopped a while back... but just wondered if anyone figured out how to catch a page_update (i.e. a block is amended)?
5fly replied on at Permalink Reply
5fly
Sorry - Just answered my own question... on_page_version_approve