4

is there any method/module that allow removing module folder when uninstalling the module or delete the files via dashboard

  • Out of curiosity, what is the use case for this? – Letharion Jun 21 '12 at 7:22
  • Automatically replace files when new version is released. – Tayba Jun 21 '12 at 7:25
  • That doesn't make sense to me. You don't want to un-install a module to perform an upgrade. – Letharion Jun 21 '12 at 7:27
  • 2
    If you want to "automatically replace files when a new version is released", you can use Drush. Drush allows you to enter a command like "drush up views" to automatically update Views to the latest version. – Patrick Kenny Jun 21 '12 at 11:39
9

To take a different angle:

It's very possible to do this, but you shouldn't. Your web server user should not have the capacity to write to the web root (except for designated folders like the public files folder). You should therefore not be able to delete module folders from code. Doing so presents a security risk to your server.

This is one of the checks the Security Review module performs, and throws up a nice big red error if it find the web server can write to such files:

enter image description here

I understand this might be unavoidable if you're on shared hosting, but I think it's a good piece of information to have either way.

  • If I could edit this to make all of the text bold, red, and blinking, I would. – mpdonadio Jun 21 '12 at 12:46
  • @MPD Shame the <marquee> and <blink> tags aren't available in Markdown eh? ;) I've tried to make it a bit more shouty, hopefully the point will get across – Clive Jun 21 '12 at 12:48
2

A module could implement hook_modules_uninstalled to do this for other modules, but I'm not aware of such a module, no.

  • 1
    hook_uninstall only "Remove any information that the module sets." – niksmac Jun 21 '12 at 7:00
  • I agree to @NikhilM ; OP is asking for a method to remove the module folder on uninstalling it.. – AjitS Jun 21 '12 at 7:04
  • 1
    @NikhilM I was a bit to quick to write there >_< I didn't mean a module could do it for itself, but for others, though I refered to a hook that isn't invoked for other modules. Fixed that now. – Letharion Jun 21 '12 at 7:07
  • @Letharion, Saw the edit, Seems helpful for the OP now. – niksmac Jun 21 '12 at 7:08
  • I think we need a cpanel module to browse the sites directory – Tayba Jun 21 '12 at 7:17
1

I didn't find any module for this case. There is a thread here about your concern.

http://drupal.org/node/855058

There is a patch for Drush to delete the module after running drush pm-uninstall moduleName

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.