-
Notifications
You must be signed in to change notification settings - Fork 29
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
IBX-3957: Made NOP URL aliases not reusable and original #385
Conversation
@barw4 as discussed internally, please add some integration coverage for the case this issue solves so I can analyse this further. At this point I'm not sure what would be the side effects here. Looks like we're just missing some coverage. |
eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/Handler.php
Outdated
Show resolved
Hide resolved
// Renamed content should have '/c2' path alias | ||
$lookupRenamed = $urlAliasService->lookup('C2'); | ||
|
||
self::assertSame('/C2', $lookupRenamed->path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now I know what's happening here. The end result is unfortunately the opposite of what the PR describes. A reusabe entry is the same entry either used for multiple purposes or that was repurposed. The changes you made here made effectively NOP entries NOT reusable. They're left behind as-is and the secondary entry gets created and named C2 according to the unique naming URL Alias logic.
The flow after the changes:
/a/b
-> normal URL alias,a
andb
corresponding content items exist/c/b
-> custom URL alias,c
isNOP
because there's noc
corresponding content- Rename
a
toc
/c2
now points to renamed content,/c
is still a NOP entry therefore it wasn't reused.
What we'd want if we wanted to keep re-usability logic would be:
- Rename
a
toc
/c/b
becomes normal URL alias sincec
corresponds now to proper content node/a/b
-> is a historical entry redirecting to/c/b
.
The issue with that is that renaming a
to c
causes custom URL alias being overridden and incorrectly cleaned up.
id | parent | text | action | alias_redirects | is_alias | is_original | link
----+--------+------+-----------+-----------------+----------+-------------+------
43 | 42 | b | eznode:63 | 0 | 0 | 1 | 43
45 | 44 | b | eznode:63 | 0 | 1 | 1 | 45
42 | 0 | c | eznode:62 | 1 | 0 | 1 | 42
46 | 0 | a | eznode:62 | 0 | 0 | 0 | 42
Notice that id=44
referenced in parent column is missing. It's supposed to be cleaned up via \eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway::cleanupAfterPublish
but that neven happens because it's an edge case not considered before.
That being said, maybe your change is good, but what we're doing is actually making NOP not reusable, which is behavior change. Going with the fix for cleanup, even if possible, might lead to another issue - I'm not sure how system is going to behave if custom /c/b
points to completely different Location. Then making it not reusable would make more sense.
Maybe this is something we can discuss with @adamwojs and @ezsystems/php-dev-team before we decide what direction we should take? Or is it clear for everyone and we can move forward with @barw4's fix and just change the wording?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is obviously a naming mistake, you are correct. I relied too much on that comment above the if
(https://github.com/ezsystems/ezplatform-kernel/pull/385/files#diff-d640f4389daf07a7bd0a474b4181c7b97c2c3208d172269c69fa59151e1fe014L232) and confused myself. My intention was that an alias would get incremented with uniqueCounter++
and I therefore treated it as 'reusable', because it gets incremented (reused, right?😺). Sorry about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test improved in bd4088e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, URL alias nomenclature was never easy or straightforward ;)
Now we need to decide if that's the change that we really want. Will discuss this with the Team and probably Adam.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ok now, but I need to talk to Adam to make final decision, before giving approval.
0efb8b4
to
7c46168
Compare
Quality Gate passedIssues Measures |
Closing in favor of ibexa/core#350 ( |
v3.3
Reasoning: because
nop
aliases are not original and they are reusable creating another alias with the same name will break such an alias, however, imo it should be incremented instead. This will prevent creating exactly the same alias with the same parent and as a result, breaking the old one.Checklist:
$ composer fix-cs
).@ezsystems/engineering-team
).