SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
25 -27 April, 2014 http://camp2014.drupal.dn.ua
Drush - use full power
Alexander Schedrov
You can do it in CLI
Most helpful commands
Most helpful commands: Core
• cc - clear-
cache
• dl, en, dis,
pm-uninstall
• upwd
• uli
• make
• updb
• up
• upc
• image-flush
• vget, vset
• sql-dump
• sql-cli
• sql-sync
Most helpful commands: Contrib
Apache Solr
• solr-index
• solr-mark-all
• solr-delete-index
Registry Rebuild
• registry-
rebuild(rr)
Localization
Update
• l10n-update
• l10n-update-
refresh
• l10n-update-
status
Most helpful commands: Contrib
Features
• features-list(fl)
• features-diff(fd)
• features-revert(fr)
• features-revert-all(fr)
• features-update(fu)
• features-update-
all(fua)
Devel
• devel-reinstall (dre)
• fn-view(fnv)
• fn-hook(fnh, hook)
drush hook HOOK_NAME
allows to discover order of hooks
DRUPAL SHELL
Installation on Windows
• download drush. Using c:drush as location in this example
• install gzip, tar, wget command line binaries
• set PATH environment variables
c:drush;d:xamppphp;d:xamppmysqlbin;C:Program FilesGnuWin32bin
• MsysGit
https://drupal.org/node/594744
Installation on *nix
• download drush. Using home folder as location in this
example
• create symlink
!
https://drupal.org/node/1791676
sudo ln -s ~/drush/drush /usr/local/bin/drush
Configuration, code sync, sql
sync.
aliases.drushrc.php
$aliases['dev'] = array(
'root' => '~/Sites/drupal.dev',
);
!
!
drush @dev status
drush -r ~/Sites/drupal.dev/ status
!
drush ~/Sites/drupal.dev/#default status
aliases.drush.php:
$aliases['dev'] = array(
'root' => '~/Sites/blog',
'uri' => 'blog.dev',
);
$aliases['live'] = array(
'root' => '~/Sites/blog-live',
'uri' => 'blog-live.dev',
);
blog.aliases.drushrc.php:
drush @blog status
drush @blog.dev status
drush @blog.live status
$aliases['blog'] = array(
'site-list' => array('@dev', '@live'),
);
drush site-alias(sa)
SSH
$aliases['live'] = array(
'remote-host' => 'bitbucket.org',
'remote-user' => 'sanchiz',
'root' => '/var/www',
'uri' => 'default',
);
Important: remote server must have Drush
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub sanchiz@bitbucket.org
equals
drush dl drush_extras
drush pushkey @live
Remote host with special
configuration
$aliases['live'] = array(
'remote-host' => 'dev.project.de',
'remote-user' => 'dev_alex_sh',
'root' => '/home/dev_alex_sh/www',
'php' => '/usr/bin/php',
'path-aliases' => array(
'%drush-script' => '/home/dev_alex_sh/drush/
drush.php',
),
);
Code and database sync
If you do not use Git, this section for you =)
Code sync
$aliases['live'] = array(
'command-specific' => array(
'core-rsync' => array(
'exclude' => '*.sql',
'exclude' => '.svn',
'exclude' => '.git',
'exclude' => "sites/default/files/",
),
),
);
drush rsync(core-rsync) @live @dev --include-conf
!
drush rsync @live:sites/default/files @dev:sites/
default/files
Sql-sync
$aliases['live'] = array(
'path-aliases' => array(
'%dump-dir' => ‘/home/dev_alex_sh/dump’,
),
);
drush sql-sync @live @dev
!
drush sql-sync @live @dev --create-db
Selective sync
emails => user+%uid@localhost
passwords => password
drush sql-sync @live @dev --structure-tables-key=common
drushrc.php:
$options['structure-tables']['custom'] = array(
'cache',
'cache_*',
'search_*',
'watchdog'
);
drush sql-sync @live @dev --structure-tables-key=custom --no-cache=true
!
drush sql-sync @live @dev --sanitize
Sql-sync without Drush on
server
$aliases['live'] = array(
'databases' => array(
'default' =>
array(
'default' =>
array(
'driver' => 'mysql',
'username' => 'username',
'password' => 'password',
'port' => '',
'host' => '127.0.0.1',
'database' => 'live_database',
),
),
),
);
drush @live sql-conf --all --show=passwords
$aliases['live'] = array(
'remote-host' => 'dev.project.de',
'remote-user' => 'default_alex_sh',
'root' => '/home/default_alex_sh/www',
'php' => '/usr/bin/php',
'php-options' => '-d error_reporting="E_ALL^E_DEPRECATED"',
'variables' => array('mail_system' => array('default-system' => 'DevelMailLog')),
'databases' => array(
'default' =>
array(
'default' =>
array(
'driver' => 'mysql',
'username' => 'username',
'password' => 'password',
'port' => '',
'host' => '127.0.0.1',
'database' => 'live_database',
),
),
),
'path-aliases' => array(
'%drush-script' => '/home/default_alex_sh/drush/drush.php',
'%files' => '/home/default_alex_sh/www/sites/default/files',
'%drush' => '/home/default_alex_sh/drush',
'%dump-dir' => '/home/default_alex_sh/www/dump',
),
!
'command-specific' => array(
'core-rsync' => array(
'exclude' => '*.sql',
'exclude' => '.svn',
'exclude' => '.git',
'exclude' => "sites/default/files/",
),
),
!
'ssh-options' => '-p 2222',
);
Development
DRUSH make
What can drush make do?
• Download modules
• Clone modules from git
• Apply patches
• Download libraries
• Download core
core = 7.x
api = 2
!
; core
projects[drupal][version] = 7.23
!
; modules
projects[views][version] = 3.7
projects[views][subdir] = "contrib"
!
projects[views][version] = 3.7
projects[views][subdir] = "contrib"
projects[views][patch][] = "https://drupal.org/files/
views_join_condition_increment_5.patch"
!
projects[views][type] = module
projects[views][download][type] = git
projects[views][download][revision] = 6920ff71c0bf3a75fc769658ba0dabb42ffcd357
projects[views][download][branch] = 7.x-3.x
projects[views][subdir] = "contrib"
!
; libraries
libraries[ckeditor][download][type] = get
libraries[ckeditor][download][url] = "http://download.cksource.com/CKEditor/CKEditor/
CKEditor 4.3/ckeditor_4.3_full.zip"
!
libraries[colorbox][download][type] = get
libraries[colorbox][download][url] = "https://github.com/jackmoore/colorbox/archive/
master.zip"
drush make make_file.make --no-core
http://drushmake.me
Extensions Drush
• A .drush folder in your HOME folder.
• Anywhere in module
• Drupal's /drush or /sites/all/drush folders.
function usertools_drush_command() {
$items = array();
!
$items['last-registration'] = array(
'description' => 'Show last registration.',
'arguments' => array(
'role' => 'Specific role.',
),
'options' => array(
'count' => array(
'description' => 'Count rows.',
'example-value' => '5',
),
),
'examples' => array(
'drush utl admin --count=5' => 'Show the last 5 registrations of admin.',
),
'aliases' => array('utl'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
);
!
return $items;
}
!
function usertools_drush_help($section) {
switch ($section) {
case 'drush:last-registration':
return dt('This command will show you last registrations.');
}
}
function drush_usertools_last_registration_validate($role = 'all') {
$count = drush_get_option('count');
if (!empty($count) && !is_numeric($count)) {
return drush_set_error('Count should be numeric.');
}
}
!
function drush_usertools_last_registration($role = 'all') {
$count = drush_get_option('count');
if (empty($count)) {
$count = 10;
}
!
$query = db_select('users', 'u');
!
// Condition by role.
if ($role != 'all') {
$rid = drush_usertools_get_role_by_name($role);
$query->innerJoin('users_roles', 'ur', 'u.uid = ur.uid');
$query->condition('ur.rid', $rid);
}
!
$query->fields('u', array('uid', 'name', 'mail', 'access', 'created'));
$query->condition('u.uid', 0, '<>');
$query->range(0, $count);
$query->orderBy('u.created', 'DESC');
$result = $query->execute();
!
$items[] = array('uid', dt('Name'), dt('email'), dt('Last login'));
foreach ($result as $user) {
$items[] = array(
$user->uid,
$user->name,
$user->mail,
$user->access == 0 ? dt('Never') : format_interval(time() - $user->access) . ' ago',
);
}
drush_print_table($items, TRUE);
}
Usage
drush utl --count=5
drush utl administrator --count=10
function usertools_drush_command() {
$items = array();
$items['wipe-users'] = array(
'description' => 'Wipe user tables.',
'examples' => array(
'drush utw' => 'Wipe users.'
),
'aliases' => array('utw'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT,
);
return $items;
}
!
function drush_usertools_wipe_users() {
if (drush_confirm(dt('You want to delete all users? Are you sure?'))) {
$query = db_select('users', 'u');
$query->fields('u', array('uid', 'name'));
$query->condition('u.uid', 1, '>');
$result = $query->execute();
foreach ($result as $user) {
drush_log(dt('Deleting user') . ' ' . $user->name . '...', 'warning');
user_delete($user->uid);
drush_log(dt('Succes deleting') . ' ' . $user->name, 'success');
}
}
else {
drush_user_abort();
}
}
Usage
drush utw
function drush_usertools_disable_role() {
$query = db_select('role', 'r');
$query->fields('r', array('rid', ‘name'));
$query->condition('r.rid', 1, '<>');
$query->orderBy('r.rid');
$result = $query->execute();
!
$options = array();
foreach ($result as $role) {
$options[$role->rid] = array($role->name);
}
!
$rid = drush_choice($options, dt('Select role:'));
!
// SQL queries.
!
drush_log('All users of role ' . $options[$rid][0] . ' disabled.', 'success');
}
Links
• https://drupal.org/node/594744 - Drush on Windows
• https://drupal.org/node/1791676 - Drush on *nix
• http://drushmake.me - Drush make
• http://drush.ws
• https://gist.github.com/Sanchiz/7627657
THANK YOU!
!
Email: alexander.schedrov@gmail.com
Twitter: @alexschedrov
FB: schedrov
http://sanchiz.net

Mais conteúdo relacionado

Mais procurados

Making your Angular.js Application accessible
Making your Angular.js Application accessibleMaking your Angular.js Application accessible
Making your Angular.js Application accessibleDirk Ginader
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLarry Cai
 
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Acquia
 
Geodaten & Drupal 7
Geodaten & Drupal 7Geodaten & Drupal 7
Geodaten & Drupal 7Michael Milz
 
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
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Caldera Labs
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackIgnacio Martín
 
jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)jeresig
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentationBrian Hogg
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCalderaLearn
 
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Kris Wallsmith
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.jsTechExeter
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersCaldera Labs
 
Drupal image gallery_workshop
Drupal image gallery_workshopDrupal image gallery_workshop
Drupal image gallery_workshopHeather Bohn
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)jeresig
 
Hadoop Summit - Interactive Big Data Analysis with Solr, Spark and Hue
Hadoop Summit - Interactive Big Data Analysis with Solr, Spark and HueHadoop Summit - Interactive Big Data Analysis with Solr, Spark and Hue
Hadoop Summit - Interactive Big Data Analysis with Solr, Spark and Huegethue
 
Widget Platform
Widget PlatformWidget Platform
Widget Platformjosemataf
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST APICaldera Labs
 

Mais procurados (20)

Making your Angular.js Application accessible
Making your Angular.js Application accessibleMaking your Angular.js Application accessible
Making your Angular.js Application accessible
 
Learn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutesLearn Dashing Widget in 90 minutes
Learn Dashing Widget in 90 minutes
 
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
Fast Paced Drupal 8: Accelerating Development with Composer, Drupal Console a...
 
Geodaten & Drupal 7
Geodaten & Drupal 7Geodaten & Drupal 7
Geodaten & Drupal 7
 
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
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and Webpack
 
jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)jQuery (DrupalCamp Toronto)
jQuery (DrupalCamp Toronto)
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentation
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
 
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.js
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Drupal image gallery_workshop
Drupal image gallery_workshopDrupal image gallery_workshop
Drupal image gallery_workshop
 
JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)JavaScript Libraries (Kings of Code)
JavaScript Libraries (Kings of Code)
 
Hadoop Summit - Interactive Big Data Analysis with Solr, Spark and Hue
Hadoop Summit - Interactive Big Data Analysis with Solr, Spark and HueHadoop Summit - Interactive Big Data Analysis with Solr, Spark and Hue
Hadoop Summit - Interactive Big Data Analysis with Solr, Spark and Hue
 
Vue business first
Vue business firstVue business first
Vue business first
 
Widget Platform
Widget PlatformWidget Platform
Widget Platform
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 

Destaque

DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...Alex S
 
Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.Alex S
 
Feeds. использование и создание плагинов. Feeds API
Feeds. использование и создание плагинов. Feeds APIFeeds. использование и создание плагинов. Feeds API
Feeds. использование и создание плагинов. Feeds APIAlex S
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGapAlex S
 
Drupal Training Days 2017 - Drupal 8 basic functions.
Drupal Training Days 2017 - Drupal 8 basic functions.Drupal Training Days 2017 - Drupal 8 basic functions.
Drupal Training Days 2017 - Drupal 8 basic functions.Alex S
 
Drush installation guide
Drush installation guideDrush installation guide
Drush installation guideThierno Fall
 
Drupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 MigrationDrupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 MigrationAmeex Technologies
 
Managing Drupal on Windows with Drush
Managing Drupal on Windows with DrushManaging Drupal on Windows with Drush
Managing Drupal on Windows with DrushAlessandro Pilotti
 
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal ConsoleSrijan Technologies
 
Drupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsDrupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsAlessandro Pilotti
 
Drush workshop
Drush workshopDrush workshop
Drush workshopJuampy NR
 
Composer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.pptComposer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.pptPromet Source
 
Drush Presentation
Drush PresentationDrush Presentation
Drush Presentationperceptum
 
Getting started with Drupal 8
Getting started with Drupal 8Getting started with Drupal 8
Getting started with Drupal 8Hector Iribarne
 
Drush for humans - SANDcamp 2013
Drush for humans - SANDcamp 2013Drush for humans - SANDcamp 2013
Drush for humans - SANDcamp 2013Jon Peck
 
Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилPVasili
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalPantheon
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Francisco José Seva Mora
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait fromAndrii Podanenko
 
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011camp_drupal_ua
 

Destaque (20)

DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...DrupalGap. How to create native application for mobile devices based on Drupa...
DrupalGap. How to create native application for mobile devices based on Drupa...
 
Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.Getting started with Ansible. Be efficient.
Getting started with Ansible. Be efficient.
 
Feeds. использование и создание плагинов. Feeds API
Feeds. использование и создание плагинов. Feeds APIFeeds. использование и создание плагинов. Feeds API
Feeds. использование и создание плагинов. Feeds API
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGap
 
Drupal Training Days 2017 - Drupal 8 basic functions.
Drupal Training Days 2017 - Drupal 8 basic functions.Drupal Training Days 2017 - Drupal 8 basic functions.
Drupal Training Days 2017 - Drupal 8 basic functions.
 
Drush installation guide
Drush installation guideDrush installation guide
Drush installation guide
 
Drupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 MigrationDrupal 6 to Drupal 8 Migration
Drupal 6 to Drupal 8 Migration
 
Managing Drupal on Windows with Drush
Managing Drupal on Windows with DrushManaging Drupal on Windows with Drush
Managing Drupal on Windows with Drush
 
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
[Srijan Wednesday Webinar] Mastering Drupal 8 Development with Drupal Console
 
Drupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on WindowsDrupal, Memcache and Solr on Windows
Drupal, Memcache and Solr on Windows
 
Drush workshop
Drush workshopDrush workshop
Drush workshop
 
Composer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.pptComposer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.ppt
 
Drush Presentation
Drush PresentationDrush Presentation
Drush Presentation
 
Getting started with Drupal 8
Getting started with Drupal 8Getting started with Drupal 8
Getting started with Drupal 8
 
Drush for humans - SANDcamp 2013
Drush for humans - SANDcamp 2013Drush for humans - SANDcamp 2013
Drush for humans - SANDcamp 2013
 
Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек Михаил
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for Drupal
 
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)Xdebug and Drupal8 tests (PhpUnit and Simpletest)
Xdebug and Drupal8 tests (PhpUnit and Simpletest)
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait from
 
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
Vlad Savitsky.Modules parade.DrupalCamp Kyiv 2011
 

Semelhante a Drush - use full power - DrupalCamp Donetsk 2014

Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.Alex S
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?Alexandru Badiu
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8Allie Jones
 
DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7chuvainc
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptDarren Mothersele
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuerysergioafp
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of LithiumNate Abele
 
Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In DepthKirk Bushell
 
Php update and delet operation
Php update and delet operationPhp update and delet operation
Php update and delet operationsyeda zoya mehdi
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
Kamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With StyleKamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With StyleDaniel-Constantin Mierla
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistenceHugo Hamon
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Jeff Carouth
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From IusethisMarcus Ramberg
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 

Semelhante a Drush - use full power - DrupalCamp Donetsk 2014 (20)

Drush. Secrets come out.
Drush. Secrets come out.Drush. Secrets come out.
Drush. Secrets come out.
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8
 
DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7DrupalCamp Foz - Novas APIs Drupal 7
DrupalCamp Foz - Novas APIs Drupal 7
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuery
 
Fatc
FatcFatc
Fatc
 
The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In Depth
 
Php update and delet operation
Php update and delet operationPhp update and delet operation
Php update and delet operation
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Kamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With StyleKamailio - Surfing Big Waves Of SIP With Style
Kamailio - Surfing Big Waves Of SIP With Style
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4
 
Bag Of Tricks From Iusethis
Bag Of Tricks From IusethisBag Of Tricks From Iusethis
Bag Of Tricks From Iusethis
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 

Último

Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.CarlotaBedoya1
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 

Último (20)

Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 

Drush - use full power - DrupalCamp Donetsk 2014

  • 1. 25 -27 April, 2014 http://camp2014.drupal.dn.ua Drush - use full power Alexander Schedrov
  • 2. You can do it in CLI
  • 4. Most helpful commands: Core • cc - clear- cache • dl, en, dis, pm-uninstall • upwd • uli • make • updb • up • upc • image-flush • vget, vset • sql-dump • sql-cli • sql-sync
  • 5. Most helpful commands: Contrib Apache Solr • solr-index • solr-mark-all • solr-delete-index Registry Rebuild • registry- rebuild(rr) Localization Update • l10n-update • l10n-update- refresh • l10n-update- status
  • 6. Most helpful commands: Contrib Features • features-list(fl) • features-diff(fd) • features-revert(fr) • features-revert-all(fr) • features-update(fu) • features-update- all(fua) Devel • devel-reinstall (dre) • fn-view(fnv) • fn-hook(fnh, hook) drush hook HOOK_NAME allows to discover order of hooks
  • 8. Installation on Windows • download drush. Using c:drush as location in this example • install gzip, tar, wget command line binaries • set PATH environment variables c:drush;d:xamppphp;d:xamppmysqlbin;C:Program FilesGnuWin32bin • MsysGit https://drupal.org/node/594744
  • 9. Installation on *nix • download drush. Using home folder as location in this example • create symlink ! https://drupal.org/node/1791676 sudo ln -s ~/drush/drush /usr/local/bin/drush
  • 11. aliases.drushrc.php $aliases['dev'] = array( 'root' => '~/Sites/drupal.dev', ); ! ! drush @dev status drush -r ~/Sites/drupal.dev/ status ! drush ~/Sites/drupal.dev/#default status aliases.drush.php:
  • 12. $aliases['dev'] = array( 'root' => '~/Sites/blog', 'uri' => 'blog.dev', ); $aliases['live'] = array( 'root' => '~/Sites/blog-live', 'uri' => 'blog-live.dev', ); blog.aliases.drushrc.php: drush @blog status drush @blog.dev status drush @blog.live status $aliases['blog'] = array( 'site-list' => array('@dev', '@live'), ); drush site-alias(sa)
  • 13. SSH $aliases['live'] = array( 'remote-host' => 'bitbucket.org', 'remote-user' => 'sanchiz', 'root' => '/var/www', 'uri' => 'default', ); Important: remote server must have Drush ssh-keygen ssh-copy-id -i ~/.ssh/id_rsa.pub sanchiz@bitbucket.org equals drush dl drush_extras drush pushkey @live
  • 14. Remote host with special configuration $aliases['live'] = array( 'remote-host' => 'dev.project.de', 'remote-user' => 'dev_alex_sh', 'root' => '/home/dev_alex_sh/www', 'php' => '/usr/bin/php', 'path-aliases' => array( '%drush-script' => '/home/dev_alex_sh/drush/ drush.php', ), );
  • 15. Code and database sync If you do not use Git, this section for you =)
  • 16. Code sync $aliases['live'] = array( 'command-specific' => array( 'core-rsync' => array( 'exclude' => '*.sql', 'exclude' => '.svn', 'exclude' => '.git', 'exclude' => "sites/default/files/", ), ), ); drush rsync(core-rsync) @live @dev --include-conf ! drush rsync @live:sites/default/files @dev:sites/ default/files
  • 17. Sql-sync $aliases['live'] = array( 'path-aliases' => array( '%dump-dir' => ‘/home/dev_alex_sh/dump’, ), ); drush sql-sync @live @dev ! drush sql-sync @live @dev --create-db
  • 18. Selective sync emails => user+%uid@localhost passwords => password drush sql-sync @live @dev --structure-tables-key=common drushrc.php: $options['structure-tables']['custom'] = array( 'cache', 'cache_*', 'search_*', 'watchdog' ); drush sql-sync @live @dev --structure-tables-key=custom --no-cache=true ! drush sql-sync @live @dev --sanitize
  • 19. Sql-sync without Drush on server $aliases['live'] = array( 'databases' => array( 'default' => array( 'default' => array( 'driver' => 'mysql', 'username' => 'username', 'password' => 'password', 'port' => '', 'host' => '127.0.0.1', 'database' => 'live_database', ), ), ), ); drush @live sql-conf --all --show=passwords
  • 20. $aliases['live'] = array( 'remote-host' => 'dev.project.de', 'remote-user' => 'default_alex_sh', 'root' => '/home/default_alex_sh/www', 'php' => '/usr/bin/php', 'php-options' => '-d error_reporting="E_ALL^E_DEPRECATED"', 'variables' => array('mail_system' => array('default-system' => 'DevelMailLog')), 'databases' => array( 'default' => array( 'default' => array( 'driver' => 'mysql', 'username' => 'username', 'password' => 'password', 'port' => '', 'host' => '127.0.0.1', 'database' => 'live_database', ), ), ), 'path-aliases' => array( '%drush-script' => '/home/default_alex_sh/drush/drush.php', '%files' => '/home/default_alex_sh/www/sites/default/files', '%drush' => '/home/default_alex_sh/drush', '%dump-dir' => '/home/default_alex_sh/www/dump', ), ! 'command-specific' => array( 'core-rsync' => array( 'exclude' => '*.sql', 'exclude' => '.svn', 'exclude' => '.git', 'exclude' => "sites/default/files/", ), ), ! 'ssh-options' => '-p 2222', );
  • 22. DRUSH make What can drush make do? • Download modules • Clone modules from git • Apply patches • Download libraries • Download core
  • 23. core = 7.x api = 2 ! ; core projects[drupal][version] = 7.23 ! ; modules projects[views][version] = 3.7 projects[views][subdir] = "contrib" ! projects[views][version] = 3.7 projects[views][subdir] = "contrib" projects[views][patch][] = "https://drupal.org/files/ views_join_condition_increment_5.patch" ! projects[views][type] = module projects[views][download][type] = git projects[views][download][revision] = 6920ff71c0bf3a75fc769658ba0dabb42ffcd357 projects[views][download][branch] = 7.x-3.x projects[views][subdir] = "contrib" ! ; libraries libraries[ckeditor][download][type] = get libraries[ckeditor][download][url] = "http://download.cksource.com/CKEditor/CKEditor/ CKEditor 4.3/ckeditor_4.3_full.zip" ! libraries[colorbox][download][type] = get libraries[colorbox][download][url] = "https://github.com/jackmoore/colorbox/archive/ master.zip" drush make make_file.make --no-core
  • 25. Extensions Drush • A .drush folder in your HOME folder. • Anywhere in module • Drupal's /drush or /sites/all/drush folders.
  • 26. function usertools_drush_command() { $items = array(); ! $items['last-registration'] = array( 'description' => 'Show last registration.', 'arguments' => array( 'role' => 'Specific role.', ), 'options' => array( 'count' => array( 'description' => 'Count rows.', 'example-value' => '5', ), ), 'examples' => array( 'drush utl admin --count=5' => 'Show the last 5 registrations of admin.', ), 'aliases' => array('utl'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL, ); ! return $items; } ! function usertools_drush_help($section) { switch ($section) { case 'drush:last-registration': return dt('This command will show you last registrations.'); } }
  • 27. function drush_usertools_last_registration_validate($role = 'all') { $count = drush_get_option('count'); if (!empty($count) && !is_numeric($count)) { return drush_set_error('Count should be numeric.'); } } ! function drush_usertools_last_registration($role = 'all') { $count = drush_get_option('count'); if (empty($count)) { $count = 10; } ! $query = db_select('users', 'u'); ! // Condition by role. if ($role != 'all') { $rid = drush_usertools_get_role_by_name($role); $query->innerJoin('users_roles', 'ur', 'u.uid = ur.uid'); $query->condition('ur.rid', $rid); } ! $query->fields('u', array('uid', 'name', 'mail', 'access', 'created')); $query->condition('u.uid', 0, '<>'); $query->range(0, $count); $query->orderBy('u.created', 'DESC'); $result = $query->execute(); ! $items[] = array('uid', dt('Name'), dt('email'), dt('Last login')); foreach ($result as $user) { $items[] = array( $user->uid, $user->name, $user->mail, $user->access == 0 ? dt('Never') : format_interval(time() - $user->access) . ' ago', ); } drush_print_table($items, TRUE); }
  • 28. Usage drush utl --count=5 drush utl administrator --count=10
  • 29. function usertools_drush_command() { $items = array(); $items['wipe-users'] = array( 'description' => 'Wipe user tables.', 'examples' => array( 'drush utw' => 'Wipe users.' ), 'aliases' => array('utw'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT, ); return $items; } ! function drush_usertools_wipe_users() { if (drush_confirm(dt('You want to delete all users? Are you sure?'))) { $query = db_select('users', 'u'); $query->fields('u', array('uid', 'name')); $query->condition('u.uid', 1, '>'); $result = $query->execute(); foreach ($result as $user) { drush_log(dt('Deleting user') . ' ' . $user->name . '...', 'warning'); user_delete($user->uid); drush_log(dt('Succes deleting') . ' ' . $user->name, 'success'); } } else { drush_user_abort(); } }
  • 31. function drush_usertools_disable_role() { $query = db_select('role', 'r'); $query->fields('r', array('rid', ‘name')); $query->condition('r.rid', 1, '<>'); $query->orderBy('r.rid'); $result = $query->execute(); ! $options = array(); foreach ($result as $role) { $options[$role->rid] = array($role->name); } ! $rid = drush_choice($options, dt('Select role:')); ! // SQL queries. ! drush_log('All users of role ' . $options[$rid][0] . ' disabled.', 'success'); }
  • 32. Links • https://drupal.org/node/594744 - Drush on Windows • https://drupal.org/node/1791676 - Drush on *nix • http://drushmake.me - Drush make • http://drush.ws • https://gist.github.com/Sanchiz/7627657
  • 33. THANK YOU! ! Email: alexander.schedrov@gmail.com Twitter: @alexschedrov FB: schedrov http://sanchiz.net