SlideShare a Scribd company logo
1 of 11
Drupal shell or just
DruSH
What is Drush?
- drush is a command line interface that allows to
manage your Drupal web sites fast and easy.
- drush is not a module;
- drush = drupal + shell = drupal in the command line;
Why Drush?
- saves your time;
- possibility to use drush in scripts;
- custom drush commands.
- aliases;
The Manual Method The Drush Method
Drush: More Beer, Less Effort
- go to the drupal.org and search
necessary module;
- drush dl views -y && drush en views -y
- download module;
- find archive and unzip it;
- copy module to the Drupal repository;
- go to the site, search module and enable it.
- go to beer
Drush commands
$ drush <command> [options]
Help!
$ drush
$ drush help <command>
Core drush commands:
● cache-clear (cc)
● core-cron (cron)
● core-status (status, st)
● updatedb (updb)
SQL commands:
● sql-dump
● sql-query (sqlq)
● sql-drop
● sql-create
Project manager commands:
● pm-enable (en)
● pm-disable (dis)
● pm-download (dl)
● pm-update (up)
http://www.drushcommands.com
Aliases
- aliases of the sites are shortcuts that point to some
of
the sites for which you want to execute the command- use in our scripts
How to create alias?
- go to the user directore: cd ~
<?php
$aliases['example'] = array(
'uri' => 'localhost',
'root' => "/var/www/example.loc",
);
- create file for aliases:
.drush/aliases.drushrc.php
drush @example status
Drush in scripts
// Just some ideas to get the juices flowing.
drush_print_r(user_roles());
drush_print_r($GLOBALS['user']);
drush php-script scratch.php
alan@alan-eMachines-E525:~$ drush php-script
/usr/share/php/drush/commands/core/scratch.php
alan@alan-eMachines-E525:~$
How to create custom script?<?php
$aliases = array('@example', '@example_1', '@example_n');
foreach ($aliases as $alias) {
$status = shell_exec("drush $alias status");
drush_print_r($status);
}
alan@alan-eMachines-E525:~$ drush php-script
/usr/share/php/drush/commands/core/scratch.php
/usr/share/php/drush/commands/core/my-script.php
alan@alan-eMachines-E525:~$
alan@alan-eMachines-E525:~$ sudo drush php-script my-script
Drupal version : 7.26
Site URI : localhost
Database driver : mysql
Database hostname : localhost
Database username : root
...
Custom drush commands
my_module.drush.inc/**
* Implements hook_drush_command().
*/
function my_module_drush_command() {
$items = array();
$items['content-info'] = array(
'description' => 'Content info’,
'drupal dependencies' => array('my_module'),
'aliases' => array('ci'),
);
return $items;
}
/**
* Content information.
*/
function drush_my_module_content_info() {
$node_types = node_type_get_types();
foreach ($node_types as $type => $type_info) {
// Get information about nodes.
$info = db_select('node')->condition('type', $type);
$count = $info->countQuery()->execute()->fetchField();
$published = $info->condition('status', TRUE)
->countQuery()->execute()->fetchField();
// Print information.
drush_print_r($type_info->name);
drush_print_r(t('Count: @count', array('@count' => $count)));
drush_print_r(t('Published: @published', array('@published' =>
$published)));
drush_print_r("n");
}
}
Article
Count: 27
Published: 15
Basic page
Count: 12
Published: 9
$ drush ci
Drush make
$ drush make makefile.make
; Drush Make API version.
api = 2
;Drupal core.
core = 7.x
;Common modules.
projects[admin_menu][subdir] = "contrib"
projects[ctools][subdir] = "contrib"
...
$ make-generate
Questions?

More Related Content

What's hot

Drupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of FrontendDrupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of FrontendAcquia
 
Useful Drupal modules and tools
Useful Drupal modules and toolsUseful Drupal modules and tools
Useful Drupal modules and toolsAndrew Zahura
 
Travis Carden/Drupal Nebraks: Drush Presentation
Travis Carden/Drupal Nebraks: Drush PresentationTravis Carden/Drupal Nebraks: Drush Presentation
Travis Carden/Drupal Nebraks: Drush PresentationDrupal Nebraska
 
Speed up Drupal development with Drush
Speed up Drupal development with DrushSpeed up Drupal development with Drush
Speed up Drupal development with Drushkbasarab
 
Huong dan cai dat hadoop
Huong dan cai dat hadoopHuong dan cai dat hadoop
Huong dan cai dat hadoopQuỳnh Phan
 
Learn to Write ur first Shell script
Learn to Write ur first Shell scriptLearn to Write ur first Shell script
Learn to Write ur first Shell scriptHanan Nmr
 

What's hot (8)

Drupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of FrontendDrupal 8 Theme System: The Backend of Frontend
Drupal 8 Theme System: The Backend of Frontend
 
Useful Drupal modules and tools
Useful Drupal modules and toolsUseful Drupal modules and tools
Useful Drupal modules and tools
 
Cookies
CookiesCookies
Cookies
 
Travis Carden/Drupal Nebraks: Drush Presentation
Travis Carden/Drupal Nebraks: Drush PresentationTravis Carden/Drupal Nebraks: Drush Presentation
Travis Carden/Drupal Nebraks: Drush Presentation
 
Speed up Drupal development with Drush
Speed up Drupal development with DrushSpeed up Drupal development with Drush
Speed up Drupal development with Drush
 
Huong dan cai dat hadoop
Huong dan cai dat hadoopHuong dan cai dat hadoop
Huong dan cai dat hadoop
 
Docker, c'est bonheur !
Docker, c'est bonheur !Docker, c'est bonheur !
Docker, c'est bonheur !
 
Learn to Write ur first Shell script
Learn to Write ur first Shell scriptLearn to Write ur first Shell script
Learn to Write ur first Shell script
 

Viewers also liked

New joinee training - pics- Mar-15
New joinee training - pics- Mar-15New joinee training - pics- Mar-15
New joinee training - pics- Mar-15Mohamed Galal
 
DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)
DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)
DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)Drupaltour
 
Novosales - Capability Statement
Novosales - Capability StatementNovosales - Capability Statement
Novosales - Capability StatementKaushal Kumar
 
Novosales_OnDemand_Catalog
Novosales_OnDemand_CatalogNovosales_OnDemand_Catalog
Novosales_OnDemand_CatalogKaushal Kumar
 

Viewers also liked (6)

FANVIL vs kurs $
FANVIL vs kurs $FANVIL vs kurs $
FANVIL vs kurs $
 
New joinee training - pics- Mar-15
New joinee training - pics- Mar-15New joinee training - pics- Mar-15
New joinee training - pics- Mar-15
 
DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)
DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)
DrupalTour. Chernivtsi — Composer (Sergiy Skripchuk, InternetDevels)
 
resume updated mar2015
resume updated mar2015resume updated mar2015
resume updated mar2015
 
Novosales - Capability Statement
Novosales - Capability StatementNovosales - Capability Statement
Novosales - Capability Statement
 
Novosales_OnDemand_Catalog
Novosales_OnDemand_CatalogNovosales_OnDemand_Catalog
Novosales_OnDemand_Catalog
 

Similar to Manage Drupal Sites from the Command Line with Drush

A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013Chris Hales
 
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011Vlad Savitsky
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builderAdolfo Nasol
 
Drush - More Beer, Less Effort
Drush - More Beer, Less EffortDrush - More Beer, Less Effort
Drush - More Beer, Less EffortRuben Teijeiro
 
Drush A beginners guide to a advanced tool.
Drush A beginners guide to a advanced tool.Drush A beginners guide to a advanced tool.
Drush A beginners guide to a advanced tool.Mediacurrent
 
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011camp_drupal_ua
 
How to Use the Command Line to Increase Speed of Development
How to Use the Command Line to Increase Speed of DevelopmentHow to Use the Command Line to Increase Speed of Development
How to Use the Command Line to Increase Speed of DevelopmentAcquia
 
Face your fears: Drush and Aegir
Face your fears: Drush and AegirFace your fears: Drush and Aegir
Face your fears: Drush and AegirIztok Smolic
 
Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилPVasili
 
Drush and drupal. администрирование волчек михаил
Drush and drupal. администрирование  волчек михаилDrush and drupal. администрирование  волчек михаил
Drush and drupal. администрирование волчек михаилdrupalconf
 
Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal DevelopmentChris Tankersley
 
Drush&drupal. administration
Drush&drupal. administrationDrush&drupal. administration
Drush&drupal. administrationzabej
 
Drush workshop
Drush workshopDrush workshop
Drush workshopJuampy NR
 
Lightning Fast Drupal Theming (Drupal 7)
Lightning Fast Drupal Theming (Drupal 7)Lightning Fast Drupal Theming (Drupal 7)
Lightning Fast Drupal Theming (Drupal 7)Globe Runner
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Jon Peck
 

Similar to Manage Drupal Sites from the Command Line with Drush (20)

A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013
 
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builder
 
Drush
DrushDrush
Drush
 
Drush
DrushDrush
Drush
 
Drush - More Beer, Less Effort
Drush - More Beer, Less EffortDrush - More Beer, Less Effort
Drush - More Beer, Less Effort
 
Dcp'14 drush
Dcp'14 drushDcp'14 drush
Dcp'14 drush
 
Drush A beginners guide to a advanced tool.
Drush A beginners guide to a advanced tool.Drush A beginners guide to a advanced tool.
Drush A beginners guide to a advanced tool.
 
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
 
How to Use the Command Line to Increase Speed of Development
How to Use the Command Line to Increase Speed of DevelopmentHow to Use the Command Line to Increase Speed of Development
How to Use the Command Line to Increase Speed of Development
 
Face your fears: Drush and Aegir
Face your fears: Drush and AegirFace your fears: Drush and Aegir
Face your fears: Drush and Aegir
 
Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек Михаил
 
Beginning Drush
Beginning DrushBeginning Drush
Beginning Drush
 
Intro to Drush
Intro to DrushIntro to Drush
Intro to Drush
 
Drush and drupal. администрирование волчек михаил
Drush and drupal. администрирование  волчек михаилDrush and drupal. администрирование  волчек михаил
Drush and drupal. администрирование волчек михаил
 
Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal Development
 
Drush&drupal. administration
Drush&drupal. administrationDrush&drupal. administration
Drush&drupal. administration
 
Drush workshop
Drush workshopDrush workshop
Drush workshop
 
Lightning Fast Drupal Theming (Drupal 7)
Lightning Fast Drupal Theming (Drupal 7)Lightning Fast Drupal Theming (Drupal 7)
Lightning Fast Drupal Theming (Drupal 7)
 
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
Optimize Site Deployments with Drush (DrupalCamp WNY 2011)
 

More from Drupaltour

DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)
DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)
DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)Drupaltour
 
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)Drupaltour
 
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...Drupaltour
 
DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...
DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...
DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...Drupaltour
 
DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)
DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)
DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)Drupaltour
 
DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)
DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)
DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)Drupaltour
 
DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...
DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...
DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...Drupaltour
 
DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)
DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)
DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)Drupaltour
 
DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)
DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)
DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)Drupaltour
 
DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...
DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...
DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...Drupaltour
 
DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)
DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)
DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)Drupaltour
 
DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)
DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)
DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)Drupaltour
 
DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...
DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...
DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...Drupaltour
 
DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...
DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...
DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...Drupaltour
 
DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...
DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...
DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...Drupaltour
 
DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)
DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)
DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)Drupaltour
 
DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...
DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...
DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...Drupaltour
 
DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...
DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...
DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...Drupaltour
 

More from Drupaltour (18)

DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)
DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)
DrupalTour. Lviv — Bumpy road of Drupal7 (Pavel Shevchuk, EPAM)
 
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)
DrupalTour Lviv — Theming in Drupal8 (Ivan Tibezh, InternetDevels)
 
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...
DrupalTour. Lviv — Apache solr. Advanced use cases (Artem Sylchuk, InternetDe...
 
DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...
DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...
DrupalTour. Rivne — SEO & Usability (Roman Demydyuk and Oleg Shykhalov, Inter...
 
DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)
DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)
DrupalTour. Rivne — Drupal 8 (Ivan Tibezh, InternetDevels)
 
DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)
DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)
DrupalTour. Zhytomyr — Entity API in Drupal 7 (Ivan Tibezh, InternetDevels)
 
DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...
DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...
DrupalTour. Zhytomyr — Створення інтернет-магазину на базі Drupal (Sergiy Skr...
 
DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)
DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)
DrupalTour. Zhytomyr — Drupal Optimization (Dmitry Kinakh, InternetDevels)
 
DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)
DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)
DrupalTour. Khmelnytskyi — Ember (Timur Bolotyuh, stfalcon.com)
 
DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...
DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...
DrupalTour.Chernivtsi — Як написати якісний модуль для Drupal 7 (Taras Tsuper...
 
DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)
DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)
DrupalTour. Vinnytsia — Борьба с нагрузкой на MySQL (Andrey Leshchuk, LetyShops)
 
DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)
DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)
DrupalTour. Khmelnytskyi — Why Drupal? (Andrij Sakhaniuk, InternetDevels)
 
DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...
DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...
DrupalTour. Ternopil — What's going on when you visit an URL (Andrij Sakhaniu...
 
DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...
DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...
DrupalTour. Chernivtsi — Think different або кUxня cучасного веб дизайну (Pa...
 
DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...
DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...
DrupalTour. Vinnytsia — SASS and Drupal themes (Olexander Kuzava, InternetDev...
 
DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)
DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)
DrupalTour. Khmelnytskyi — Про блог сайти (Olexander Kuzava, InternetDevels)
 
DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...
DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...
DrupalTour. Chernivtsi — Як спростити життя Web-розробнику (Olexander Kuzava,...
 
DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...
DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...
DrupalTour. Ivano-Frankivsk — Dark side of the Drupal (Artem Sylchuk, Interne...
 

Recently uploaded

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

Manage Drupal Sites from the Command Line with Drush

  • 1. Drupal shell or just DruSH
  • 2. What is Drush? - drush is a command line interface that allows to manage your Drupal web sites fast and easy. - drush is not a module; - drush = drupal + shell = drupal in the command line;
  • 3. Why Drush? - saves your time; - possibility to use drush in scripts; - custom drush commands. - aliases;
  • 4. The Manual Method The Drush Method Drush: More Beer, Less Effort - go to the drupal.org and search necessary module; - drush dl views -y && drush en views -y - download module; - find archive and unzip it; - copy module to the Drupal repository; - go to the site, search module and enable it. - go to beer
  • 5. Drush commands $ drush <command> [options] Help! $ drush $ drush help <command> Core drush commands: ● cache-clear (cc) ● core-cron (cron) ● core-status (status, st) ● updatedb (updb) SQL commands: ● sql-dump ● sql-query (sqlq) ● sql-drop ● sql-create Project manager commands: ● pm-enable (en) ● pm-disable (dis) ● pm-download (dl) ● pm-update (up) http://www.drushcommands.com
  • 6. Aliases - aliases of the sites are shortcuts that point to some of the sites for which you want to execute the command- use in our scripts How to create alias? - go to the user directore: cd ~ <?php $aliases['example'] = array( 'uri' => 'localhost', 'root' => "/var/www/example.loc", ); - create file for aliases: .drush/aliases.drushrc.php drush @example status
  • 7. Drush in scripts // Just some ideas to get the juices flowing. drush_print_r(user_roles()); drush_print_r($GLOBALS['user']); drush php-script scratch.php alan@alan-eMachines-E525:~$ drush php-script /usr/share/php/drush/commands/core/scratch.php alan@alan-eMachines-E525:~$
  • 8. How to create custom script?<?php $aliases = array('@example', '@example_1', '@example_n'); foreach ($aliases as $alias) { $status = shell_exec("drush $alias status"); drush_print_r($status); } alan@alan-eMachines-E525:~$ drush php-script /usr/share/php/drush/commands/core/scratch.php /usr/share/php/drush/commands/core/my-script.php alan@alan-eMachines-E525:~$ alan@alan-eMachines-E525:~$ sudo drush php-script my-script Drupal version : 7.26 Site URI : localhost Database driver : mysql Database hostname : localhost Database username : root ...
  • 9. Custom drush commands my_module.drush.inc/** * Implements hook_drush_command(). */ function my_module_drush_command() { $items = array(); $items['content-info'] = array( 'description' => 'Content info’, 'drupal dependencies' => array('my_module'), 'aliases' => array('ci'), ); return $items; } /** * Content information. */ function drush_my_module_content_info() { $node_types = node_type_get_types(); foreach ($node_types as $type => $type_info) { // Get information about nodes. $info = db_select('node')->condition('type', $type); $count = $info->countQuery()->execute()->fetchField(); $published = $info->condition('status', TRUE) ->countQuery()->execute()->fetchField(); // Print information. drush_print_r($type_info->name); drush_print_r(t('Count: @count', array('@count' => $count))); drush_print_r(t('Published: @published', array('@published' => $published))); drush_print_r("n"); } } Article Count: 27 Published: 15 Basic page Count: 12 Published: 9 $ drush ci
  • 10. Drush make $ drush make makefile.make ; Drush Make API version. api = 2 ;Drupal core. core = 7.x ;Common modules. projects[admin_menu][subdir] = "contrib" projects[ctools][subdir] = "contrib" ... $ make-generate