于志成@Zinch<br />vipzhicheng@gmail.com<br />http://www.drupal001.com<br />Drush 原理与应用<br />
Drush概述<br />Drush原理<br />Drush安装<br />Drush应用<br />Drush未来<br />演示<br />大纲<br />
什么是Drush?<br />Drush能做什么?<br />谁需要用Drush?<br />Drush相关资源<br />Drush概述<br />
什么是Drush?<br />
Drush = Drupal + shell<br />
Drupal <-> Drush <-> Linux<br />
$drush cc<br />Enter a number to choose which cache to clear.<br /> [0]  :  Cancel<br /> [1]  :  all<br /> [2]  :  theme r...
什么是Drush<br />开始于<br />2006 by Arto<br />第一个版本基于drupal4.7<br />思路来自于当年的DrupalCon<br />目前<br />稳定版:drush 4.5,最低版本php5.2<br ...
网站管理(安装,升级)<br />项目管理(模块,主题,解决方案配置包,翻译)<br />核心管理(缓存,计划任务,用户,变量表)<br />数据库管理(查询,更新,备份,迁移)<br />编写脚本程序<br />可扩展性,使得Drush可以做...
程序员<br />网站管理员<br />项目经理<br />架构师<br />任何人<br />谁需要用Drush<br />
http://drush.ws<br />Drush官方网站<br />http://drupal.org/project/drush<br />Drush在Drupal的项目地址<br />http://drupal.org/document...
Drush命令执行路径<br />drush_main()<br />drush_dispatch()<br />drush_command();<br />drush_invoke()<br />_drush_invoke_args<br /...
执行流程<br />hook_drush_init()<br />drush_COMMAND_init()<br />drush_hook_COMMAND_validate()<br />drush_hook_pre_COMMAND()<br ...
BOOTSTRAP流程<br />define('DRUSH_BOOTSTRAP_DRUSH', 0);<br />define('DRUSH_BOOTSTRAP_DRUPAL_ROOT',  1);<br />define('DRUSH_BO...
配置文件<br />~/.drush/drushrc.php<br />别名机制<br />~/.drush/aliases.drushrc.php<br />$aliases['dev'] = array(<br />     'root' ...
执行命令<br />$ drush [OPTIONS] command [ARGUMENTS]<br />写PHP脚本<br />#! /usr/bin/envdrush<br />#! /path/to drush @d6.dev –user...
构建开发和测试环境<br />dev<->staging<->www<br />$ svn up / git pull<br />$ drush sql-sync --structure-tables-key=custom --no-cache...
集成第三方扩展命令<br />backup_migrate<br />drush_make<br />node_export<br />devel<br />features<br />dbtng_migrator<br />drush_ext...
api = 2<br />core = 6.x<br />projects[drupal][version] = "6.22"<br />; Modules<br />projects[views][subdir] = "contrib"<br...
; CKEditor<br />libraries[ckeditor][download][type]= "get"<br />libraries[ckeditor][download][url] = "http://download.ckso...
drush5<br />runserver<br />site-ssh<br />Issue queue commands<br />$ drush iq-info 1070558<br />$ drush iq-apply-patch 107...
演示!<br />
问题?<br />
谢谢大家!<br />
Upcoming SlideShare
Loading in …5
×

Drush 原理与应用

1,486 views

Published on

关于Drupal drush项目的入门介绍,以及一些引申话题。

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,486
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Drush 原理与应用

  1. 1. 于志成@Zinch<br />vipzhicheng@gmail.com<br />http://www.drupal001.com<br />Drush 原理与应用<br />
  2. 2. Drush概述<br />Drush原理<br />Drush安装<br />Drush应用<br />Drush未来<br />演示<br />大纲<br />
  3. 3. 什么是Drush?<br />Drush能做什么?<br />谁需要用Drush?<br />Drush相关资源<br />Drush概述<br />
  4. 4. 什么是Drush?<br />
  5. 5. Drush = Drupal + shell<br />
  6. 6. Drupal <-> Drush <-> Linux<br />
  7. 7. $drush cc<br />Enter a number to choose which cache to clear.<br /> [0] : Cancel<br /> [1] : all<br /> [2] : theme registry<br /> [3] : menu<br /> [4] : css+js<br /> [5] : block<br /> [6] : module list<br /> [7] : theme list<br /> [8] : registry<br />
  8. 8. 什么是Drush<br />开始于<br />2006 by Arto<br />第一个版本基于drupal4.7<br />思路来自于当年的DrupalCon<br />目前<br />稳定版:drush 4.5,最低版本php5.2<br />开发版: 5.x-dev, 同上,但已经有最低要求5.3的命令<br />支持<br />5,6,7<br />4, 不支持Windows<br />
  9. 9. 网站管理(安装,升级)<br />项目管理(模块,主题,解决方案配置包,翻译)<br />核心管理(缓存,计划任务,用户,变量表)<br />数据库管理(查询,更新,备份,迁移)<br />编写脚本程序<br />可扩展性,使得Drush可以做的更多<br />Drush改变了网站的开发方式和维护方式<br />对Drush了解越多,用Drush能做的事情就越多。<br />Drush 能做什么<br />
  10. 10. 程序员<br />网站管理员<br />项目经理<br />架构师<br />任何人<br />谁需要用Drush<br />
  11. 11. http://drush.ws<br />Drush官方网站<br />http://drupal.org/project/drush<br />Drush在Drupal的项目地址<br />http://drupal.org/documentation/modules/drush<br />Drush在Drupal的文档<br />http://drupal.org/taxonomy/term/4654<br />与Drush有关的模块<br />Google.com<br />与Drush有关的文章非常非常的多<br />Drush 相关资源<br />
  12. 12. Drush命令执行路径<br />drush_main()<br />drush_dispatch()<br />drush_command();<br />drush_invoke()<br />_drush_invoke_args<br />自定义命令写法<br />命令文件,可以放在很多地方<br />MODULE.drush.inc<br />hook<br />MODULE_drush_command<br />MODULE_drush_help<br />MODULE_drush_init<br />MODULE_drush_load<br />Drush 原理<br />
  13. 13. 执行流程<br />hook_drush_init()<br />drush_COMMAND_init()<br />drush_hook_COMMAND_validate()<br />drush_hook_pre_COMMAND()<br />drush_hook_COMMAND()<br />drush_hook_post_COMMAND()<br />drush_hook_post_COMMAND_rollback()<br />drush_hook_COMMAND_rollback()<br />drush_hook_pre_COMMAND_rollback()<br />drush_hook_COMMAND_validate_rollback()<br />hook_drush_exit()<br />Drush原理<br />
  14. 14. BOOTSTRAP流程<br />define('DRUSH_BOOTSTRAP_DRUSH', 0);<br />define('DRUSH_BOOTSTRAP_DRUPAL_ROOT', 1);<br />define('DRUSH_BOOTSTRAP_DRUPAL_SITE', 2);<br />define('DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION', 3);<br />define('DRUSH_BOOTSTRAP_DRUPAL_DATABASE', 4);<br />define('DRUSH_BOOTSTRAP_DRUPAL_FULL', 5);<br />define('DRUSH_BOOTSTRAP_DRUPAL_LOGIN', 6);<br />Drush原理<br />
  15. 15. 配置文件<br />~/.drush/drushrc.php<br />别名机制<br />~/.drush/aliases.drushrc.php<br />$aliases['dev'] = array(<br /> 'root' => '/path/to/drupal',<br /> 'uri' => 'dev.mydrupalsite.com',<br /> );<br />$ drush @dev cc<br />作为选项<br />作为参数<br />policy机制<br />Drush原理<br />
  16. 16. 执行命令<br />$ drush [OPTIONS] command [ARGUMENTS]<br />写PHP脚本<br />#! /usr/bin/envdrush<br />#! /path/to drush @d6.dev –user=1 php-script<br />Drush 应用<br />
  17. 17. 构建开发和测试环境<br />dev<->staging<->www<br />$ svn up / git pull<br />$ drush sql-sync --structure-tables-key=custom --no-cache @live @dev --sanitize<br />$ drush rsync @staging:%files/ @live:%files<br />$ drush updatedb<br />$ drush features-rever t<br />构建网站开发解决方案<br />drush make<br />构建可重用功能特性<br />drush + features<br />Drush 应用<br />
  18. 18. 集成第三方扩展命令<br />backup_migrate<br />drush_make<br />node_export<br />devel<br />features<br />dbtng_migrator<br />drush_extras<br />module_builder<br />drush_views<br />Drush应用<br />
  19. 19. api = 2<br />core = 6.x<br />projects[drupal][version] = "6.22"<br />; Modules<br />projects[views][subdir] = "contrib"<br />projects[views][version] = "2.11"<br />projects[cck][subdir] = "contrib"<br />projects[cck][version] = "2.8<br />Drush makefile 示例<br />
  20. 20. ; CKEditor<br />libraries[ckeditor][download][type]= "get"<br />libraries[ckeditor][download][url] = "http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.4/ckeditor_3.4.zip"<br />libraries[ckeditor][directory_name] = "ckeditor"<br />libraries[ckeditor][destination] = "libraries"<br />Drush makefile 示例<br />
  21. 21. drush5<br />runserver<br />site-ssh<br />Issue queue commands<br />$ drush iq-info 1070558<br />$ drush iq-apply-patch 1070558<br />Node commands<br />$ drush entity-show 1 <br />$ drush entity-show 1 --json<br />$ drush entity-edit 1<br />$ drush entity-show 1 --json | drush entity-create<br />Parallelization<br />Drush未来<br />
  22. 22. 演示!<br />
  23. 23. 问题?<br />
  24. 24. 谢谢大家!<br />

×