Project

General

Profile

Patch #1404 » D1071_enlarge_wiki_content_take3.patch

Third take, with migrations... - Thomas Lecavelier, 2008-09-24 21:23

View differences:

test/unit/wiki_content_test.rb (copie de travail)
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
test/functional/issues_controller_test.rb (copie de travail)
491 491
         :attachments => {'1' => {'file' => test_uploaded_file('testfile.txt', 'text/plain')}}
492 492
    assert_redirected_to 'issues/show/1'
493 493
    j = Issue.find(1).journals.find(:first, :order => 'id DESC')
494
    puts j.notes
494 495
    assert j.notes.blank?
495 496
    assert_equal 1, j.details.size
496 497
    assert_equal 'testfile.txt', j.details.first.value
app/controllers/wiki_controller.rb (copie de travail)
80 80
      @content.attributes = params[:content]
81 81
      @content.author = User.current
82 82
      # if page is new @page.save will also save content, but not if page isn't a new record
83
      if (@page.new_record? ? @page.save : @content.save)
83
      if (@page.new_record? ? @page.save! : @content.save!)
84 84
        redirect_to :action => 'index', :id => @project, :page => @page.title
85 85
      end
86 86
    end
87
  rescue ActiveRecord::StatementInvalid
88
    # Content too long for database
89
    flash[:error] = l(:text_wiki_content_too_large)
87 90
  rescue ActiveRecord::StaleObjectError
88 91
    # Optimistic locking exception
89 92
    flash[:error] = l(:notice_locking_conflict)
lang/lt.yml (copie de travail)
642 642
notice_unable_delete_version: Neimanoma panaikinti versiją
643 643
label_renamed: pervardintas
644 644
label_copied: nukopijuotas
645
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/uk.yml (copie de travail)
642 642
notice_unable_delete_version: Unable to delete version
643 643
label_renamed: renamed
644 644
label_copied: copied
645
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ro.yml (copie de travail)
640 640
notice_unable_delete_version: Unable to delete version
641 641
label_renamed: renamed
642 642
label_copied: copied
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/zh.yml (copie de travail)
641 641
enumeration_issue_priorities: 问题优先级
642 642
enumeration_doc_categories: 文档类别
643 643
enumeration_activities: 活动(时间跟踪)
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/pt.yml (copie de travail)
640 640
notice_unable_delete_version: Impossível apagar esta versão
641 641
label_renamed: renomeado
642 642
label_copied: copiado
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ca.yml (copie de travail)
642 642
setting_commit_logs_encoding: Commit messages encoding
643 643
label_renamed: renamed
644 644
label_copied: copied
645
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/da.yml (copie de travail)
641 641
enumeration_issue_priorities: Sagsprioriteter
642 642
enumeration_doc_categories: Dokumentkategorier
643 643
enumeration_activities: Aktiviteter (tidsregistrering)
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/pt-br.yml (copie de travail)
641 641
notice_unable_delete_version: Unable to delete version
642 642
label_renamed: renamed
643 643
label_copied: copied
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/sr.yml (copie de travail)
641 641
notice_unable_delete_version: Unable to delete version
642 642
label_renamed: renamed
643 643
label_copied: copied
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/tr.yml (copie de travail)
641 641
notice_unable_delete_version: Unable to delete version
642 642
label_renamed: renamed
643 643
label_copied: copied
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ru.yml (copie de travail)
673 673
text_wiki_destroy_confirmation: Вы уверены, что хотите удалить данную Wiki и все содержимое?
674 674
text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний
675 675

  
676
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/de.yml (copie de travail)
641 641
enumeration_issue_priorities: Ticket-Prioritäten
642 642
enumeration_doc_categories: Dokumentenkategorien
643 643
enumeration_activities: Aktivitäten (Zeiterfassung)
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/bg.yml (copie de travail)
640 640
notice_unable_delete_version: Unable to delete version
641 641
label_renamed: renamed
642 642
label_copied: copied
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/sv.yml (copie de travail)
641 641
notice_unable_delete_version: Unable to delete version
642 642
label_renamed: renamed
643 643
label_copied: copied
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ja.yml (copie de travail)
641 641
notice_unable_delete_version: Unable to delete version
642 642
label_renamed: renamed
643 643
label_copied: copied
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/he.yml (copie de travail)
640 640
notice_unable_delete_version: Unable to delete version
641 641
label_renamed: renamed
642 642
label_copied: copied
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/fi.yml (copie de travail)
640 640
notice_unable_delete_version: Unable to delete version
641 641
label_renamed: renamed
642 642
label_copied: copied
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/en.yml (copie de travail)
641 641
enumeration_issue_priorities: Issue priorities
642 642
enumeration_doc_categories: Document categories
643 643
enumeration_activities: Activities (time tracking)
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/cs.yml (copie de travail)
645 645
notice_unable_delete_version: Unable to delete version
646 646
label_renamed: renamed
647 647
label_copied: copied
648
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/fr.yml (copie de travail)
614 614
text_enumeration_destroy_question: 'Cette valeur est affectée à %d objets.'
615 615
text_enumeration_category_reassign_to: 'Réaffecter les objets à cette valeur:'
616 616
text_email_delivery_not_configured: "L'envoi de mail n'est pas configuré, les notifications sont désactivées.\nConfigurez votre serveur SMTP dans config/email.yml et redémarrez l'application pour les activer."
617
text_wiki_content_too_large: Le contenu du wiki est trop grand pour votre base de données. Merci de tronquer ce contenu.
617 618

  
618 619
default_role_manager: Manager
619 620
default_role_developper: Développeur
lang/es.yml (copie de travail)
643 643
notice_unable_delete_version: Unable to delete version
644 644
label_renamed: renamed
645 645
label_copied: copied
646
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/nl.yml (copie de travail)
643 643
notice_unable_delete_version: Onmogelijk om deze versie te verwijderen.
644 644
label_renamed: hernoemt
645 645
label_copied: gekopieerd
646
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/ko.yml (copie de travail)
640 640
notice_unable_delete_version: Unable to delete version
641 641
label_renamed: renamed
642 642
label_copied: copied
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/zh-tw.yml (copie de travail)
641 641
enumeration_issue_priorities: 項目優先權
642 642
enumeration_doc_categories: 文件分類
643 643
enumeration_activities: 活動 (時間追蹤)
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/pl.yml (copie de travail)
640 640
notice_unable_delete_version: Unable to delete version
641 641
label_renamed: renamed
642 642
label_copied: copied
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/th.yml (copie de travail)
643 643
notice_unable_delete_version: Unable to delete version
644 644
label_renamed: renamed
645 645
label_copied: copied
646
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/no.yml (copie de travail)
600 600
text_assign_time_entries_to_project: Overfør førte timer til prosjektet
601 601
text_reassign_time_entries: 'Overfør førte timer til denne saken:'
602 602
text_user_wrote: '%s skrev:'
603
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
603 604

  
604 605
default_role_manager: Leder
605 606
default_role_developper: Utvikler
......
641 642
notice_unable_delete_version: Unable to delete version
642 643
label_renamed: renamed
643 644
label_copied: copied
645
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/it.yml (copie de travail)
640 640
notice_unable_delete_version: Impossibile cancellare la versione
641 641
label_renamed: rinominato
642 642
label_copied: copiato
643
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
lang/hu.yml (copie de travail)
641 641
notice_unable_delete_version: A verziót nem lehet törölni
642 642
label_renamed: átnevezve
643 643
label_copied: lemásolva
644
text_wiki_content_too_large: Wiki content is too large for your database. Please truncate it.
db/migrate/20080924191748_alter_wiki_content_text_size.rb (révision 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
(3-3/4)