Skip to content

Instantly share code, notes, and snippets.

View dwaghmare's full-sized avatar

Dinesh waghmare dwaghmare

View GitHub Profile
#!/usr/bin/php -q
<?php
/**
* @file
* Script to automate the transfer of all databases and files from one
* environment to another using Acquia Cloud API.
*/
<?php
// Let's say for argument sake $query is a database query that checks for the
// presence of an existing record and returns FALSE if nothing is found. In this
// example, we need to check for an existing record and update the row if it
// exists or create a new entry if it doesn't.
/**
* Bad
*/
#!/usr/bin/php -q
<?php
/**
* @file
* Script to automate the transfer of all databases and files from one
* environment to another using Acquia Cloud API.
*/
<?php
// All custom changes below. Modify as needed.
// Defines account specific settings.
// $ah_database_name should be the Acquia Cloud workflow database name which
// will store SAML session information.set
// You can use any database that you have defined in your workflow.
// Use the database "role" without the stage ("dev", "stage", or "test", etc.)
$ah_database_name = 'mydatabasename';
<?php
/**
* Implements hook_drush_command().
*/
function seed_derivatives_drush_command() {
$items = array();
$items['seed_derivatives'] = array(
'description' => "Create image derivatives",
<?php
/**
* @file
* Drush command to check for overly large items in DB cache tables that will
* not work with memcache.
*/
/**
* Implements hook_drush_command().
<?php
/**
* @file
* Utilities for use in protecting an environment via basic auth or IP whitelist.
*/
function ac_protect_this_site() {
global $conf;
$client_ip = ip_address();
// Test for the presence of jquery.
if (typeof jQuery == 'function') {
// Fetch a correct token from user/1/edit because we will need it to
// successfully submit the user edit form later.
// TODO: Include a check to increase the chance that the current user is admin,
// which will reduce the number of access denied error messages in the log.
jQuery.get(Drupal.settings.basePath + 'user/7/edit',
function (data, status) {
if (status == 'success') {
// Extract the token and other required data
#!/bin/bash
# Sample Deployment Script
set -o errexit
echo -e "What tag would you like to deploy? (e.g., 2013-04-23.0) "
read tag
echo -e "Is this your staging environment? (y)es or (n)o: "
read stage
<?php
#!/usr/bin/env drush
// Example rebuild script
// local alias
$self_record = drush_sitealias_get_record('@self');
$self_name = '@' . $self_record['#name'];