Skip to main content


Delete an order

How to delete an order if the order is in cart for N days

In drupal commerce, the order will be created when a product is added to cart and the order will exist until the order is deleted or order status is changed to completed.

We have an e-commerce site in which most of the orders are idle in the shopping cart. So we decided to delete the order if the order is in the shopping cart for more than 'N' days or weeks. I have written a custom drush command for deleting the order.

The following code is used to delete an order if it is in the cart for more than 25 days.

sql dump and sync

Drush sql-dump and sql-sync - skip specific tables

At KnackForge we use Drush more often as a part of Drupal development projects. As Drupal developers, we frequently feel the need for getting the most recent database dump from live site. When I did this recently, it was relatively a big site, thought it would be nice to skip a few tables that are not essential. At least to avoid unnecessary time spent on I/O operations. This is one of the few things that I have least tried with Drush.

Custom drush command

Creating a custom drush command

No Drupal Developer needs introduction about Drush. The power and features of Drush has made the job easier for many developers. Drush by default has a list of commands that we can make use of, the entire list can be seen here. But apart from that, the Drush does has the feature to allow custom commands. 
These custom commands can be used as per our need and scenarios. In my case, I had the need to list the users in site using a Drush command.
drupal login

How to login as any user in Drupal site?

It is no surprise that production sites at times may work differently from dev / stage due to various factors. And in such circumstances, there is a need to login as real site user to be able to reproduce the issue. Of course it is not easy to fix a bug unless it is really reproduced by developer.

In one of my recent works, I found a simple trick using Drush to get access to real user account without distrubing his/her account credentials like login name, email, password, or similar.

Using Drush to administer multisite

One of the admiring features about Drupal is its ability to leverage single code base to power a stack of sites. Drush the excellent command line utility eases the work of administering Drupal sites.

Our recent work raised a question, will these two blend & work together?

Of course we tried this, the answer is yes but to be used with more caution!!

knackforge blog knowledge base

Different ways to reset Drupal admin password

I was a part of Learn Drupal on Global Drupal Training Day!, Drupal Chennai event to deliver a talk about installation and Drupal in general. The attendees were from different genre, but majority of them were students. After the presentations, Shyamala propounded to form teams and let the student participants to try a Drupal installation and come up with a site of their own taste and novelty.

The most frequently used drush commands

If you are into Drupal development and a vivid user of GNU/ Linux (or *nix) for a while, then Drush is a must learn tool for you. As a part of Drupal development project, we extensively use drush. A few commands that help us develop sites at the phase of clients expectation are briefed below,

1. drush cc [type] :- Clears a specific cache, or all Drupal caches.


$ drush cc all

sabareesh Sat, 06/30/2012 - 07:57
knackforge blog knowledge base
knackforge blog knowledge base

How to bulk delete drupal nodes with drush script

I have been working on an interesting project that integrates Drupal, Apache Solr and mahout for providing content recommendation engine. Needless to say it has been an interesting ride filled with a lots of sapid and amusing challenges. More details about this project will be shared in follow up post. In this post, quickly I would like to share a trick to delete a bunch of Drupal nodes using drush script.

Subscribe to Drush