SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
Drush: using and creating
   custom commands

    Использование Drush
           Successful Development LP
Gold Sponsor of
DrupalCamp Kyiv 2011
Silver Sponsors of
DrupalCamp Kyiv 2011
Scheme

    Administration of drupal by command line:
    main benefits.

    Most interesting ways of using.

    How this work.

    Drush_macros: simple drush extention for
    example.
Administration of drupal by
     command line: main benefits

    Drush: More Beer, Less Effort:
       
           Save time
       
           Forgot about php timeout (and some restrictions of php)
       
           Don't need remember all.
       
           Automatization (repeating of actions)
Forgot about php timeout (and
     some other restrictions of php)

    We can hadle have processes

    Batch processes

    Using bash scripts
Don't need remember all.

    We can pay more attention on development

     Forgot about some issues in drupal web-
    interface using

     Don't need pay too many attention for file
    system (locations of some module folder and
    other)
Automatization (repeating of
                actions)

    Use bash aliases

    Launching by cron

    Launching commands queue by 1 command
Most interesting ways of using.

    Installation in Ubuntu

    Installation in Unix-like operation systems

    Installation in MS Windows

    Main commands in possibilities
Installtion in Ubuntu

    sudo apt-get install drush

    Pathes:
      
          /usr/share/drush
      
          /etc/drush
Installation in Unix-like OS

    Unpuck in any required dirrectory

    Using alias drush='/path/to/drush'

    Installation some required packages
Installation in MS Windows
Solving
Instractions for drush installation in Windows:


     http://drupal.org/node/594744


    http://www.starbowconsulting.com/node/103


    http://vimeo.com/15371661 — Video installation WAMP, Drush & Drupal for Windows 7

             
                     Required packages:
                           
                                  http://gnuwin32.sourceforge.net/packages/libarchive.htm
                           
                                  http://gnuwin32.sourceforge.net/packages/gzip.htm
                           
                                  http://gnuwin32.sourceforge.net/packages/wget.htm
                           
                                  http://gnuwin32.sourceforge.net/packages/gtar.htm
Environment Pathes: ;C:php;C:drush;C:Program Files (x86)GnuWin32bin

Where is work:


      Windows server 2008, Windows server 2008, Windows Vista 64-bit Business, Windows Vista 32-bit Business, Windows Vista
    32-bit Home Premium, Windows XP SP3 32-bit, Windows 7 Home Premium 32-bit, Windows 7 Enterprise 64-bit
Use cases

    cache-clear (cc) - Clearing of cache

    image-flush - Fushes images of image-styles

    site-install

    site-upgrade
    и т.д.
Coding drive development
              and drush

    features-diff

    features-list

    features-revert

    features-update
How this work
workflow
Drush API

    http://drupalcontrib.org/api/drupal/contributions--drush--docs--drush.api.php/7
     
         Hooks:
                  •   hook_drush_init()
                  •   drush_COMMAND_init()
                  •   drush_hook_COMMAND_validate()
                  •   drush_hook_pre_COMMAND()
                  •   drush_hook_COMMAND()
                  •   drush_hook_post_COMMAND()
                  •   drush_hook_post_COMMAND_rollback()
                  •   drush_hook_COMMAND_rollback()
                  •   drush_hook_pre_COMMAND_rollback()
                  •   drush_hook_COMMAND_validate_rollback()
                  •   hook_drush_exit()
Build your drush
    extention
Create COMMANDFILE.drush.inc
Drush searches for commandfiles in the following
 locations:

      The "/path/to/drush/commands" folder.

       Folders listed in the 'include' option (see
    `drush topic docs-configuration`).

      The system-wide drush commands folder,
    e.g. /usr/share/drush/commands

      The ".drush" folder in the user's HOME folder.

      All modules in the current Drupal installation
Implement
COMMANDFILE_drush_help()
function sandwich_drush_help($section) {
    switch ($section) {
        case 'drush:make-me-a-sandwich':
         return dt("... brief help summary
                    goes here ...");
    }
}
Implement
COMMANDFILE_drush_command()

    'aliases': Provides a list of shorter names for the command.

    'deprecated-aliases': Works just like 'aliases', but does not appear in help.

    'callback': Name of function to invoke for this command

    'callback arguments': An array of arguments to pass to the callback.

    'description': Description of the command.

    'bootstrap': Drupal bootstrap level. Valid values are:
           
                     DRUSH_BOOTSTRAP_DRUSH
           
                     DRUSH_BOOTSTRAP_DRUPAL_ROOT
           
                     DRUSH_BOOTSTRAP_DRUPAL_SITE
           
                     DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION
           
                     DRUSH_BOOTSTRAP_DRUPAL_DATABASE
           
                     DRUSH_BOOTSTRAP_DRUPAL_FULL
           
                     DRUSH_BOOTSTRAP_DRUPAL_LOGIN
           
                     DRUSH_BOOTSTRAP_MAX
Implement
COMMANDFILE_drush_command()

    Usefull functions:
      
          drush_prompt($prompt, $default = NULL,
          $required = TRUE);
      
          drush_print($string);
      
          drush_confirm($message);
      
          Example of input:
      $stdin = fopen("php://stdin","r");
      $macros_name = fgetc($stdin);
      …
Drush_macros: simple drush
        extention for example.

    Link for downloading will be later




    Aim: recording and launching commands by 1
    commands, recording drush/bash commands,
    saving in drush inveronment
Using drush_macros

    drush cli
       mstart — start «recording» bash/drush commands
       mstop — stop «recording» bash/drush commands
       macros-save — save queue of commands by 1
         name
exit — exit from drush cli mode

     After that we can run queue of commands by 1
    command in drush cli
Questions
        chewie@sfdev.com
        Skype: chew1e_serge


     Successful Development LP
     http://php.sfdev.com

Más contenido relacionado

La actualidad más candente

Contribuir a Drupal - Entorno
Contribuir a Drupal - EntornoContribuir a Drupal - Entorno
Contribuir a Drupal - EntornoKeopx
 
Hadoop installation on windows
Hadoop installation on windows Hadoop installation on windows
Hadoop installation on windows habeebulla g
 
TP2 Big Data HBase
TP2 Big Data HBaseTP2 Big Data HBase
TP2 Big Data HBaseAmal Abid
 
Drupal Camp Atlanta 2011 - Drupal Security
Drupal Camp Atlanta 2011 - Drupal SecurityDrupal Camp Atlanta 2011 - Drupal Security
Drupal Camp Atlanta 2011 - Drupal SecurityMediacurrent
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppet
 
Drush Presentation
Drush PresentationDrush Presentation
Drush Presentationperceptum
 
Drush - More Beer, Less Effort
Drush - More Beer, Less EffortDrush - More Beer, Less Effort
Drush - More Beer, Less EffortRuben Teijeiro
 
Beginning Jquery In Drupal Theming
Beginning Jquery In Drupal ThemingBeginning Jquery In Drupal Theming
Beginning Jquery In Drupal ThemingRob Knight
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linuxtutorialsruby
 
Red hat lvm cheatsheet
Red hat   lvm cheatsheetRed hat   lvm cheatsheet
Red hat lvm cheatsheetPrakash Ghosh
 
Linux con europe_2014_f
Linux con europe_2014_fLinux con europe_2014_f
Linux con europe_2014_fsprdd
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ublnewrforce
 
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and VagrantDrupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and VagrantGerald Villorente
 
101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystemsAcácio Oliveira
 
55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command linesArif Wahyudi
 

La actualidad más candente (20)

Contribuir a Drupal - Entorno
Contribuir a Drupal - EntornoContribuir a Drupal - Entorno
Contribuir a Drupal - Entorno
 
Run wordcount job (hadoop)
Run wordcount job (hadoop)Run wordcount job (hadoop)
Run wordcount job (hadoop)
 
Hadoop installation on windows
Hadoop installation on windows Hadoop installation on windows
Hadoop installation on windows
 
TP2 Big Data HBase
TP2 Big Data HBaseTP2 Big Data HBase
TP2 Big Data HBase
 
Drupal Camp Atlanta 2011 - Drupal Security
Drupal Camp Atlanta 2011 - Drupal SecurityDrupal Camp Atlanta 2011 - Drupal Security
Drupal Camp Atlanta 2011 - Drupal Security
 
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, PuppetPuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
 
Drush Presentation
Drush PresentationDrush Presentation
Drush Presentation
 
Dc kyiv2010 jun_08
Dc kyiv2010 jun_08Dc kyiv2010 jun_08
Dc kyiv2010 jun_08
 
Drush - More Beer, Less Effort
Drush - More Beer, Less EffortDrush - More Beer, Less Effort
Drush - More Beer, Less Effort
 
Beginning Jquery In Drupal Theming
Beginning Jquery In Drupal ThemingBeginning Jquery In Drupal Theming
Beginning Jquery In Drupal Theming
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linux
 
Red hat lvm cheatsheet
Red hat   lvm cheatsheetRed hat   lvm cheatsheet
Red hat lvm cheatsheet
 
Linux con europe_2014_f
Linux con europe_2014_fLinux con europe_2014_f
Linux con europe_2014_f
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
Drupal from scratch
Drupal from scratchDrupal from scratch
Drupal from scratch
 
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and VagrantDrupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
Drupal Pilipinas Apprentice: LAMP Administration, CSS, and Vagrant
 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
 
101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems
 
55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines
 
Refcard en-a4
Refcard en-a4Refcard en-a4
Refcard en-a4
 

Similar a Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011

A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013Chris Hales
 
DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...
DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...
DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...Drupaltour
 
Drush 5.0 (DrupalCamp LA 2012) - Chris Charlton
Drush 5.0 (DrupalCamp LA 2012) - Chris CharltonDrush 5.0 (DrupalCamp LA 2012) - Chris Charlton
Drush 5.0 (DrupalCamp LA 2012) - Chris CharltonChris Charlton
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builderAdolfo Nasol
 
Drush deploy presentation by Goruachev Mikhail
Drush deploy presentation by Goruachev MikhailDrush deploy presentation by Goruachev Mikhail
Drush deploy presentation by Goruachev MikhailLemberg Solutions
 
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
 
Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилPVasili
 
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
 
DevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal DeploymentDevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal DeploymentGerald Villorente
 
Drush and drupal. администрирование волчек михаил
Drush and drupal. администрирование  волчек михаилDrush and drupal. администрирование  волчек михаил
Drush and drupal. администрирование волчек михаилdrupalconf
 
Drush&drupal. administration
Drush&drupal. administrationDrush&drupal. administration
Drush&drupal. administrationzabej
 
Face your fears: Drush and Aegir
Face your fears: Drush and AegirFace your fears: Drush and Aegir
Face your fears: Drush and AegirIztok Smolic
 
Exploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molinaExploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molinaSalvador Molina (Slv_)
 
Managing Drupal on Windows with Drush
Managing Drupal on Windows with DrushManaging Drupal on Windows with Drush
Managing Drupal on Windows with DrushAlessandro Pilotti
 
Drush in the Composer Era
Drush in the Composer EraDrush in the Composer Era
Drush in the Composer EraPantheon
 
Drupal on your laptop
Drupal on your laptopDrupal on your laptop
Drupal on your laptopSam Moore
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-TranslatorDashamir Hoxha
 
drush_multi @ DrupalDevDays 2010
drush_multi @ DrupalDevDays 2010drush_multi @ DrupalDevDays 2010
drush_multi @ DrupalDevDays 2010Florian Latzel
 

Similar a Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011 (20)

A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013A Drush Primer - DrupalCamp Chattanooga 2013
A Drush Primer - DrupalCamp Chattanooga 2013
 
DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...
DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...
DrupalTour. Ternopil — Drupal shell or just Drush (Serhii Puchkovskii, Intern...
 
Drush 5.0 (DrupalCamp LA 2012) - Chris Charlton
Drush 5.0 (DrupalCamp LA 2012) - Chris CharltonDrush 5.0 (DrupalCamp LA 2012) - Chris Charlton
Drush 5.0 (DrupalCamp LA 2012) - Chris Charlton
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builder
 
Drush deploy presentation by Goruachev Mikhail
Drush deploy presentation by Goruachev MikhailDrush deploy presentation by Goruachev Mikhail
Drush deploy presentation by Goruachev Mikhail
 
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.
 
Drush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек МихаилDrush and drupal. администрирование. Волчек Михаил
Drush and drupal. администрирование. Волчек Михаил
 
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
 
DevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal DeploymentDevOps: Cooking Drupal Deployment
DevOps: Cooking Drupal Deployment
 
Drush and drupal. администрирование волчек михаил
Drush and drupal. администрирование  волчек михаилDrush and drupal. администрирование  волчек михаил
Drush and drupal. администрирование волчек михаил
 
Drush&drupal. administration
Drush&drupal. administrationDrush&drupal. administration
Drush&drupal. administration
 
Face your fears: Drush and Aegir
Face your fears: Drush and AegirFace your fears: Drush and Aegir
Face your fears: Drush and Aegir
 
Dcp'14 drush
Dcp'14 drushDcp'14 drush
Dcp'14 drush
 
Exploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molinaExploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molina
 
Managing Drupal on Windows with Drush
Managing Drupal on Windows with DrushManaging Drupal on Windows with Drush
Managing Drupal on Windows with Drush
 
Drush in the Composer Era
Drush in the Composer EraDrush in the Composer Era
Drush in the Composer Era
 
Drupal on your laptop
Drupal on your laptopDrupal on your laptop
Drupal on your laptop
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
drush_multi @ DrupalDevDays 2010
drush_multi @ DrupalDevDays 2010drush_multi @ DrupalDevDays 2010
drush_multi @ DrupalDevDays 2010
 
Intro to Drush
Intro to DrushIntro to Drush
Intro to Drush
 

Más de Vlad Savitsky

Looking for Vulnerable Code. Vlad Savitsky
Looking for Vulnerable Code. Vlad SavitskyLooking for Vulnerable Code. Vlad Savitsky
Looking for Vulnerable Code. Vlad SavitskyVlad Savitsky
 
Art of Estimation. Vlad Savitsky
Art of Estimation. Vlad SavitskyArt of Estimation. Vlad Savitsky
Art of Estimation. Vlad SavitskyVlad Savitsky
 
Css Intro. Vlad Savitsky
Css Intro. Vlad SavitskyCss Intro. Vlad Savitsky
Css Intro. Vlad SavitskyVlad Savitsky
 
HTML. Быстрое погружение. Влад Савицкий
HTML. Быстрое погружение. Влад СавицкийHTML. Быстрое погружение. Влад Савицкий
HTML. Быстрое погружение. Влад СавицкийVlad Savitsky
 
How to be a believer online. Vlad Savitsky. Novomedia forum 2011
How to be a believer online. Vlad Savitsky. Novomedia forum 2011How to be a believer online. Vlad Savitsky. Novomedia forum 2011
How to be a believer online. Vlad Savitsky. Novomedia forum 2011Vlad Savitsky
 
Vlad savitsky. Church Site in 15 minutes
Vlad savitsky. Church Site in 15 minutesVlad savitsky. Church Site in 15 minutes
Vlad savitsky. Church Site in 15 minutesVlad Savitsky
 
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...Vlad Savitsky
 
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...Vlad Savitsky
 
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011Vlad Savitsky
 
Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011Vlad Savitsky
 
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011Vlad Savitsky
 
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011Vlad Savitsky
 
Evgeniy Karelin. Mongo DB integration example solving performance and high lo...
Evgeniy Karelin. Mongo DB integration example solving performance and high lo...Evgeniy Karelin. Mongo DB integration example solving performance and high lo...
Evgeniy Karelin. Mongo DB integration example solving performance and high lo...Vlad Savitsky
 
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Vlad Savitsky
 
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...Vlad Savitsky
 
Оптимизация JavaScript в Drupal
Оптимизация JavaScript в DrupalОптимизация JavaScript в Drupal
Оптимизация JavaScript в DrupalVlad Savitsky
 

Más de Vlad Savitsky (18)

Looking for Vulnerable Code. Vlad Savitsky
Looking for Vulnerable Code. Vlad SavitskyLooking for Vulnerable Code. Vlad Savitsky
Looking for Vulnerable Code. Vlad Savitsky
 
Art of Estimation. Vlad Savitsky
Art of Estimation. Vlad SavitskyArt of Estimation. Vlad Savitsky
Art of Estimation. Vlad Savitsky
 
Varnish and Drupal.
Varnish and Drupal.Varnish and Drupal.
Varnish and Drupal.
 
Chapter18
Chapter18Chapter18
Chapter18
 
Css Intro. Vlad Savitsky
Css Intro. Vlad SavitskyCss Intro. Vlad Savitsky
Css Intro. Vlad Savitsky
 
HTML. Быстрое погружение. Влад Савицкий
HTML. Быстрое погружение. Влад СавицкийHTML. Быстрое погружение. Влад Савицкий
HTML. Быстрое погружение. Влад Савицкий
 
How to be a believer online. Vlad Savitsky. Novomedia forum 2011
How to be a believer online. Vlad Savitsky. Novomedia forum 2011How to be a believer online. Vlad Savitsky. Novomedia forum 2011
How to be a believer online. Vlad Savitsky. Novomedia forum 2011
 
Vlad savitsky. Church Site in 15 minutes
Vlad savitsky. Church Site in 15 minutesVlad savitsky. Church Site in 15 minutes
Vlad savitsky. Church Site in 15 minutes
 
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
Dmitry Drozdik. how to make friendship between drupal and content manager. dr...
 
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
Alexey Kostin. Increase site ctr in serp using google rich snippets. DrupalCa...
 
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
Oleg Natalushko. Drupal server anatomy. DrupalCamp Kyiv 2011
 
Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011Dennis popov. scrum for drupal. drupal camp kyiv 2011
Dennis popov. scrum for drupal. drupal camp kyiv 2011
 
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
Andriy Kushnarov. BOND: a giant drupal in a huge company. DrupalCamp Kyiv 2011
 
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
Danilenko Alexander. Drupal 7 theming on Omega. DrupalCamp Kyiv 2011
 
Evgeniy Karelin. Mongo DB integration example solving performance and high lo...
Evgeniy Karelin. Mongo DB integration example solving performance and high lo...Evgeniy Karelin. Mongo DB integration example solving performance and high lo...
Evgeniy Karelin. Mongo DB integration example solving performance and high lo...
 
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
 
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
Yuriy Gerasimov. Drupal Services. Integration with third party applications. ...
 
Оптимизация JavaScript в Drupal
Оптимизация JavaScript в DrupalОптимизация JavaScript в Drupal
Оптимизация JavaScript в Drupal
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011

  • 1. Drush: using and creating custom commands Использование Drush Successful Development LP
  • 4. Scheme  Administration of drupal by command line: main benefits.  Most interesting ways of using.  How this work.  Drush_macros: simple drush extention for example.
  • 5. Administration of drupal by command line: main benefits  Drush: More Beer, Less Effort:  Save time  Forgot about php timeout (and some restrictions of php)  Don't need remember all.  Automatization (repeating of actions)
  • 6. Forgot about php timeout (and some other restrictions of php)  We can hadle have processes  Batch processes  Using bash scripts
  • 7. Don't need remember all.  We can pay more attention on development  Forgot about some issues in drupal web- interface using  Don't need pay too many attention for file system (locations of some module folder and other)
  • 8. Automatization (repeating of actions)  Use bash aliases  Launching by cron  Launching commands queue by 1 command
  • 9. Most interesting ways of using.  Installation in Ubuntu  Installation in Unix-like operation systems  Installation in MS Windows  Main commands in possibilities
  • 10. Installtion in Ubuntu  sudo apt-get install drush  Pathes:  /usr/share/drush  /etc/drush
  • 11. Installation in Unix-like OS  Unpuck in any required dirrectory  Using alias drush='/path/to/drush'  Installation some required packages
  • 13. Solving Instractions for drush installation in Windows:  http://drupal.org/node/594744  http://www.starbowconsulting.com/node/103  http://vimeo.com/15371661 — Video installation WAMP, Drush & Drupal for Windows 7  Required packages:  http://gnuwin32.sourceforge.net/packages/libarchive.htm  http://gnuwin32.sourceforge.net/packages/gzip.htm  http://gnuwin32.sourceforge.net/packages/wget.htm  http://gnuwin32.sourceforge.net/packages/gtar.htm Environment Pathes: ;C:php;C:drush;C:Program Files (x86)GnuWin32bin Where is work:  Windows server 2008, Windows server 2008, Windows Vista 64-bit Business, Windows Vista 32-bit Business, Windows Vista 32-bit Home Premium, Windows XP SP3 32-bit, Windows 7 Home Premium 32-bit, Windows 7 Enterprise 64-bit
  • 14. Use cases  cache-clear (cc) - Clearing of cache  image-flush - Fushes images of image-styles  site-install  site-upgrade и т.д.
  • 15. Coding drive development and drush  features-diff  features-list  features-revert  features-update
  • 18. Drush API  http://drupalcontrib.org/api/drupal/contributions--drush--docs--drush.api.php/7  Hooks: • hook_drush_init() • drush_COMMAND_init() • drush_hook_COMMAND_validate() • drush_hook_pre_COMMAND() • drush_hook_COMMAND() • drush_hook_post_COMMAND() • drush_hook_post_COMMAND_rollback() • drush_hook_COMMAND_rollback() • drush_hook_pre_COMMAND_rollback() • drush_hook_COMMAND_validate_rollback() • hook_drush_exit()
  • 19. Build your drush extention
  • 20. Create COMMANDFILE.drush.inc Drush searches for commandfiles in the following locations:  The "/path/to/drush/commands" folder.  Folders listed in the 'include' option (see `drush topic docs-configuration`).  The system-wide drush commands folder, e.g. /usr/share/drush/commands  The ".drush" folder in the user's HOME folder.  All modules in the current Drupal installation
  • 21. Implement COMMANDFILE_drush_help() function sandwich_drush_help($section) { switch ($section) { case 'drush:make-me-a-sandwich': return dt("... brief help summary goes here ..."); } }
  • 22. Implement COMMANDFILE_drush_command()  'aliases': Provides a list of shorter names for the command.  'deprecated-aliases': Works just like 'aliases', but does not appear in help.  'callback': Name of function to invoke for this command  'callback arguments': An array of arguments to pass to the callback.  'description': Description of the command.  'bootstrap': Drupal bootstrap level. Valid values are:  DRUSH_BOOTSTRAP_DRUSH  DRUSH_BOOTSTRAP_DRUPAL_ROOT  DRUSH_BOOTSTRAP_DRUPAL_SITE  DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION  DRUSH_BOOTSTRAP_DRUPAL_DATABASE  DRUSH_BOOTSTRAP_DRUPAL_FULL  DRUSH_BOOTSTRAP_DRUPAL_LOGIN  DRUSH_BOOTSTRAP_MAX
  • 23. Implement COMMANDFILE_drush_command()  Usefull functions:  drush_prompt($prompt, $default = NULL, $required = TRUE);  drush_print($string);  drush_confirm($message);  Example of input: $stdin = fopen("php://stdin","r"); $macros_name = fgetc($stdin); …
  • 24. Drush_macros: simple drush extention for example.  Link for downloading will be later  Aim: recording and launching commands by 1 commands, recording drush/bash commands, saving in drush inveronment
  • 25. Using drush_macros  drush cli mstart — start «recording» bash/drush commands mstop — stop «recording» bash/drush commands macros-save — save queue of commands by 1 name exit — exit from drush cli mode  After that we can run queue of commands by 1 command in drush cli
  • 26. Questions  chewie@sfdev.com  Skype: chew1e_serge Successful Development LP http://php.sfdev.com