YahnisElsts / plugin-update-checker

A custom update checker for WordPress plugins. Useful if you don't want to host your project in the official WP repository, but would still like it to support automatic updates. Despite the name, it also works with themes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exclude repo file when updating my plugin

nebestudio opened this issue · comments

Hello,

is there a way when updating a plugin with the repo content on github to exclude one settings file? It should be not synchronised, neither deleted.

When having this settings file (settings.php) in my plugin and update the plugin, it gets deleted every time, although I have .gitattributes file in my github repo with this content "settings.php export-ignore".

Thanks in advance!

It's been a while since I've looked at the relevant part of WordPress core, but I think that the WP plugin updater deletes the entire directory of the old version before installing a new version. So you can't preserve a file in the plugin directory even if the update doesn't include a new version of that file. It will get deleted anyway.

If you really have to keep a specific file unchanged, you might have to write a custom plugin update installer. PUC doesn't handle that part, it just hands the update to WordPress core.