Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Adding option to change cache and tag file suffixes #120

Merged
merged 8 commits into from
Apr 17, 2018

Conversation

Lansoweb
Copy link
Contributor

With this PR we can change the suffix for cache files. One use case is to use the filesystem cache to generate zend-view files (phtml suffixes).

@Lansoweb Lansoweb changed the title Develop Adding option to change cache and tag file suffixes Oct 27, 2016
@marc-mabe
Copy link
Member

Thanks for contributing to zend-cache :)

I understand your use case and it's fine for me even if I think that's a very low used feature but I have one small problem with it:

What happens if the specified suffix contains a special character used by glob?
So you have to escape these characters! PHP doesn't have a function for that but I found one in python

Cheers

@marc-mabe marc-mabe self-assigned this Nov 4, 2016
Leandro Silva and others added 6 commits April 17, 2018 14:23
Notes that they will be escaped to work with glob operations.
This patch achieves two goals:

- It replaces all suffix concatenation with dedicated functions for
  appending the cache file suffix and the cache tag file suffix. These
  each use `sprintf` with the provided filename and the appropriate
  option pulled from `getOptions()`.

- It adds a new method, `escapeSuffixForGlob()`, which is used to escape
  the suffix or tag suffix when creating strings for glob operations.
  This method escapes `*`, `?`, and `[` characters by wrapping them in
  `[]` brackets. This addresses feedback from @marc-mabe.
@weierophinney
Copy link
Member

@Lansoweb I've rebased and incorporated the feedback from @marc-mabe .

@Lansoweb
Copy link
Contributor Author

@weierophinney Great. Thanks!

Bad merge brought it back; removed again.
Was incorrectly using `getFileContent()` instead of `getFileSpec()` when
determining file name.
@weierophinney
Copy link
Member

Filesystem adapter unit tests run properly, so going to go ahead and merge to develop.

@weierophinney weierophinney merged commit 9dde490 into zendframework:develop Apr 17, 2018
weierophinney added a commit that referenced this pull request Apr 17, 2018
@weierophinney
Copy link
Member

Thanks, @Lansoweb!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants