How can I prevent my plugin updates from clobbering the user edits and file additions in a particular subdirectory of my plugin?
I wrote a syntax highlighting plugin that makes use of GeSHi. A sub folder of the plugin is GeSHi itself. Many users will want to customize / edit the language files within GeSHi.
Specifically here is the directory structure:
- wp-contente/plugins/my-plugin/
- several subdirectories etc
- wp-content/plugins/my-plugin/geshi/geshi/
- users are going to add files to this directory
- they will also edit files in this directory
- when they pick up their new updates I don’t want to erase their edits
What’s the best way of solving this?
Thanks!
Here’s what I was thinking, but I don’t know how to implement:
- On the update plugin action hook (?) make a temporary copy of the files I want to preserve.
- Get the new version unzip and install like usual
- Copy the preserved files from the temp copy to the new version
- Remove the temp copy
Ideally this would all be done with files, but worst case scenario I could save data to the DB.
Problem is I don’t see hooks for plugin updates. I looked here and here.