I need to create a subdirectory in the private files folder. I can check if the folder is available with variable_get('file_private_path', FALSE) in hook_install or hook_enable.

But how can I prevent my module from getting enabled? And preferably, I want hook_uninstall to run in case this happens so that the user can first setup the private files directory and then try again.

I played with module_disable and drupal_uninstall_modules, but (understandably) those don't seem to work if they target the module they are called from. I'm using Drupal 7.


The hook_requirements(), what do you need.

Implement it your own modules .install phase. Here is an example from one of my module: http://drupalcode.org/project/jquery_localscroll.git/blob/refs/heads/7.x-1.x:/jquery_localscroll.install#l20

  • Excellent, and thank you for including some of your own code.
    – Whiskey
    Oct 3 '12 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.