Skip to content

Instantly share code, notes, and snippets.

@emjayess
Created October 31, 2013 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emjayess/7245675 to your computer and use it in GitHub Desktop.
Save emjayess/7245675 to your computer and use it in GitHub Desktop.
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
# 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"
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment