Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with move plugin changes #233

Open
glensc opened this issue Apr 5, 2023 · 9 comments
Open

Help with move plugin changes #233

glensc opened this issue Apr 5, 2023 · 9 comments

Comments

@glensc
Copy link

glensc commented Apr 5, 2023

I'm maintaining a notification plugin:

how to handle page moves more efficiently? as currently each page move sends two events:

  • create
  • delete

image

The plugin is listening to COMMON_WIKIPAGE_SAVE event:

$controller->register_hook('COMMON_WIKIPAGE_SAVE', 'AFTER', $this, 'handleSave');
@glensc
Copy link
Author

glensc commented Apr 6, 2023

maybe somehow DOKUWIKI_DONE event could help:

like collect the events to an array, and when DOKUWIKI_DONE is invoked empty that array in memory.

but from my testing, DOKUWIKI_DONE and COMMON_WIKIPAGE_SAVE are fired in different processes, so memory caching will not work. would need to store to filesystem.

@michitux
Copy link
Owner

michitux commented Apr 6, 2023

One idea could be to use an event that has the before handler called before the move happens and the after handler after the move completed. Your event handler could then ignore or summarize the events (I mean the deletion of the old and creation of the new page) that happen in between the before and after event handler. I'm not sure if such an event already exists, but if not, it could be added.

@glensc
Copy link
Author

glensc commented Apr 8, 2023

this is dump of events fired during rename of one page

@michitux
Copy link
Owner

michitux commented Apr 8, 2023

Are you sure that's from the move plugin and you aren't using another plugin for renaming the page? I'm asking because the move plugin fires an event before and after the move (which you could also use to combine the events as I wrote before): https://github.com/michitux/dokuwiki-plugin-move/blob/master/helper/op.php#L158 - and I cannot see that event in the log.

@glensc
Copy link
Author

glensc commented Apr 10, 2023

I renamed via simple rename:

@glensc
Copy link
Author

glensc commented Apr 11, 2023

The native page notification suffers the same problem, sends out two emails:

  • page added: organisations: ↷ Page moved from support:organisations to organisations
  • page changed: support:organisations ↷ Page moved from support:organisations to organisations

@glensc
Copy link
Author

glensc commented Apr 16, 2023

🚧 Never link to branches, share a permalink 🚧

NOTE: edit your post and fix it with a permalink!

@glensc
Copy link
Author

glensc commented Apr 16, 2023

Found that PLUGIN_MOVE_PAGE_RENAME::BEFORE is called, but if an error occurs, there's no knowledge of that to the event listener. so could lose messages.

EDIT: irrelevant: no move actually happens on error.

for I'm running on arm64 with rosetta2 so the indexes is super slow, and rename page gets index locked errors: "Error while updating the search index locked"

@glensc
Copy link
Author

glensc commented Apr 16, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants