Ads 468x60px

Pages

2011年4月26日 星期二

安裝 Remine 及 Migrate Trac to Redmine 之解決 wiki format 的相容問題(二)


繼上一篇安裝及把資料從 Trac 移到 Redmine 之後,除了 wiki format 的錯亂之外,還會發生一些 internal server error 的問題,例如看 wiki page 含有 attachment 時,或是點擊 issue;主要問題是移轉後,redmine 資料庫裡,部份 table 欄位如果有 datetime 的格式時,轉過來後都變成 "0000-00-00 00:00:00". 目前發現有問題的是這些,所以就用以下方式把它們都設定成現在的時間。
mysql> update attachments set created_on=now();

mysql> update issues set created_on=now(), updated_on=now();

mysql> update wiki_content_versions set updated_on=now();

mysql> update journals set created_on=now();
附帶問題發生時的錯誤訊息,及發現問題的方法:
/home/m/share/htdocs/redmine/log/production.log
ActionView::TemplateError (undefined method `<=>' for nil:NilClass) on line #2 of app/views/wiki/_content.rhtml:
1: 
2: <%= textilizable content, :text, :attachments => content.page.attachments %> 3:
app/helpers/application_helper.rb:504:in `parse_inline_attachments' app/helpers/application_helper.rb:502:in `gsub!' app/helpers/application_helper.rb:502:in `parse_inline_attachments' app/helpers/application_helper.rb:458:in `send' app/helpers/application_helper.rb:458:in `textilizable' app/helpers/application_helper.rb:457:in `each' app/helpers/application_helper.rb:457:in `textilizable' app/helpers/application_helper.rb:477:in `parse_non_pre_blocks' app/helpers/application_helper.rb:456:in `textilizable' app/views/wiki/_content.rhtml:2:in `_run_rhtml_app47views47wiki47_content46rhtml_locals_content_object' app/views/wiki/show.rhtml:30:in `_run_rhtml_app47views47wiki47show46rhtml' app/controllers/wiki_controller.rb:80:in `show' public/dispatch.fcgi:24 Rendering /home/m/share/htdocs/redmine/public/500.html (500 Internal Server Error)
修改 app/helpers/application_helper.rb:504, 將 sort_by 拿掉就好了,所以就想說是不是資料庫的問題,改完 DB 之後,果然就好了。所以這支 application_helper.rb 也不必 hack 了。
504 #       attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse
505         attachments ||= options[:attachments]
最後是更新 wiki contents 了,請照著 github 上的說明來做。

https://xfalcons@github.com/xfalcons/migrate-trac-to-redmine.git

後續,接下來會試一些好用的 plugins ,到時再分享。