Drupal and Drush Part 1: Easy Drupal Management

Oct 22, 2010
Eric Aguayo

Drupal is an open source PHP based CMS that allows easily creating web applications, plug-in themes and creating custom functionality. One of the main advantages of Drupal is that there is a large list of contributed modules available at the Drupal.org site that almost any feature needed is already developed or being developed by the community. Most importantly, is that when any bug is found on any module, developers can report the issue and contribute patches so the module can be updated by the maintainers. When a new release of a module becomes available it is reported on the administration interface so developers can update the site. However, there are tasks that are not so trivial that can be performed with the out-of-the-box functionality of the Drupal core, like the task of updating Drupal modules. Fortunately there is a Drupal tool called Drush, which is a command line application tool used to enable, disable, uninstall, update many aspects of Drupal such as modules, themes, profiles or translations.

Besides the package management features of Drush, there are other contributed modules that can be used to provide additional commands. There is a Drush module that provides tools for applying and rolling patches which can be useful when extending functionalities of modules. Several other modules can be found for providing commands for setting and managing different environments. There is a huge set of Drush related modules on the Drupal.org site which allows controlling almost any component in Drupal such as blocks, users, nodes, modules, permissions, etc. In addition, there is a contributed module called Drupal Terminal which allows executing commands within the web interface.

Drush allows controlling almost every aspect of the Drupal administration interface from the command line, so one might wonder how it can be useful if it can be done from the web interface. A command line interface is not as user friendly as a web interface but it is one of the most flexible and economical ways for developers and site maintainers to query for information and execute commands. Drush is very useful, not only for development, but also for routine maintenance tasks. A theme developer will usually need to flush the caches to see some changes reflected which can be done from the command line instead of going to the web interface to clear the caches every time it is needed. Further, Drush allows specifying the cache tables that need to be flushed. Drush is very useful as well for performing remote calls to the commands to get information or perform some actions over a remote server.

Drush has proved to be a very useful tool when working with Drupal projects, especially when working in a Linux environment; bash scripts can be written to automatically perform several complex tasks such as module updates or run the cron.php batch job under specific conditions such as when the number of nodes to be processed on some queue. In general, Drush has opened a huge set of possibilities to build and maintain web applications in Drupal.

Now check out: Drupal and Drush Part 2: Keeping Drupal Up to Date

Related Blog Posts