drupaldrupal-6drupal-hooks

Preventing enable/disable of module via .install file


I've written a module that depends on an overridden value in $conf in settings.php. Specifically, it's a custom session handler set in $conf[session_inc]

This override needs to be present for the module to work and definitely needs to not be present when the module is disabled/uninstalled.

Is there anyway to stop the enable/disable process from within the .install file? I need to force users to configure settings.php properly before these actions. The return values of enable/disable hooks are apparently ignored.

I need to prevent users from sawing off the branch their sitting on :)


Solution

  • You can implement hook_requirements() to require the setting before the initial installation (install) and during status checks (runtime).

    Preventing your module from being disabled doesn't seem possible within the .install file. Perhaps, instead, you can check for module_exists() in your session handler and route back to the default handler if your module is disabled?