Skip to content

Instantly share code, notes, and snippets.

php -i | grep 'Configure Command =>' | awk '{for(i=5; i<=NF; i++) {print substr($i, 2, (length($i) - 2))}}'
@scottalan
scottalan / site-install
Last active August 29, 2015 14:03
Panopoly Drush Site-Install
WD system: migrate module enabled. [100.2 sec, 152.78 MB] [info]
WD system: panopoly_demo module installed. [100.56 sec, 152.91 MB] [info]
WD php: MigrateException: No migration found with machine name PanopolyDemoNode in MigrationBase::getInstance() (line 444 of [error]
/var/drupal/test-cedicp.dev/public/profiles/panopoly/modules/contrib/migrate/includes/base.inc). [100.6 sec, 151.65 MB]
MigrateException: No migration found with machine name PanopolyDemoNode in MigrationBase::getInstance() (line 444 of /var/drupal/test-cedicp.dev/public/profiles/panopoly/modules/contrib/migrate/includes/base.inc).
Drush command terminated abnormally due to an unrecoverable error. [100.6 sec, 151.64 MB] [error]
@scottalan
scottalan / output
Created July 18, 2014 22:15
drush make hanging
Bootstrap to phase 0. [0.02 sec, 2.17 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.03 sec, 2.31 MB] [bootstrap]
Loading drushrc "/var/www/cedijournal/public/sites/all/drush/drushrc.php" into "drupal" scope. [0.03 sec, 2.32 MB] [bootstrap]
Cache HIT cid: 5.9-commandfiles-0-d329cf8e5e828cd4fe0ec1004a7ee620 [0.05 sec, 2.33 MB] [debug]
Bootstrap to phase 0. [0.15 sec, 5.34 MB] [bootstrap]
Bootstrap to phase 0. [0.22 sec, 5.34 MB] [bootstrap]
Found command: make (commandfile=make) [0.23 sec, 5.34 MB]
@scottalan
scottalan / contribs.sh
Last active August 29, 2015 14:04
Drush make hanging...
This is my simple make file I'm trying to test:
------------------------------------------------
api = 2
core = 7.x
projects[addressfield][version] = "1.0-beta5"
projects[addressfield][subdir] = "contrib"
projects[addressfield_tokens][version] = "1.4"
projects[addressfield_tokens][subdir] = "contrib"
Component type: uuid_fpp
),
1 => array(
< 'admin_title' => '(about) Body text',
< 'bundle' => 'text',
< 'category' => 'Reusable Content',
< 'created' => 1409772563,
< 'field_basic_text_text' => array(
< 'und' => array(
< 0 => array(
@scottalan
scottalan / sqlbackup-s3.sh
Created November 4, 2014 15:46
Amazon S3 Database Backup
#!/bin/bash
# Make directories: log and backup at the $DIR.
# Move the '.s3cfg' file to the $DIR as well.
# NOTE: CHANGE ALL VARIABLES TO MATCH YOUR NEEDS!
# The name of the s3 bucket on Amazon.
S3BUCKET="REPLACE_BUCKET_NAME"
/**
* Change content from one input format to another, deleting the old at the end.
*
* @param string $old_format
* Name of the old input format.
* @param string $new_type
* Name of the new input format.
*/
function _myprofile_install_change_input_format($old_format, $new_format) {
// Change the format on all fields.
# - xdebug
RUN echo xdebug.remote_enable=1 >> /etc/php5/conf.d/20-xdebug.ini;\
echo xdebug.remote_autostart=0 >> /etc/php5/conf.d/20-xdebug.ini;\
echo xdebug.remote_connect_back=1 >> /etc/php5/conf.d/20-xdebug.ini;\
echo xdebug.remote_port=9000 >> /etc/php5/conf.d/20-xdebug.ini;\
echo xdebug.remote_log=/tmp/php5-xdebug.log >> /etc/php5/conf.d/20-xdebug.ini;
@scottalan
scottalan / drupal_query_alter.php
Created September 10, 2015 17:03
A crazy Mike Potter hook_views_query_alter()
<?php
/*** Implements hook_views_query_alter().
*/
function oa_media_views_query_alter(&$view, &$query) {
if (($query->base_table == 'file_managed') && (!empty($view->filter['og_group_ref_target_id']->options['exposed']))) {
// Modify file views with space filters to handle media attached to nodes and paragraphs
// Ensure we have a relationship between og_membership and oa_media file
if (!empty($query->table_queue['field_oa_media_file_managed__og_membership'])) {
// Table already exists because user is probably filtering on space already
@scottalan
scottalan / gist:1022898
Created June 13, 2011 14:49 — forked from glennpratt/gist:1016744
DateTime.php
$ php -a
Interactive shell
php > $date = new DateTime('now');
php > $timestamp = $date->format('U');
php > var_dump($timestamp);
string(10) "1307626589"
php > $timestamp = $date->getTimestamp();
php > var_dump($timestamp);
int(1307626589)