你的位置:国外/美国服务器租用 技术文档 LinuxVPS使用教程 正文
使用drush up drupal自动升级drupal
  • Drush 是一个可以通过命令行来管理 Drupal 网站的东西,使用 Drush 升级 Drupal,只需要一条命令:drush up drupal

    安装Drush Install/Update - Unix/OSX

    The easiest way to install the latest release of Drush on Unix/Linux systems is via our custom PEAR channel.

    pear channel-discover pear.drush.org
    pear install drush/drush

    Tip: Use sudo to overcome permission problems. If the channel-discover fails, try running the following sequence of commands:

    pear upgrade --force Console_Getopt
    pear upgrade --force pear
    pear upgrade-all

    To update, run pear upgrade drush/drush

    注意事项:

    1. 为了使用Drush,必须先告诉Drush要操作哪个站点,一个最直接的方法是将当前目录转到要想操作的站点目录下,Drush就自动将操作应用于当前目录下的站点。
    2. 升级会直接覆盖文件,改动过的文件,一定要做好备份。例如 robots.txt  .htaccess ,模板,css 等
    3. 升级后,文件被覆盖,文件权限被修改。要修改回正确的权限:chown -R ctohome:ctohome  /your_document_root

    Drush 升级drupal 范例:

    [root@ctohome.com]# pear upgrade drush/drush
    Nothing to upgrade
    [root@ctohome.com]# drush up drupal
    Command pm-update needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this         [error]
    command.
    Command pm-update needs the following modules installed/enabled to run: update.                                                                       [error]
    The drush command 'up drupal' could not be executed.                                                                                                  [error]
    A Drupal installation directory could not be found                                                                                                    [error]
    [root@ctohome.com]# cd drupal_root_public_html/
    [root@ctohome.com]# drush up drupal
    Checking available update data ...                                                                                                                       [ok]
    Checked available update data for Address Field.                                                                                                         [ok]
    Checked available update data for AddToAny.                                                                                                              [ok]
    Checked available update data for Advanced help.                                                                                                         [ok]
    Checked available update data for Affiliates.                                                                                                            [ok]
    Checked available update data for Block.                                                                                                                 [ok]
    Checked available update data for CAPTCHA.                                                                                                               [ok]
    Checked available update data for CKEditor.                                                                                                              [ok]
    Checked available update data for Node clone.                                                                                                            [ok]
    Checked available update data for Countries.                                                                                                             [ok]
    Checked available update data for Chaos tools.                                                                                                           [ok]
    Checked available update data for Current Search Blocks.                                                                                                 [ok]
    Checked available update data for Custom Search.                                                                                                         [ok]
    Checked available update data for Devel.                                                                                                                 [ok]
    Checked available update data for Theme developer.                                                                                                       [ok]
    Checked available update data for Entity API.                                                                                                            [ok]
    Checked available update data for Forward.                                                                                                               [ok]
    Checked available update data for Global Redirect.                                                                                                       [ok]
    Checked available update data for Gotwo.                                                                                                                 [ok]
    Checked available update data for IMCE.                                                                                                                  [ok]
    Checked available update data for Meta tags.                                                                                                             [ok]
    Checked available update data for Node Reference.                                                                                                        [ok]
    Checked available update data for Page Title.                                                                                                            [ok]
    Checked available update data for Pathauto.                                                                                                              [ok]
    Checked available update data for Private messages.                                                                                                      [ok]
    Checked available update data for User Referral 2.                                                                                                       [ok]
    Checked available update data for Rules.                                                                                                                 [ok]
    Checked available update data for Search API.                                                                                                            [ok]
    Checked available update data for Search ranges.                                                                                                         [ok]
    Checked available update data for Services.                                                                                                              [ok]
    Checked available update data for simplehtmldom API.                                                                                                     [ok]
    Checked available update data for SMTP Authentication Support.                                                                                           [ok]
    Checked available update data for Token.                                                                                                                 [ok]
    Checked available update data for Userpoints.                                                                                                            [ok]
    Checked available update data for Viewfield.                                                                                                             [ok]
    Checked available update data for Views.                                                                                                                 [ok]
    Checked available update data for Alpha.                                                                                                                 [ok]
    Checked available update data for Zen.                                                                                                                   [ok]
    Checked available update data for 37 projects.                                                                                                       [status]
    Update information last refreshed: Fri, 04/19/2013 - 10:11

    Update status information on all installed and enabled Drupal projects:
     Name                                Installed version  Proposed version  Status                                            
     Address Field (addressfield)        7.x-1.0-beta3      7.x-1.0-beta3     Up to date                                        
     AddToAny (addtoany)                 7.x-4.0            7.x-4.0           Up to date                                        
     Advanced help (advanced_help)       7.x-1.0            7.x-1.0           Up to date                                        
     Affiliates (affiliates)             7.x-1.0            7.x-1.0           Up to date                                        
     Drupal                              7.19               7.22              SECURITY UPDATE available                         
     CAPTCHA (captcha)                   7.x-1.0-beta2      7.x-1.0-beta2     Up to date                                        
     CKEditor (ckeditor)                 7.x-1.12           7.x-1.13          Update available                                  
     node_clone                          7.x-1.0-rc1        7.x-1.0-rc1       Up to date                                        
     Countries (countries)               7.x-2.1            7.x-2.1           Up to date                                        
     Chaos tools (ctools)                7.x-1.2            7.x-1.3           SECURITY UPDATE available                         
     Facet API (facetapi)                7.x-1.2            7.x-1.3           Update available                                  
     Custom Search (custom_search)       7.x-1.11           7.x-1.11          Up to date                                        
     Devel (devel)                       7.x-1.3            7.x-1.3           Up to date                                        
     Theme developer (devel_themer)      7.x-1.x-dev        7.x-1.x-dev       Update available                                  
     Entity API (entity)                 7.x-1.0            7.x-1.0           Up to date                                        
     Forward (forward)                   7.x-2.0-beta2      7.x-2.0-beta2     Up to date                                        
     Global Redirect (globalredirect)    7.x-1.5            7.x-1.5           Up to date                                        
     Gotwo (gotwo)                       7.x-1.1            7.x-1.1           Up to date                                        
     IMCE (imce)                         7.x-1.7            7.x-1.7           Up to date                                        
     Meta tags (metatag)                 7.x-1.0-beta4      7.x-1.0-beta6     Update available                                  
     References (references)             7.x-2.1            7.x-2.1           Up to date                                        
     Page Title (page_title)             7.x-2.7            7.x-2.7           Up to date                                        
     Pathauto (pathauto)                 7.x-1.2            7.x-1.2           Up to date                                        
     Private messages (privatemsg)       7.x-1.3            7.x-1.3           Up to date                                        
     User Referral 2 (referral)          7.x-1.0-beta4      7.x-1.0-beta4     Up to date                                        
     Rules (rules)                       7.x-2.2            7.x-2.3           SECURITY UPDATE available                         
     Search API (search_api)             7.x-1.4            7.x-1.4           Up to date                                        
     Search ranges (search_api_ranges)   7.x-1.4            7.x-1.4           Up to date                                        
     Services (services)                 7.x-3.3            7.x-3.3           Up to date                                        
     simplehtmldom API (simplehtmldom)   7.x-1.12           7.x-1.12          Up to date                                        
     SMTP Authentication Support (smtp)  7.x-1.0            7.x-1.0           Up to date                                        
     Token (token)                       7.x-1.5            7.x-1.5           Up to date                                        
     Userpoints (userpoints)             7.x-1.0            7.x-1.0           Up to date                                        
     Viewfield (viewfield)               7.x-2.0            7.x-2.0           Up to date                                        
     Views (views)                       7.x-3.5            7.x-3.7           SECURITY UPDATE available                         
     Omega (omega)                       7.x-3.1            7.x-3.1           Up to date                                        
     Zen (zen)                           7.x-5.1            7.x-5.1           Up to date                                        



    Code updates will be made to drupal core.
    WARNING:  Updating core will discard any modifications made to Drupal core files, most noteworthy among these are .htaccess and robots.txt.  If you have made any modifications to these files, please back them up before updating so that you can re-create your modifications in the updated version of the file.
    Note: Updating core can potentially break your site. It is NOT recommended to update production sites without prior testing.

    Do you really want to continue? (y/n): y

    Project drupal was updated successfully. Installed version is now 7.22.
    Backups were saved into the directory /root/drush-backups/ctohome.com/20130420010815/drupal.                                                       [ok]
    'all' cache was cleared in /home/ctohome.com/public_html#default                                                                              [success]
    You have pending database updates. Run `drush updatedb` or visit update.php in your browser.                                                        [warning]
    The following updates are pending:

    system module :
      7078 -   Add binary to {date_formats}.format.

    dblog module :
      7002 -   Add an index to the severity column in the watchdog database table.

    field module :
      7003 -   Add the FieldInfo class to the class registry.

    Do you wish to run all pending updates? (y/n): y
    Performed update: field_update_7003                                                                                                                      [ok]
    Performed update: dblog_update_7002                                                                                                                      [ok]
    Performed update: system_update_7078                                                                                                                     [ok]
    Finished performing updates.                                      

     

  • 点这里复制本页地址发送给您QQ/MSN上的好友
  • 相关文章
  • 本文章所属分类:首页 技术文档 LinuxVPS使用教程