Leaving sh*t around for others to clean up
Somedays I walk through my house and it looks as though a bomb has gone off, or a tornado has hit. There are shoes on the floor as though someone left them in mid-step, jackets thrown all over the place, backpacks and papers here and there. In the morning there are cereal bowls left at the table, but nobody around to eat the cereal soaking up the milk that’s left there.
If you have kids, this scene may sound familiar. I have two kids and am constantly nagging at them “clean up your bowl”, “pick up your shoes” and the likes. I’m not going to say that I always clean up after myself, for sure I turn it around and nag at my self for not picking up my coffee cup when finished or for my clothes not making it all the way to the hamper (my wife can attest to this).
Another place I find junk laying around is in my computer. You may notice that when you install a program (perhaps just to see what it is, or because you might actually want to use it) there are a number of other places where files get installed. Many times these files get installed in places we don’t even know and the files may have names that don’t resemble the program you are installing at all. What’s worse is that the developer (or packager or distributor) has done the job half way and only made sure that the program installs correctly (in most cases).
What happens when you want to uninstall the program. Well that works too (kind of). The program goes through and cleans up all the files and libraries that are needed for running that application, but many times other files and directories are forgotten. Perhaps it’s not the fault of the person writing the uninstall script. Perhaps the developer decided that they would write a bit of data to a file and keep it there for performance or ease of use. Maybe this happened and was forgotten about by the developer and nobody said that this file needed to be cleaned up.
Many times though, the information is left there intentionally as a “well the user might want that data later if they reinstall the application”. To that I say, fine but give me a --no-really-clear-everything-off option to the uninstall script. Instead I’m left with a bunch of dot-files in my home directory when I do an ls -l or an abundance of configuration files hanging around my /etc directory for applications that no longer exist and will likely never be re-installed.
This happens in Drupal quite a bit. There are files that get left under the sites/default/files directory that have nothing to do with any other module currently on the system, but was left there by a module that was installed in the past. Orphaned tables and variables get left around most of all and leave me scratching my head when looking through the DB.
It’s easy enough to go into the files directory and remove files, or go into the DB and remove tables and variables but it’s too easy to remove something else on accident. It takes too much time to thumb through these areas and decide if you still need the information. This should be a more automatic process.
Drupal has a hook for that. It’s easy to use, and you will gain friends by using it. All I ask is, when I uninstall your module, leave my environment the way it would be if I had never seen your module. Leave it so I would never know your module was installed at all. Clean up after yourself so I don’t have to.
Post new comment