Skip to main content

Mike Kreuzer

Deleting files in Drupal

28 August 2019

I wrote a Drupal module to help users more easily delete files.

It's available now on the Drupal site. Drupal, a PHP CMS. Long time readers and avid scrollers will know I’ve had something of a hate-hate relationship with PHP. That's still true. PHP's got better over the years, sure, but not by much. There are some good, even great things built with it, yes, and Drupal’s almost one of those. Almost, but not quite.

This post was originally going to be called "Ten things I hate about Drupal, and how to fix them". I might still write that post, but it mostly boils down to the one thing really: gatekeeping. One of my great tech bugbears.

Drupal’s rough edges are old school rough. No casual blogger's even going to be able to update the thing, and mostly that's on purpose - all through its design decisions have been made that exclude people. Users can't possibly know enough to be allowed to delete files, so let's keep that at arm's length from them. Rinse, repeat.

So here's one step back towards giving users control. You want to delete some out of date PDFs? It's your site, do it. You don't need to hope the reference counts in the managed file table aren't askew, or that cron runs, or your developers have the time. Tick some checkboxes & hit the big friendly button that says send these files to hell, & you're done. (OK, it says 'Delete selected files', but same same.)