Currently, when you delete a server, all indexes that are linked to it will be removed as well.
Needless to say, this is not what we want. We want to just remove the indexes from the server (thus disabling them), but keep them intact.
I think that just moving the parent::preDelete()
call to the end of the method in \Drupal\search_api\Entity\Server::preDelete()
could be enough to solve this problem, since the parent method is what deletes the dependent configs (i.e., indexes, in this case).
On the other hand, there is also code to update dependent configs there, so maybe the cleanest way would be to move our custom preDelete()
code in some way to be used by this system (which seems to make it possible to change dependencies on the fly when they are removed – heard of this before, but it wasn't implemented back then).
Comment | File | Size | Author |
---|---|---|---|
#3 | 2473725-3--on_dependency_removal--interdiff.txt | 6.56 KB | drunken monkey |
#3 | 2473725-3--on_dependency_removal.patch | 5.57 KB | drunken monkey |
Comments
Comment #1
p-neyens CreditAttribution: p-neyens commentedComment #2
p-neyens CreditAttribution: p-neyens commentedMove clear server functionality to Index::onDependencyRemoval().
Added integration test for server delete.
Comment #3
drunken monkeyGreat job, looks very good! Thanks a lot for the help!
I just want to change a few details, but basically this is RTBC for me.
Updated patch and interdiff attached, if the test bot is happy I'll commit.
Comment #4
drunken monkeyCommitted.
Thanks a lot again!