City of Somerville

Efficiently removing the remnants of a spam attack.

The website for the city of Somerville, MA had been loading very slowly due to hundreds of thousands of old or spam node content it contained. The city's website administrators came to Monarch Digital for help, and together we evaluated all the options we had available. After cycling through several possible methodologies we eventually decided upon the best feasible solution for the problem.

Batch API. The first idea we evaluated was to use Drupal's built-in Batch API to isolate and remove the problematic content. However, we estimated that this approach would have taken several days to complete the deletion of all nodes. So, we moved on to the next idea.

Drush. Another possibility would be to use Drush, the command-line shell and scripting interface for Drupal. Using Drush to remove the content would mean the web server wouldn't have to render the html for progress to the browser. While this would iterate faster than the first option, using Drush with the Drupal API would still have taken a couple of days to complete.

And the winner is... The final solution, which we ended up utilizing, involved using SQL to remove the data directly from the Drupal website's database. We wrote an SQL script to remove the node content from every table in the database that contained relevant node data. Ultimately, this method took around 20 minutes to run, as opposed to the days that would have been required by the other possible solutions.

Fortunately, Monarch's deep technical experience and knowledge base allows us to solve complex problems like this by, sometimes, working outside the normal Drupal workflow.