Project

General

Profile

Patch #1404 » D1071_enlarge_wiki_content.patch

fix_1071_wiki - Thomas Lecavelier, 2008-06-08 20:37

View differences:

app/controllers/wiki_controller.rb (working copy)
73 73
      @content.attributes = params[:content]
74 74
      @content.author = User.current
75 75
      # if page is new @page.save will also save content, but not if page isn't a new record
76
      if (@page.new_record? ? @page.save : @content.save)
76
      if (@page.new_record? ? @page.save! : @content.save!)
77 77
        redirect_to :action => 'index', :id => @project, :page => @page.title
78 78
      end
79 79
    end
80
  rescue ActiveRecord::StatementInvalid
81
    # Content too long for database
82
    flash[:error] = l(:text_wiki_content_too_large)
80 83
  rescue ActiveRecord::StaleObjectError
81 84
    # Optimistic locking exception
82 85
    flash[:error] = l(:notice_locking_conflict)
db/migrate/095_alter_wiki_content_text_size.rb (revision 0)
1
class AlterWikiContentTextSize < ActiveRecord::Migration
2
  def self.up
3
    change_column :wiki_contents, :text, :text, :limit => 64.kilobytes * 2
4
    change_column :wiki_content_versions, :data, :binary, :limit => 64.kilobytes * 2
5
  end
6

  
7
  def self.down
8
    change_column :wiki_content_versions, :data, :binary
9
    change_column :wiki_contents, :text, :text
10
  end
11
end
lang/bg.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/cs.yml (working copy)
628 628
mail_subject_reminder: "%d issue(s) due in the next days"
629 629
text_user_wrote: '%s wrote:'
630 630
label_duplicated_by: duplicated by
631
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/da.yml (working copy)
625 625
mail_subject_reminder: "%d issue(s) due in the next days"
626 626
text_user_wrote: '%s wrote:'
627 627
label_duplicated_by: duplicated by
628
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/de.yml (working copy)
624 624
mail_subject_reminder: "%d issue(s) due in the next days"
625 625
text_user_wrote: '%s wrote:'
626 626
label_duplicated_by: duplicated by
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/en.yml (working copy)
598 598
text_assign_time_entries_to_project: Assign reported hours to the project
599 599
text_reassign_time_entries: 'Reassign reported hours to this issue:'
600 600
text_user_wrote: '%s wrote:'
601
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
601 602

  
602 603
default_role_manager: Manager
603 604
default_role_developper: Developer
lang/es.yml (working copy)
626 626
mail_subject_reminder: "%d issue(s) due in the next days"
627 627
text_user_wrote: '%s wrote:'
628 628
label_duplicated_by: duplicated by
629
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/fi.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/fr.yml (working copy)
597 597
text_destroy_time_entries: Supprimer les heures
598 598
text_assign_time_entries_to_project: Reporter les heures sur le projet
599 599
text_reassign_time_entries: 'Reporter les heures sur cette demande:'
600
text_user_wrote: '%s a écrit:'
600
text_user_wrote: '%s a écrit
601
text_wiki_content_too_large: Le contenu de cette page de wiki est trop grand. Merci de le réduire.
601 602

  
602 603
default_role_manager: Manager
603 604
default_role_developper: Développeur
lang/he.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/hu.yml (working copy)
624 624
mail_subject_reminder: "%d feladat határidős az elkövetkező napokban"
625 625
text_user_wrote: '%s írta:'
626 626
label_duplicated_by: duplikálta
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
628

  
lang/it.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ja.yml (working copy)
624 624
mail_subject_reminder: "%d issue(s) due in the next days"
625 625
text_user_wrote: '%s wrote:'
626 626
label_duplicated_by: duplicated by
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ko.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/lt.yml (working copy)
625 625
mail_subject_reminder: "%d issue(s) due in the next days"
626 626
text_user_wrote: '%s wrote:'
627 627
label_duplicated_by: duplicated by
628
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/nl.yml (working copy)
624 624
mail_subject_reminder: "%d issue(s) due in the next days"
625 625
text_user_wrote: '%s wrote:'
626 626
label_duplicated_by: duplicated by
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/no.yml (working copy)
598 598
text_assign_time_entries_to_project: Overfør førte timer til prosjektet
599 599
text_reassign_time_entries: 'Overfør førte timer til denne saken:'
600 600
text_user_wrote: '%s skrev:'
601
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
601 602

  
602 603
default_role_manager: Leder
603 604
default_role_developper: Utvikler
lang/pl.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/pt-br.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/pt.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ro.yml (working copy)
623 623
mail_subject_reminder: "%d issue(s) due in the next days"
624 624
text_user_wrote: '%s wrote:'
625 625
label_duplicated_by: duplicated by
626
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ru.yml (working copy)
627 627
mail_subject_reminder: "%d назначенных на вас задач в ближайшие дни" 
628 628
text_user_wrote: '%s написал:'
629 629
label_duplicated_by: duplicated by
630
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/sr.yml (working copy)
624 624
mail_subject_reminder: "%d issue(s) due in the next days"
625 625
text_user_wrote: '%s wrote:'
626 626
label_duplicated_by: duplicated by
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/sv.yml (working copy)
624 624
mail_subject_reminder: "%d issue(s) due in the next days"
625 625
text_user_wrote: '%s wrote:'
626 626
label_duplicated_by: duplicated by
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/th.yml (working copy)
626 626
mail_subject_reminder: "%d issue(s) due in the next days"
627 627
text_user_wrote: '%s wrote:'
628 628
label_duplicated_by: duplicated by
629
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/uk.yml (working copy)
625 625
mail_subject_reminder: "%d issue(s) due in the next days"
626 626
text_user_wrote: '%s wrote:'
627 627
label_duplicated_by: duplicated by
628
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/zh-tw.yml (working copy)
624 624
enumeration_issue_priorities: 項目優先權
625 625
enumeration_doc_categories: 文件分類
626 626
enumeration_activities: 活動 (時間追蹤)
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/zh.yml (working copy)
624 624
enumeration_doc_categories: 文档类别
625 625
enumeration_activities: 活动(时间跟踪)
626 626
label_duplicated_by: duplicated by
627
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
test/unit/wiki_content_test.rb (working copy)
40 40
    assert_equal User.find(1), content.author
41 41
    assert_equal content.text, content.versions.last.text
42 42
  end
43
  
44
  def test_very_big_create
45
    page = WikiPage.new(:wiki => @wiki, :title => "Big big page")
46
    big_text = "X" * 1024 * 64
47
    bt_l = big_text.length
48
    puts "text length: #{bt_l}"
49
    page.content = WikiContent.new(:text => big_text, :author => User.find(1), :comments => "Eat that, MySQL")
50
    page.save
51
    assert_equal bt_l, WikiPage.find(page.id).content.text.length, "Wiki content lost!" 
52
  end
43 53

  
44 54
  def test_update
45 55
    content = @page.content
(1-1/4)