自從使用一些新的模組後就沒做過更新的動作,這幾天心血來潮想一次更新完成,結果弄巧成拙,造成許多模組這幾天都無法使用.所以這邊記錄下正確的更新步驟.本文的更新的方式在 Drupal 的官方網站 http://drupal.org/node/672472 也可以找的到.
- 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.
- 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.
- 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.
- 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.
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.
- Using your ftp or similar program, delete the module's entire folder on the server. It is usually in /site/all/modules/.
- Copy the new module into the place where the old one was.
- 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.
- 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.
Drupal update a module 的方式落落長,簡單的得來說就是.
- 將系統進入 首頁 » 管理 » 網站設定 » 網站維護 並將網站狀態設為離線.
- 先在 首頁 » 管理 » 報告 » 可用的更新 看哪些模組需要更新,並下載新的模組
- 到 Linux 系統下移除要更新的 module 再更新成新的 module 並到 http://benjr.tw/update.php?op=info 做更新的動作. 記得不要急一個個模組做更新.最後回到首頁 » 管理 » 網站設定 » 網站維護 並將網站狀態設為上線.
這一次更新了 Views ,Panels ,IMCE ,FCKeditor ,CAPTCHA 在更新 Views ,IMCE ,CAPTCHA 照著上面的更新步驟應該都沒有問題,比較需要注意的是 Panel 和 FCKeditor .
- 更新 Panels 時要注意一點新版的 panel 需要 Chaos tool suite http://drupal.org/project/ctools 必須先啟動這一個模組.
- 還有一個是 FCKeditor 必須先保留 /var/www/html/modules/fckeditor/fckeditor 的資料,更新完後要將此資料夾複製回去.