Software: February 2008 Archives

Upgrade from MT 2.661 to MT 4.1

| | Comments (0) | TrackBacks (0)

http://www.movabletype.org/downloads/MTOS-4.1-en.zip

新版有 Wizard (mt-wizard.cgi), 設定很方便, 一下子就裝好了, 記得之前裝 2.661 時弄好久.
編輯 mt-config.cgi, 加上
PublishCharset UTF-8
SQLSetNames 1
沒有加這個會造成前端資料看起來是正常中文, 後端用 phpMyAdmin 看會呈現亂碼.
為了使舊的文章維持原來的 URL, 必需修改 Archive Mapping
Design / Tamplates / Archive Templates / Entry
Archive Mapping 選 Custom, 輸入 archives/%e.html
舊版匯出的資料, 到 System Overview / Tools / Import
因為匯入時, entry_id 是連續的, 然而舊的資料因為有刪除, 所以需手動調整一下 entry_id
分別到舊版跟新版的資料庫 select entry_id from mt_entry 結果存成 entryid2, entryid4


#!/bin/sh
N=`cat entryid2 | wc -l`
{
for ((i=1;i<=$N;i++))
do
    ID2=`sed -n ${i}p entryid2`
    ID4=`sed -n ${i}p entryid4`
    if [ $ID2 != $ID4 ] ; then
        echo "update mt_entry set entry_id=$ID2 where entry_id=$ID4;"
        echo "update mt_placement set placement_entry_id=$ID2 where placement_entry_id=$ID4;"
        echo "update mt_comment set comment_entry_id=$ID2 where comment_entry_id=$ID4;"
    fi
done
} | tac


這個 script 執 行結果存成 modify_entry_id.sql
mysql -u user -p password -h host dbname < modify_entry_id.sql
如此 entry_id 就修改成跟舊的一樣了,
最後重建檔案, Publish Site (在 Preference 旁邊), All Files
ref.
Movable Type Configuration Directive Reference
Archive File Path Specifiers
2008-03-01 Update: 本來以為用上面的方法調整 entry_id, 重建應該是 OK 的, 最後還是發現 comment 跟文章有對不上的狀況, 放棄維持原 URL, Archive Mapping 使用預設的再重建.

Pages

March 2008

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

About this Archive

This page is a archive of entries in the Software category from February 2008.

Software: November 2007 is the previous archive.

Find recent content on the main index or look in the archives to find all content.