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

Regenerate patch files on cache clear #2

Closed
wants to merge 1 commit into from

Conversation

mattwire
Copy link

  1. If the patch doesn't exist we generate it.
  2. If the core file is updated we regenerate it.
  3. If the extension that requires patchwork is updated we don't regenerate patches.

This "fixes" 3 so that a cache clear in CiviCRM will force regeneration of patch files. This is useful because it ensures that the client site is using the latest version of patched files if you issue them with an updated extension as they are usually familiar with "clearing caches". The alternative is to ask them to manually delete the contents of the patchwork directory which may or may not be easy...

@artfulrobot
Copy link
Owner

extension updates should be covered anyway, as it goes on mtime of the file. I agree a 'regenerate now' button would be nice, but I think adding to the already slow clear cache thing is a bit much.

Is it that you're un-tarring extensions and therefore they are retaining original mtimes?

@mattwire
Copy link
Author

Is it that you're un-tarring extensions and therefore they are retaining original mtimes?

patchwork is not checking the mtimes of extension files - only core files. So if you update the extension but not core it doesn't detect changes.

@artfulrobot
Copy link
Owner

I think I need to understand the use case better. Are you using patchwork to patch other extensions' files? (does that even work?)

😕

@mattwire
Copy link
Author

No :-) Simple / standard use-case.

This is the extension: https://github.com/mjwconsult/civicrm-2wish
It configures patchwork to patch 3 core files. But if you update that extension above (eg. because you add a new feature) and you don't update CiviCRM core the patch files won't regenerate unless you delete them manually.

@mattwire
Copy link
Author

Maybe it's meant to pick up the mtime of the overridden core files rather than the original core files?

@artfulrobot
Copy link
Owner

Ah no, I get you.

In which case, I'd prefer an option whereby we provide a 'regenerate all patches' (or possibly a list of them) API action, and then call that in an extension's upgrader.

@mattwire
Copy link
Author

Ok, that sounds good. If you don't mind I'll leave this open until I have refactored per above.

@artfulrobot
Copy link
Owner

Closing in favour of #3

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

Successfully merging this pull request may close these issues.

None yet

2 participants