Skip to content

Instantly share code, notes, and snippets.

View dwaghmare's full-sized avatar

Dinesh waghmare dwaghmare

View GitHub Profile
#!/bin/bash
# This script is from [Securing file permissions and ownership](https://drupal.org/node/244924)
DRUPAL_PATH=${1%/}
DRUPAL_USER=${2}
APACHE_GROUP="www-data"
HELP="\nHELP: This script is used to fix permissions of a drupal installation\nyou need to provide the following arguments:\n\t 1) path to your drupal installation\n\t 2) Username of the user that you want to give files/directories ownership\nNote: \"www-data\" (apache default) is assumed as the group the server is belonging to, if this is different you need to modify it manually by editing this script\n\nUsage: (sudo) bash ${0##*/} drupal_path user_name\n"
if [ -z "${DRUPAL_PATH}" ] || [ ! -d "${DRUPAL_PATH}/sites" ] || [ ! -f "${DRUPAL_PATH}/modules/system/system.module" ]; then
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/kostajh/drush"
}
],
"require": {
"drush/drush": "dev-web-service-drush-server"
}
<?php
// This script analyzes the files affected between GIT_PREVIOUS_COMMIT and
// GIT_COMMIT. See https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin for
// more information on these parameters.
// If the files affected are in the /features directory, then we will call
// `drush features-revert {feature}` for each feature affected.
// Why is this necessary? Because `features-revert-all` will revert every
// feature on your site; we only want to revert features that are overridden.
/**
Security Updates Best Practices
==================================
The general workflow for running security updates is:
1. Make sure your local development environment for the site is up-to-date (sync the database from production, if needed)
1. If the site hasn't been managed for a long time, use `drush rsync @example.prod @example.local` (using the `--exclude` flag to exclude large directories like `sites/default/files`). Then type `git status`. If there are any unmanaged files, add them to version control.
2. In your local environment, run `drush up --security-only`.
1. Look at the list of packages that will be updated. Go to each project page on Drupal.org and read the release notes.
2. You may need to read several versions worth of release notes. You want to see if there are mentions of breaking changes or any changes to features/functionality your site uses. This is usually the most time consuming and difficult part of running the updates.
#!/bin/bash
# Runs an acquia task, and waits for the task to complete before continuing.
# This is a helper script, to be used in others as needed.
if [[ $1 = "" ]] || [[ $2 = "" ]]
then
echo "Runs an acquia drush command, waiting for the results before continuing."
echo "Can be used as a replacement for drush."
echo
echo " Usage: $0 <site-alias> <ac-drush-command>"
#!/bin/bash
#
# Cloud Hooks: code-deploy, code-update, db-copy, web-activate
# Essentially any time code or db changes are made.
#
# Purges Varnish cache for all .com domains assigned to the environment in Acquia Cloud.
site="$1"
target_env="$2"
drush_alias=$site'.'$target_env
<?php
$user = '';
$pass = '';
$database = '';
$limit = 1000000;
$dsn = 'mysql:dbname=' . $database . ';unix_socket=/var/run/mysqld/mysqld.sock';
try {
# Download all database backups from Acquia Cloud.
drush @SITE.ENV ac-database-instance-backup-list SITE | grep id | head -1 | awk -F ":" '{print $2}' | xargs drush @SITE.ENV ac-database-instance-backup-download DBNAME > backup_file.sql.gz
#!/bin/bash
function drupal-install() {
sudo rm -rf sites/default;
sudo git checkout -- sites/default;
sudo chmod -R 777 sites/default;
sudo chown -R `whoami` sites/default;
sudo git checkout -- sites/default;
sudo chown -R `whoami` sites/default;
#exit;
@dwaghmare
dwaghmare / d8_reset.sh
Last active August 29, 2015 14:21 — forked from cam8001/d8_reset.sh
#!/bin/sh
# Removes an existing Drupal 8 install, then install again.
# Requires Drush 7 - https://github.com/drush-ops/drush
#
# Run this script from the docroot of a Drupal 8 checkout.
# Installs to mysql://localhost/drupal, user 1 user/pass is admin/admin.
if [ ! -e ./core/core.services.yml ]
then