Skip to main content

Articles tagged with "drush"

Format Drush output for easy wins!

3rd Apr 2024

Drush, the brilliant command-line tool for Drupal, is capable of giving you its output in several ways. Its global --format parameter can be set to a type that you can use in useful ways. Most recently, I found this incredibly useful when I had made some configuration changes through Drupal's admin pages, and needed to then script those changes to automatically apply to hundreds of sites on a platform we manage.

I simply asked Drush for the value of the configuration I had set, formatted as the PHP code to set those values. Then I could drop...

Read more

Quickly update Drupal core

18th Oct 2018

Update: this article's suggested method has serious shortcomings, use other methods when you can! For example, run the following with drush to just upgrade drupal core code (leaving database updates to be run separately):

drush pm-updatecode drupal --check-updatedb=0

If you've got a Drupal site, which you need to update quickly (for example, to address last night's security advisory!), here's a tip. Run this from the command line:

curl 'https://github.com/drupal/drupal/compare/7.59..7.60.patch' | patch -p1

This assumes your codebase was on Drupal 7.59 and you're currently in Drupal's root directory. If you're currently on a different version, adjust the numbers in the...

Read more

GDPR compliance steps for Drupal Developers

30th May 2018

The new GDPR laws are here, hurrah!

Having a number of developers handling databases from a number of client sites could easily be a nightmare, but we at ComputerMinds spent quite some time thinking about how to get and keep everybody safe and squeaky clean on the personal data front.

Here's a quick run-down of the key things to be aware of - and a pretty poster to help you keep it all in mind :)

Remove personal data from your system

  1. Review all databases on your computer, making sure to consider also those .sql dump files still sat in your downloads directory...
Read more

How to write your own Drush command

9th Feb 2016

Occasionally there's something you need to achieve, which would be really easy if only you could have it performed via Drush - some script that could be run on the server during an update or migration process, perhaps. But it all looks a bit too scary, right? "The task is tricky enough already, let's just do it some other way"?

Well, it's actually surprisingly easy to write your own Drush commands, and it's totally something worth learning. Let's take a look.

(Though do check DrushCommands.com to make sure you're not trying to do something that's already been done!)

##Writing a...

Read more

Storing data in Aegir

5th Apr 2011

[Aegir][aegir] is a very clever Drupal hosting system built using Drupal and Drush. It is divided into two parts: the frontend and the backend. The frontend is essentially just a standard Drupal site that stores its data in the database and then some drush scripts that manipulate the data. The backend (provision) is just a collection of drush scripts, and it stores its data in [Aegir contexts][aegir_contexts] which are essentially just arrays of data stored in text files on disk. One of the most mysterious processes in Aegir is sending data from the frontend to the backend to be stored...

Read more

Aegir tasks daemon

29th Mar 2011

[Aegir][aegir] is a very clever hosting system for [Drupal][drupal] that sites and provisions them on various servers and does lots of clever things. One of the clever things that it has had for a while is a task queuing system. You can ask Aegir to lots of different things all in one go, and Aegir will queue them up and run them at its own pace. This provides a really good separation from the front-end Aegir website and the back-end Aegir scripts.

We've been using Aegir in production for just under a year, and one thing that has bugged me...

Read more

Drush make, Aegir and Dropbox

7th Feb 2011

These three tools ([drush make][drush_make], [Aegir][aegir] and [Dropbox][dropbox]) have come together to produce a release system that means I don't have to ssh into a remote server to deploy a new version of site. This means that I can do releases really, really simply, and actually with nothing more than a web browser[^1]. Let me explain:

Drush make

If you aren't using [Drush make][drush_make], then you should look into it. Essentially you specify a manifest of all the code that makes up you project and then you can ask drush make to assemble the code for you. It has...

Read more

Views data exports

24th Nov 2010

Views is the king in Drupal land when it comes to making lists of your data, rightly so, it does a wonderful job of making it easy to choose the data you want to list. It also allows you to render your list in various forms, lists, tables. RSS feeds or even jump menus. So if you want to make a list and render it as CSV or XML, then you naturally turn to views, and find that currently you really have two options:

Let me talk about Views Datasource before...

Read more

Using Drush export content type, and views

6th Jul 2009

We're not sure what to do with these: we've written two simple Drush scripts for exporting content types and views. Saving us from having to navigate a few pages and precious seconds.

Download them and pop them somewhere Drush can find them, a good candidate would be in ~/.drush

Then you can run them by typing:

drush export view <view_name>

or

drush export content type <type_name>

You should now either have an error message or and exported view or content type in a file. The files are saved in the current working directory (in most cases where you ran drush...

Read more