fix(arch-a2): deactivation cleanup - container services, search provider, hook deregistration, notification sync, task state, activation order
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
@@ -27,9 +27,9 @@ class WikiPlugin(BasePlugin):
|
||||
try:
|
||||
from app.plugins.builtins.contracts import get_contract
|
||||
search_contract = get_contract("unified_search")
|
||||
if search_contract and hasattr(search_contract, "register_provider"):
|
||||
if search_contract and hasattr(search_contract, "get_search_registry"):
|
||||
from app.plugins.builtins.unified_search.providers.wiki_provider import WikiSearchProvider
|
||||
search_contract.register_provider(WikiSearchProvider())
|
||||
search_contract.get_search_registry().register(WikiSearchProvider())
|
||||
logger.info("Registered WikiSearchProvider via contract")
|
||||
else:
|
||||
logger.warning("unified_search contract not available, skipping WikiSearchProvider registration")
|
||||
@@ -37,6 +37,17 @@ class WikiPlugin(BasePlugin):
|
||||
logger.exception("Failed to register WikiSearchProvider")
|
||||
|
||||
async def on_deactivate(self, db, service_container, event_bus) -> None:
|
||||
from app.core.hooks import unregister_actions_by_owner
|
||||
unregister_actions_by_owner("wiki")
|
||||
from app.core.hooks import get_hook_registry
|
||||
get_hook_registry().unregister_all_for_plugin("wiki")
|
||||
|
||||
# Unregister the search provider registered in on_activate (ARCH-012).
|
||||
try:
|
||||
from app.plugins.builtins.contracts import get_contract
|
||||
search_contract = get_contract("unified_search")
|
||||
if search_contract and hasattr(search_contract, "get_search_registry"):
|
||||
search_contract.get_search_registry().unregister("wiki_article")
|
||||
logger.info("Unregistered WikiSearchProvider via contract")
|
||||
except Exception:
|
||||
logger.exception("Failed to unregister WikiSearchProvider")
|
||||
|
||||
await super().on_deactivate(db, service_container, event_bus)
|
||||
|
||||
Reference in New Issue
Block a user