Git logs, find where it went wrong

When I want to find something in GIT and see who and when removed some code I start to search GIT, best command combo is this.

 git log -S "$location['country_code']" -p

For current branch

Truncate all cache tables with drush or code

Drush

echo "SHOW TABLES LIKE 'cache%'" | $(drush sql-connect) | tail -n +2 | xargs -L1 -I% echo "TRUNCATE TABLE %;" | $(drush sql-connect) -v

Here's how to do this from the command line...

List all machine name values for permissions in drupal 7

// Render permission overview:
$options = array();
foreach (module_list(FALSE, FALSE, TRUE) as $module) {
  if ($permissions = module_invoke($module, 'permission')) {
    // List only the modules that have permissions.
    dsm($module);
    dsm($permissions);
  }
}

Drupal commerce - change order status when order is locked

This is a helper function when order is locked, validation fails and status cant be changes.

$order = commerce_order_load('219215');
commerce_order_status_update($order, 'pending', FALSE, FALSE);
commerce_order_save($order);

Drupal commerce - change order status when order is locked

This is a helper function when order is locked, validation fails and status cant be changes.

$order = commerce_order_load('219215');
commerce_order_status_update($order, 'pending', FALSE, FALSE);
commerce_order_save($order);