Drupal Dump

Drupal Snippets, Hacks and more....

459 posts since 2011

Make patch from current diff in module

Want to make a quick patch for changes you made in some contrib module to submit it to d.org ?
Write down this and submit the file

git diff  > my_changes.patch


Get all methods you can run on fields

To get all method names you can run on any field added to any entity, input this into devel/php



Flood and Block Ip while running tests (403)

There are 2 system in drupal 7 for IP blocking, one is flood blocking that is used on login and other is 
system_block_ip_action that is storing IP's in blocked_ips table and checking them while bootstrapping.

Check if memcache is working

drush ev 'cache_set("foo", "bar", "cache");'
drush ev '$x = new MemCacheDrupal("cache"); print_r($x->get("foo"));'

snippet to check if memcache is working.

DrupalVM can't mount NFS or similar access problems on Mac OSX

This problem with access permissions has become common in latest versions of Mac OS, you need to give permissions to apps (executables) so they can do/use stuff on your disk/computer. Most of the times you will get a prompt for asking/checking this but sometimes this will quietly fail.

Quickly create patch files from fixed contrib modules

You fixed something in contrib module and you want to create quick patch from that, if it spans through multiple commits, best way to do that is to make a patch from multiple commits, to combine them into one file, write this