emjayess
10/31/2013 - 7:42 AM

Use drush to lock a Drupal site effectively into a read-only state. Have used this as a means to leave a site's content online and available

Use drush to lock a Drupal site effectively into a read-only state. Have used this as a means to leave a site's content online and available while preparing and even upgrading.

#!/bin/bash

# place a lock file
touch /path/to/drupal/site/lock

# revoke roles and permissions that are capable of content 'writes'
drush @site perm-revoke --roles="contributor" --permissions="post comments,create answer content,create feed content"

#!/bin/bash

# clear the lock file
rm /path/to/drupal/site/lock

# grant (back) roles and permissions that are capable of content 'writes'
drush @site perm-revoke --roles="contributor" --permissions="post comments,create answer content,create feed content"