dokuwiki-plugin-gitbacked
dokuwiki-plugin-gitbacked copied to clipboard
Fails to detect changes done by other plugins
We have two plugins that gitabacked fails to detect:
- Draw.io plugin: The plugin will create a .png file in the media folder. But gitbacked does not detect the new file and thus it's not added to the git repo.
- Move Plugin: The new location of the files is not detected by gitbacked and thus also does not get backed up.
I think the solution may be to periodically add all files in the pages and media folders. Similarly as doing periodic git pull if enabled in the configuration.
I guess there are two options:
- implement all hooks that are missing to track all changes of other plugins (this depends on the plugins and the plugins have to call hooks)
- a periodic commit which is imho not that clean as it could lead to non intended behaviour
@fama, do you have any information about the plugins if the call any hooks when creating files? I think this would be the clean solution. Plugins should call hooks and other plugins can react to it.
I looked at the code and with my very limited php experience, it seems:
- draw.io action.php does not create any suitable event
- dokuwiki-plugin-move's op.php seems to use an event
PLUGIN_MOVE_MEDIA_RENAME. Not sure if this is helpful.
I do like the periodic add/commit solution because:
- Config already specifies in which paths to ignore
plugin»gitbacked»ignorePaths. All the other newly created pages and media files get backed up upon creation/update anyway. - There may be other plugins now or in the future that my not be firing events and thus running into the same risk of missing backup.
- There already is a similar functionality with
plugin»gitbacked»periodicPull. Maybe aplugin»gitbacked»periodicAddCommitas an option may be helpful to prevent missing backups.
I see, maybe as an optional feature it could solve some issues, true. @fama, would you be up to develop this feature and send a Pull Request? It would help the project and the community a lot. I can also give some guidance when needed.
at least we should find this one https://github.com/woolfg/dokuwiki-plugin-gitbacked/commit/8457ba7e9b7c6f553a9c104f91ea1d6cb48a5c13
I feel stuck when submit. Every submit need wait at least 5 seconds.
When pushAfterCommit not checked, only need less then 40ms.
So, for performance reason, please support periodic push.
Or, is there some alternative method to push commit?
If I set pushAfterCommit to false, when to push commit?
hey @annProg, thanks for the input. I think it would help multiple people. do you want to implement it?
hey @annProg, thanks for the input. I think it would help multiple people. do you want to implement it?
I have implemented periodic push with crontab, and it works quite well, maybe there is no need to implement it in the plugin
also a good solution @annProg , especially a pragmatic one. I will close the issue for now, but can be reopened at any time.