Skip to content

Instantly share code, notes, and snippets.

View greg-1-anderson's full-sized avatar

Greg Anderson greg-1-anderson

View GitHub Profile
@greg-1-anderson
greg-1-anderson / mycustommodule.module
Created August 7, 2015 02:17
Disable wysiwyg profiles when running with the php built-in webserver to avoid problems
<?php
// When running via the php built-in webserver, disable wysiwyg profiles
function mycustommodule_boot() {
if (php_sapi_name() == 'cli-server') {
cache_set('wysiwyg_profiles', array());
}
}
@greg-1-anderson
greg-1-anderson / rmwysiwyg.drush.inc
Last active August 29, 2015 14:26
DEPRECATED: Remove wysiwyg profiles prior to running `drush rs`
<?php
// n.b. there is a better way:
//
// https://gist.github.com/greg-1-anderson/a57271f74981de32b878
/**
* If any active input filters have wysiwyg profiles,
* then ask the user if they should be removed.
*/
@greg-1-anderson
greg-1-anderson / pantheon-database-access.php
Created July 22, 2015 23:29
Proof-of-concept script to access Pantheon Database, e.g. for recovery. We need more info from Terminus before this is generally useful
<?php
$self=array_shift($argv);
$prefix="wp_";
while (count($argv) > 0) {
$arg = array_shift($argv);
if ($arg[0] == '-') {
switch ($arg) {
case "--port":
#!/usr/bin/env php
<?php
/**
* This script will download and install https://github.com/pantheon-systems/wp-native-php-sessions
* on your Pantheon Wordpress site.
*
* Works on Macintosh / Linux.
*
* Usage:
*
@greg-1-anderson
greg-1-anderson / gist:fb1dba054c35c46af644
Last active November 22, 2016 11:43
Workaround for lack of ssl support at fastly for updates.drupal.org
<?php
// Place in $HOME/.drush/drushrc.php
// OBSOLETE workaround for lack of SSL cert handling at fastly for updates.drupal.org.
// Running without ssl exposes you to man-in-the-middle attacks, so REMOVE THIS, since
// https support is now unofficially provided again.
// $command_specific['pm-download']['source'] = 'http://updates.drupal.org/release-history';
@greg-1-anderson
greg-1-anderson / gist:56d640c4c6c067b479d0
Last active August 29, 2015 14:19
Convert 'drush cc all' into 'drush cache-rebuild' on Drupal 8 sites.
<?php
// Put this in ~/.drush/policy.drush.inc
function policy_drush_command_alter(&$command) {
if (($command['command'] == 'cache-clear') && (drush_drupal_major_version() >= 8)) {
$command['command'] = 'cache-rebuild';
$command['command-hook'] = 'cache-rebuild';
$command['primary function'] = FALSE;
$command['arguments'] = array();
drush_set_command($command);
}