Skip to content

Instantly share code, notes, and snippets.

@szeidler
szeidler / fix-fields.drush
Created August 28, 2014 14:17
Clean field_collection data, when migrating existing fields
#!/usr/bin/env drush
$result = db_query("SELECT id, data from field_config where type = 'field_collection'");
foreach ($result as $field) {
$data = unserialize($field->data);
$data['indexes'] = array('revision_id' => array('revision_id'));
$data = serialize($data);
db_query("update field_config set data = :data where id = :id", array(':data' => $data, ':id'=> $field->id));
}
@szeidler
szeidler / template.php
Last active June 20, 2016 21:19
Hide Facet API counter
<?php
function theme_facetapi_tabs_inactive($variables) {
unset($variables['count']);
return theme_link($variables);
}
function theme_preprocess_facetapi_link_inactive(&$variables) {
// hide facet count
unset($variables['count']);
@szeidler
szeidler / gist:afb11c7033ee758919d9
Created September 14, 2014 14:53
This function name has a typo which makes me laugh
<?php
/**
* Determine whether a given bootstrap phase has been completed
*
* This function name has a typo which makes me laugh so we choose not to
* fix it. Take a deep breath, and smile. See
* http://en.wikipedia.org/wiki/HTTP_referer
*
*
* @param phase
@szeidler
szeidler / gist:206b715deff23301d26d
Created October 23, 2014 12:53
Create zen subtheme with drush
drush zen --name="$Themename" --machine-name="$theme_machine_name" --path="sites/$site/themes/" --without-rtl
@szeidler
szeidler / drush-sync-remote-2-local.sh
Last active October 22, 2016 05:46
Drush sync from remote to local
drush rsync @project-remote:%files @project-local:%files
drush rsync @project-remote:%private @project-local:%private
drush sql-sync @project-remote @project-local
@szeidler
szeidler / trigger-aegir-hosting.sh
Created November 5, 2014 11:33
Trigger aegir hosting
sudo /etc/init.d/hosting-queued start
@szeidler
szeidler / drush-sync-local-2-remote.sh
Last active October 22, 2016 05:46
Drush sync from local to remote
drush rsync @project-local:%files @project-remote:%files
drush rsync @project-local:%private @project-remote:%private
drush sql-sync @project-local @project-remote
@szeidler
szeidler / drupal-git-patch.sh
Last active November 10, 2017 10:50
Drupal git patch
# Normal patch.
git diff --staged 7.x-1.x > [project_name]-[short-description]-[issue-number]-[comment-number].patch
# Interdiff patch.
git diff --staged old_patch_branch > interdiff-[issue-number]-[old-patch-comment-number]-[comment-number].diff.txt
@szeidler
szeidler / drush-compare-modules.sh
Last active July 24, 2017 11:45
Make enabled modules diff of two drupal installations
diff -u <(drush @project-local pm-list --status=enabled) <(drush @project-remote pm-list --status=enabled)
@szeidler
szeidler / drush-site-install
Last active October 22, 2016 05:45
Drush site install command
drush site-install standard --db-url='mysql://[db_user]:[db_pass]@localhost/[db_name]' --site-name=Example --sites-subdir=example.com --account-name=admin --account-pass=password --account-mail=mail@example.com