drush and drupal. administration web-developer drupal-club (belarus) [email protected] twitter:...
TRANSCRIPT
Drush and Drupal. Administration
Web-developer
Drupal-club (Belarus)
twitter: mikhail_volchek
Michael Volchek
For whom?
• Who wants to implement actual updating rapidly
• Who doesn’t like to do the same actions again and again
• Who chooses Linux hosting
• Who likes shell (drupal+shell=drush)
• And it is comfortable for local developing…
Basic Commands
• Drush <host> status
• Drush dl <project_1> < project_2> < project_3>
• the same drush en/dis/pm-uninstall
• Drush cc [all|menu|css-js…]
• Drush help <some_command>
• etc
Coworking Drush and Linux
• For example:
• drush pm-list | grep omega
• drush dl omega_tools && drush en omega_tools –y
• drush dis pathauto && drush pm-uninstall pathauto && drush pmi | grep pathauto
New Modules - new Commands
• For example:
• drush omega-subtheme --machine_name=zabej_theme "ZABEJ" && drush en zabej_theme -y && drush pm-list | grep zabej
Install Drupal
1. Prepare database (mysql>create database <DB_name>;)
2. Use one drush command site-install (or alias si)
3. drush si standard --db-url=mysql://<DB_user>:<passwd>@<DB_host>/<DB_name> --db-su=<admin> -db-su-pw=<some_password> --site-name=‘Dev Site!’
Recover user’s password
or how to crack Drupal
•Use
•drush uli -l http://<somehost>
•drush upwd <user> --password=<password>
Minor Drupal Updating
7.10 to 7.14
•!Backup! Project DataBase and Files
•Move from project all custom files/folders
•Switch on update module
•drush upc / up -y
•Wait for some moments=)
•That’s all
•It takes you about 5 minutes
•Use the same command for contrib modules UPD
Major updating… face with
• Contributed module developing (for example: /project/photos – last update - 2009-Dec-30)
• But need to migrate about 150 albums and 6000 photos
• If you hardcode contributed modules still
• Need rewrite custom themes
Drush Updating
• /usr/local/share/drush
• cd /usr/local/share/
• drush dl drush --destination=.
• and use drush cc drush (clear drush cache)
Alias…
• $options['shell-aliases']['dis-all'] = '!drush -y dis $(drush pml --status=enabled --type=module --no-core --pipe)';
• $options['shell-aliases']['wipe'] = 'cache-clear all';
…Alias
• $aliases['dev'] = array('root' => '/path/to/drupal', 'uri' => 'dev.mydrupalsite.com', );
• $ drush @dev status
• $ drush --root=/path/to/drupal --uri=dev.mydrupalsite.com status
Git + cron + drush
• GitHub.com – central repo
• Use script files (*.sh)
• Use git command (for example: git pull) there
• Use drush command there
• And cron schedule
• There will be pics
Drush in win
• Windows installer from 5.x version
• To install with online connection
• Additional mysql software tuning (for example drush sql-dump)
Drush Hardships
• To begin using. For window and mouse fun it may be psychologic issue
• Share hosting doesn’t play in the game
• More flexible and usable in Linux platform
• At the beginnig you need to learn list of popular commands. U can print it and stick to wall.
Useful links
• drush.ws
• http://igusev.ru/drupal/omega/omega-drush-subtheme-creation
• http://www.summasolutions.net/blogposts/implementing-drush-commands
• http://civicactions.com/blog/2011/oct/04/drush_screencast_core_quick_drupal_command