URL Rewrite pattern history for deactivated modules.

pelle
pelle's picture

Joined: 2004-12-10
Posts: 389
Posted: Tue, 2005-06-14 22:28

When one deactivate a module that has registered patterns they should be removed from the activeRules list. Currently this can be achived by listening for the event Gallery::DeactivatePlugin, and so far so good. However, upon reactivation we probably should re-activate the old patterns.

Here's my idea of how to go about saving and reactivating patterns:

  • Add an event for Gallery::ActivatePlugin, where we reactivate saved patterns and allow for modules to activate default patterns upon initial activation (eg, the comments module can activate it's URL patterns by default when activated).
  • Add an event for Gallery::UninstallPlugin, where we remove the saved patterns. I see no point in saving a history for an uninstalled module, since the point of uninstall and not just deactivate is that you want to get rid of everything related to the module.

How does this sound?[/]

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-06-16 22:45

sounds fine.. do you think we should activate any other module rules by default? perhaps it is better for admins to see what urls they'll be using?
also, how would you resolve a conflict if comments is active using 'c/' prefix, you deactivate comments, make some other rule use 'c/' and then activate comments? i'm thinking it's probably ok to just throw away the rule from the history list in this case.. just be sure to detect the collision and handle gracefully instead of throwing an error.
yes, your uninstall logic in consistent with how module uninstall should work.. remove everything related to that module.