dokuwiki-plugin-gitbacked icon indicating copy to clipboard operation
dokuwiki-plugin-gitbacked copied to clipboard

Fails to detect changes done by other plugins

Open fama opened this issue 5 years ago • 4 comments
trafficstars

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.

fama avatar Sep 21 '20 23:09 fama

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.

woolfg avatar Sep 23 '20 20:09 woolfg

I looked at the code and with my very limited php experience, it seems:

  1. draw.io action.php does not create any suitable event
  2. 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:

  1. 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.
  2. 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.
  3. There already is a similar functionality with plugin»gitbacked»periodicPull. Maybe a plugin»gitbacked»periodicAddCommit as an option may be helpful to prevent missing backups.

fama avatar Sep 24 '20 19:09 fama

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.

woolfg avatar Oct 08 '20 09:10 woolfg

at least we should find this one https://github.com/woolfg/dokuwiki-plugin-gitbacked/commit/8457ba7e9b7c6f553a9c104f91ea1d6cb48a5c13

ochurlaud avatar Feb 07 '22 22:02 ochurlaud

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?

annProg avatar Jan 24 '23 13:01 annProg

hey @annProg, thanks for the input. I think it would help multiple people. do you want to implement it?

woolfg avatar Jan 25 '23 17:01 woolfg

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

annProg avatar Jan 26 '23 16:01 annProg

also a good solution @annProg , especially a pragmatic one. I will close the issue for now, but can be reopened at any time.

woolfg avatar Apr 18 '23 22:04 woolfg