MT3.1への移行について<


少し前に、MovableTypeの3.1がリリースされました。
しかし、アップグレードのスクリプトは相変わらずバグが多い…。
このサイトではまだパッチをあてていませんが、仕事でいじったのでメモとして残しておきます。
まだ隠れてるバグも多いでしょうけど、役に立つかな?
■my-upgrade31.cgiの修正
・blog_custom_dynamic_templates の最後の”s”が抜けている箇所を修正
line76: blog_custom_dynamic_template -> blog_custom_dynamic_templates
line117: blog_custom_dynamic_template -> blog_custom_dynamic_templates
・PostgreSQLがver7.2.3以前の場合、SQLのalter文で項目のNOT NULL制約は変更できないので、
line125~131:
push @stmts, (‘update mt_template set template_build_dynamic = 0 where template_build_dynamic <> 1 or template_build_dynamic is null’,
‘alter table mt_template alter column template_build_dynamic set not null’);
push @stmts, (‘alter table mt_category add category_parent integer’,
‘update mt_category set category_parent = 0’,
‘alter table mt_category alter column category_parent set not null’)
unless has_column($dbh, ‘mt_category’, ‘category_parent’);
push @stmts, (“update mt_entry set entry_basename = ” where entry_basename is null”,
‘alter table mt_entry alter column entry_basename set not null’);
上記部分を下記のように修正。
push @stmts, (‘update mt_template set template_build_dynamic = 0 where template_build_dynamic <> 1 or template_build_dynamic is null’);
push @stmts, (‘alter table mt_category add category_parent integer’,
‘update mt_category set category_parent = 0’)
unless has_column($dbh, ‘mt_category’, ‘category_parent’);
push @stmts, (“update mt_entry set entry_basename = ” where entry_basename is null”);
・日付関連の追加項目がNULL値のため更新時にエラーが起るので、
push @stmts, (“update mt_template set template_modified_on=’2004-01-01 12:00:00′”);
push @stmts, (“update mt_template set template_created_on=’2004-01-01 12:00:00′”);
push @stmts, (“update mt_blog set blog_children_modified_on=’2004-01-01 12:00:00′”);
上記3行をline284↓の手前に追加。(3箇所以上ありそうですが)
for my $sql (@stmts) {
print “Running ‘$sql’\n”;
$dbh->do($sql) or die $dbh->errstr . ” on $sql”;
}
■アーカイブの設定
↓こんな感じでお好みで。
・個別 <$MTArchiveCategory$>/<$MTEntryID pad="1"$>.html
・月別 <$MTArchiveDate format="%Y%m"$>.html
・カテゴリー <$MTArchiveCategory$>/index.html
こんなとこですかね。ふぅ。



コメント

MT3.1への移行について< — 2件のコメント

  1. MovableType 3.1にアップグレード

    ついに、MovableTypeを3.1にしました。 DBの更新でエラーが出てしまって少し焦りましたが、Postgres のバージョンが古かったのが原因でした。 …

しおいりともひろ へ返信する コメントをキャンセル

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です


*