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).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

p-neyens’s picture

Assigned: Unassigned » p-neyens
p-neyens’s picture

Status: Active » Needs review
FileSize
3.58 KB

Move clear server functionality to Index::onDependencyRemoval().
Added integration test for server delete.

drunken monkey’s picture

Great 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.

drunken monkey’s picture

Status: Needs review » Fixed

Committed.
Thanks a lot again!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.