close

Magento Logo  

日前 Magento eCommerce 公布目前使用中的 Magento 版本 1.9.1.0 有許多安全性漏洞

所以在短時間內發佈了 1.9.1.1 => 1.9.2.0 => 1.9.2.1 這三個版本

因為之前使用 Magento Connect 嘗試升級的經驗實在不太好

所以目前還是偏好使用 SSH 來進行 Command Line upgrade

提供兩種方式

1. 使用內建的套件升級

2. 直接抓新版覆蓋

這邊將兩種方式的Code貼出來,造福也有需要的朋友

 

首先一定要做的是備份現有的檔案及資料庫(強烈建議)

tar zcvf magento_$(date +"%Y-%m-%d").tar.gz (magento的位置)
mysqldump -u root --password=(mysql的密碼) magento > magento_$(date +"%Y-%m-%d").sql

 

開始使用內建套件升級

nginx_path="/usr/share/nginx"  (請依照你的實際位置修改)
magento_path="/usr/share/nginx/html"  (請依照你的實際位置修改)
touch $magento_path/maintenance.flag
rm -rf $magento_path/var/cache $magento_path/var/session
chmod 550 $magento_path/mage
$magento_path/mage mage-setup .
$magento_path/mage config-set preferred_state stable
$magento_path/mage list-upgrades
$magento_path/mage install http://connect20.magentocommerce.com/community
Mage_All_Latest --force
chown -R nginx: $magento_path
php $magento_path/shell/indexer.php reindexall
rm -f $magento_path/maintenance.flag

這樣子就升級完成了

 

如果好死不死遇到沒辦法升級的情形呢?

之前我們公司經歷過一次方案一的升級,結果這次的升級反而會卡住

查了一些資料,應該是有些檔案並沒有升級完全

所以就產生了方案二:

使用新版檔案覆蓋升級

nginx_path="/usr/share/nginx"  (請依照你的實際位置修改)
magento_path="/usr/share/nginx/html"  (請依照你的實際位置修改)
touch $magento_path/maintenance.flag
rm -rf $magento_path/var/cache $magento_path/var/session
/bin/cp -rf $nginx_path/magento/* $magento_path
chown -R nginx: $magento_path
php $magento_path/shell/indexer.php reindexall
rm -f $magento_path/maintenance.flag

 

這樣子就升級完成了!

由於主程式碼完全更新,所以之前做過的修改別忘了要再重來一次喔

arrow
arrow

    多元化脂肪肝 發表在 痞客邦 留言(0) 人氣()