Skip to content

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

@akhamuliak

Description

@akhamuliak

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"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions