How to update a module

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

I looked for instructions on how to update a Drupal module, but could not find any good ones. I did find some, but they were dangerously incomplete. Therefore I will now write down how I do it, hoping for hints at possible improvements.

  1. Download the new version of the module and unpack it, so you have the module folder ready on your local disk (or in a location outside your Drupal installation on the server). The folder usually bears the short name of the module and contains a file also bearing the short name of the module, followed by ".module". Most also contain a README.txt file, which you may want to read and check for special update instructions.
  2. Make sure your latest complete backup is not too old. A module change, if well done, poses only a small risk of database corruption, but it is better to be safe than sorry.
  3. Make sure you are logged in as admin (user #1). This is necessary for later steps. If you are logged on as another user, log off, then log on again as admin.
  4. Fire up your ftp program or whatever you use to work with files on the server and connect to the server. You want to minimize the downtime, so prepare yourself as well as possible before you take the site offline.
  5. Put the entire site into maintenance mode (Administer, Site configuration, Site maintenance). If you are a nice operator, you can add some text to the message, stating why the site is offline and when it will be back online, for example: "A module of this web site is being updated. Work should be finished on the full hour. Please check back then."

    The reason for entering maintenance mode is that you don't want web visitors to call up module code while that same module code is missing, incomplete, or being deleted or written. That would lead to ugly temporary errors or, in the very worst case, to database corruption. An alternative would be to disable the module temporarily, but you need maintenance mode for the later running of update.php anyway.

    Warning: Do not uninstall the module, because that would likely lead to the loss of all data the module may have kept in the database.

  6. Using your ftp or similar program, delete the module's entire folder on the server. It is usually in /site/all/modules/.
  7. Copy the new module into the place where the old one was.
  8. Make sure again that you are logged on as admin, then run update.php. To do that, you enter the URL of your Drupal web site in the web browser, followed by /update.php. Example: http://winhlp.com/update.php

    Go through the steps of the update procedure. The most important point here is to check the displayed log for any errors. If there are errors, you have to find out what went wrong, before you put the site back online.

  9. If there are no errors, end maintenance mode to put your site back online. The simplest way to do that with one mouse click is to go to the Site maintenance page again and click on the button [Reset to defaults]. That's it, your site has been successfully upgraded and is now back online.

If you find any fault in these instructions, please add a comment.

转载于:https://my.oschina.net/u/187928/blog/34161

你可能感兴趣的:(How to update a module)