Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
path.module
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
24 Apr 2014 at 15:14 UTC
Updated:
21 Sep 2021 at 20:52 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedComment #2
Anonymous (not verified) commentedhere's the initial patch plus something catch put together to stop us looking up a system path when we already have a system path.
here's the diff:
Comment #3
Anonymous (not verified) commentedComment #4
Anonymous (not verified) commenteddoh, fixed $sytem_path typo.
Comment #6
wim leersI wanted to review the patch, but I ended up trying to understand how
AliasManagerandAliasManagerCacheDecoratorwork. I talked to beejeebus, because from reading the patch, it seems that the DB cache will no longer be hit. Turns out he was very confused by the existing code also. So I went on a mission to understand what was going on. The conclusion of that mission:AliasManagerCacheDecoratorabuses implementation details ofAliasManagerto achieve a hacky, partial and undocumented performance winAliasManagerCacheDecoratoris probably fundamentally broken (it uses the wrong cache key to retrieve data from cache)AliasManagerCacheDecoratorwants to preload SYSTEM PATHS (i.e. alias -> source), butAliasManagerwants to preload ALIASES (i.e. source -> alias)… yetAliasManagerCacheDecoratorusesAliasManager's preload functionality, but then of course doesn't yield the desired result, since it's doing the opposite!AliasManager::lookupPathAliasdoes:But
AliasManager::lookupPathSource()(the inverse) also uses$this->lookupMap:and this is how it "kind of" works, except that it then doesn't catch the case of "this already is a system path, you should be smart enough to not do a DB query for these". So I guess it's doing the best it can… but the end result is wildly confusing!
Hopefully it's sufficiently clear that these two classes need a lot of love.
Attached is an initial patch to make it work again and document the most confusing part. beejeebus and I think these classes should pretty much be ripped apart and rewritten, if there's any hope of making this maintainable.
I apologize if I didn't explain it well or too fiercely — my head is still spinning from confusion.
(The previous patches could be applied to this also, but I think it might be better to unbreak things first?)
Comment #8
dawehnerDo we really have a usecase for a static variable here or could we just use a plain old member variable on the object?
Just in general I don't understand why we can't just pull that information manually from a request stack passed as dependency into the cached alias manager.
Comment #9
Anonymous (not verified) commentedComment #10
Anonymous (not verified) commentedthis issue may not fit with the existing work in #2002126: [meta] Refactor the alias subsystem (classes in \Drupal\Core\Path), so might be best to close it.
Comment #11
berdirNot exactly sure what's left of this after #2233623: Merge AliasManagerCacheDecorator into AliasManager is in, but we probably still want to improve the getPathFromAlias() case there as that will still not be cached by the other issue.
Comment #12
jhedstromIf there is work remaining here, the issue summary needs updating.
Comment #13
Crell commentedThe code base has drifted enough that this issue is no longer relevant. If there's other cleanup to do in AliasManager now start a new issue.