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

Bug :: Watered-Down Regex Syntax #611

Closed
jaswrks opened this Issue Nov 13, 2015 · 8 comments

Comments

Projects
None yet
3 participants
@jaswrks
Member

jaswrks commented Nov 13, 2015

There is still room for improvement in these routines. I am already seeing the potential for minor conflicts between the intended functionality (i.e., what we have in the article) vs. what actually takes place.

@jaswrks jaswrks added the bug label Nov 13, 2015

@jaswrks jaswrks referenced this issue Nov 13, 2015

Open

Watered-Down Regex Syntax #94

7 of 7 tasks complete
@raamdev

This comment has been minimized.

Contributor

raamdev commented Dec 18, 2015

@jaswsinc Could you clarify for me what the bug is here?

@jaswrks

This comment has been minimized.

Member

jaswrks commented Dec 18, 2015

The ^ and $ characters are not supported in:

  • Dashboard → ZenCache → Automatic Cache Clearing → XML Sitemap Patterns
    The ^ and $ characters are not supported there. The KB article says they are, but in truth that is not the case.
  • The same is true for Custom URLs that you list and/or for a Specific URL that you give ZC.

Referencing: this line and this line.

The reality is that in these use cases, the ^ and $ are always applied, no matter what you enter.


So that's why I opened this issue, because I remember reading over the KB article and reviewing the new descriptions that we gave in the ZC UI. I was concerned that suggesting the use of ^ and $ in those areas would lead to unexpected results internally.


However, now that I'm taking a closer look, I think it's fine.

Scratch that. It's not fine. Ugh, this is a confusing issue, because most of the time it's fine. However, there are some example use cases I can think of where a site owner (e.g., one who thinks that ^ and $ are supported in these areas), might write their patterns without them; i.e., expecting that /something/ implies **/something/**, when it in fact in is handled internally as ^/something/$

For instance, what if a site owner wants to clear this specific URL?

/a/path/to/something/

Internally, that is translated into:

^/path/to/cache/directory/.../a/path/to/something/$

So for that reason, in the areas that I listed above, that pattern would need to be written as:

**/a/path/to/something/**

Why? Because we have a couple of routines in ZenCache where ^ and $ are stripped from your pattern, and then forced into play whenever a directory scan is done.


What needs to change?

I'm not entirely sure yet.

  • A quick fix might be to update the article and the dashboard panels for those areas.
  • A better fix would be to update the codebase so that these patterns are applied as they should be. However, there might be some hoops we need to jump through in order to pull that off; i.e., it appears to me that implementing this could take some work. It's not going to be a quick fix.
@raamdev

This comment has been minimized.

Contributor

raamdev commented Dec 18, 2015

@jaswsinc Got it. Thanks so much for clarifying the issue. Perfectly clear now. :-)

@raamdev raamdev removed the needs feedback label Dec 18, 2015

@raamdev raamdev added this to the Next Release milestone Nov 15, 2016

@raamdev

This comment has been minimized.

Contributor

raamdev commented Nov 15, 2016

@jaswsinc writes...

A better fix would be to update the codebase so that these patterns are applied as they should be. However, there might be some hoops we need to jump through in order to pull that off; i.e., it appears to me that implementing this could take some work. It's not going to be a quick fix.

Could I get an estimate on that?

@raamdev raamdev modified the milestones: Future Release, Next Release Nov 15, 2016

@jaswrks

This comment has been minimized.

Member

jaswrks commented Nov 16, 2016

Approx. 1 day of refactoring.

jaswrks referenced this issue in websharks/comet-cache-kb Dec 8, 2016

jaswrks pushed a commit to websharks/comet-cache-pro that referenced this issue Dec 8, 2016

jaswsinc
Enhancing multibyte support and improving inline docs. There are now …
…warnings in the inline docs about using `^` and `$` as a part of the Watered-Down Regex syntax; i.e., there are specific config. options in Comet Cache where those special characters should not be used. I also updated the official KBA about Watered-Down Regex to make note of it there too. See: websharks/comet-cache#611

@jaswrks jaswrks referenced this issue Dec 8, 2016

Merged

PR: feature/611 #299

@jaswrks

This comment has been minimized.

Member

jaswrks commented Dec 8, 2016

I updated the inline docs to make note of the exceptions; i.e., I improved the instructions provided to a user for each field where ^ and $ are tricky and should not be used. I also updated this KBA: https://cometcache.com/kb-article/watered-down-regex-syntax/

@renzms

This comment has been minimized.

renzms commented Dec 15, 2016

@raamdev

Multibyte support Confirmed as working

Front End Cache notes and Post
Cache has been generated.
screen shot 2016-12-15 at 8 55 00 pm

Updating Post with Emoji in URL
Cache is automatic cleared when post is updated.

screen shot 2016-12-15 at 8 56 19 pm

Front End Cache notes
Cache has been updated.

screen shot 2016-12-15 at 8 57 49 pm

raamdev added a commit that referenced this issue Dec 21, 2016

Phing release of v161221 with the following changes:
- **Bug Fix:** Improving PHP OPcache detection. Now considering the INI option `opcache.restrict_api`. Comet Cache is now smart enough to avoid generating the PHP Warning: _PHP Warning: Zend OPcache API is restricted by "restrict_api" configuration directive_. See [Issue #733](#733).
- **New Feature (Pro): Mobile Mode.** This release adds a new feature that is designed to improve compatibility with Adaptive themes for mobile devices. To learn more, please see: **Dashboard → Comet Cache Pro → Plugin Options → Mobile Mode**. See also: [Issue #471](#471).
- **Enhancement: Auto-Clearing Author Page Cache.** This release makes Comet Cache smart enough to detect when a user is deleted (or removed from a child blog in a Network), at which time the Author page for that user will be cleared from the cache so it can be regenerated automatically. See [Issue #304](#304).
- **Enhancement: Multibyte Compatibility.** This release improves support for WordPress Permalinks that contain UTF-8 symbols (or emojis) in them. More specifically, this release adds the `/u` flag to all `preg_*()` calls in cache clearing routines that generate cache paths from Watered-Down Regex patterns entered by a site owner. See: [Issue #611](#611).
- **Enhancement: Widget Change Detection.** Comet Cache can now detect when **Appearance → Widgets** are added/edited/removed, and Comet Cache will automatically clear the cache so that your site remains up-to-date. See [Issue #411](#411).
- **Enhancement (Pro): Static CDN Filters and `srcset`.** This release enhances Static CDN Filters in Comet Cache Pro. Static CDN Filters are now smart enough to filter all image sources included in an `srcset=""` attribute that is generated by WordPress. See [Issue #660](#660). If you'd like to learn more about `srcset=""`, see [this article at WordPress.org](https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/).
- **Enhancement (Pro): Automatic Background Updates.** It is now possible to enable automatic background updates that occur quietly in the background whenever new features, bug fixes, or security issues are addressed by our developers. See: **Dashboard → Comet Cache Pro → Config. Options → Update Credentials**. See also: [Issue #827](#827).
- **Enhancement (Pro): HTML Compressor + Accelerated Mobile Pages (AMP).** Updated to the latest available release of the HTML Compressor (v161208) with improved support for [Accelerated Mobile Pages](https://www.ampproject.org/). See: [Issue #695](#695). See also: [HTML Compressor v161208 changelog](https://github.com/websharks/html-compressor/releases/tag/161208).
- **Enhancement (Pro): HTML Compressor / AMP Compatibility.** Improved compatibility with [Accelerated Mobile Pages](https://www.ampproject.org/). There is a new HTML Compressor option that is enabled by default and it makes Comet Cache smart enough to auto-detect and selectively disable portions of the HTML Compressor that are incompatible with the AMP spec; i.e., routines that are not necessary when serving APMd pages. In short, if the URI being compressed ends with `/amp/`, or the document contains a top-level `<html ⚡>` tag (`<html amp>` is accepted as well), then features which are incompatible with [Accelerated Mobile Pages](https://www.ampproject.org/) will be disabled accordingly.
- **Compatibility:** Avoid deprecated `wp_get_sites()` and use `get_sites()` instead. See [Issue #848](#848).
- **Documentation:** Added Watered-Down Regex documentation notes to the inline documentation (in the software) about the use of `^` and `$` in some places where these special characters are not fully supported. Also adding the same notes to the [Watered-Down Regex KB Article](https://cometcache.com/r/watered-down-regex-syntax/). See also: [Issue #611](#611).
@raamdev

This comment has been minimized.

Contributor

raamdev commented Dec 21, 2016

Comet Cache v161221 has been released and includes changes from this GitHub Issue. See the v161221 announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#611).

@raamdev raamdev closed this Dec 21, 2016

@websharks websharks locked and limited conversation to collaborators Dec 21, 2016

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