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

[Feature Suggestion] Mount points caching additional check. #590

Open
akhamuliak opened this issue Jan 9, 2018 · 0 comments
Open

[Feature Suggestion] Mount points caching additional check. #590

akhamuliak opened this issue Jan 9, 2018 · 0 comments

Comments

@akhamuliak
Copy link

I faced an issue which caused redirect loop with simple mount points usage.

At some of mounted pages I got redirect loop, caused by wrong url data cache.

Steps to reproduce:

  1. Create mount point page which refers to some other page with same names, but on different level and sub-tree.
  2. Change page from MP to standard page
  3. Open that page (so cache will be written)
  4. Change it back to mount point

Obviously that simple RealUrl cache clearing for that page will solve the issue.

But in some cases cache was written even without that manipulation (which, unfortunately, I was unable to reproduce it, but it happens again after full realurl cache clearing, so still there can be some other issue which causes cache writing to mount point page with my or realurl configuration).

Reason of it was that method getUrlFromCacheBySpeakingUrl (DatabaseCache.php line 213) founds it as last written cache with such speaking url and select it, which causes redirect loop. because mount point refers to itself.

So I thought that possible workaround solution could be adding some additional check of cache candidates into that method.

Something like it could solve the issue:

$targetPage = $this->databaseConnection->exec_SELECTgetRows('doktype', 'pages',
   'uid =' . (int)$rowCandidate['page_id']
);

// check if target page doktype is mount point. If yes - skip this cache entry
 if ($targetPage[0]['doktype'] == 7) {
    continue;
}

That will 100% solve that kind issues in any case, even if it's caused just by wrong usage. Mount point page is not cached anyway, so it's wrong to take cache from that page as result even if this is a last written record with such speaking url.

Or, maybe add some hook for such kind of cache "exclude"?

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

No branches or pull requests

1 participant