drupal

Bootswatch theme

With these commands you can quickly create a Bootstrap sub-theme with a Bootswatch.

You should be able to copy and paste them into your terminal, and create a fresh Bootswatch-based theme:

MySQL

Create, drop and import a MySQL database using Drush for Drupal:

# Drop, create and import database, assumes database located one level up
drush sql-query "drop database DB_NAME_NEW;"
drush sql-query "create database DB_NAME_NEW;"
mysql -u root -proot DB_NAME_NEW < ../DB_NAME.sql

Drush back up system for Drupal site

Here is an example of how you can set up a back up system for a Drupal web site with Drush. Daily backups are kept for a week, after which they are deleted, and the weekly, full backups are deleted after 30 days. This script comes with no warranties of any kind, as always, test thoroughly before using it.

Drush commands

To quickly find the most used drush commands, execute this one-liner in your terminal:

history | grep drush | awk '{print $3}' | sort | uniq --count | sort --numeric-sort --reverse | head -30

Drush make

Drush is a powerful tool for building Drupal web sites. Here is much more information about Drush commands: https://drushcommands.com/

How to install Drush: http://docs.drush.org/en/8.x/install/

Varnish bunny

Drupal has a flood protection feature, which bans a user after a number of failed login attempts:

"Drupal 7 prevents brute force attacks on accounts. It blocks login by a user that has more than 5 failed login attempts (within six hours) or an IP address that has more than 50 failed login attempts (within one hour)."

Drupal VM

From the official Github page: "Drupal VM is A VM for local Drupal development, built with Vagrant + Ansible."

Install NFS-kernel-server and git
If you haven't already, install nfs-kernel-server and Git:

sudo apt-get install nfs-kernel-server git

Fast Drupal with Vagrant Scotch Box

This is how I set up a new Vagrant Scotch Box with Drush support.

NOTE: After updating VirtualBox through the normal, daily Ubuntu update, it might be necessary to reinstall with the below commands.

When you update Drupal core, the .htaccess file is overwritten with the latest version. This also means that any www redirects in that file are lost, and you have to re-apply them, which is annoying, and a problem if you forget to do it after updating. The reason why it is important to only show URLs with OR without www. in front of them, is to avoid what Google considers duplicate content.