raise_wiki_content_size.patch

Rewritten patch from #1404 against r3182 - Thomas Lecavelier, 2009-12-18 23:52

Download (1.5 KB)

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
    body = "X" * 1.megabytes # 1MB of text, > 64K from naked TEXT mysql column in rails. Don't test 16MB to avoid mem starvation
46
    page = WikiPage.new(:wiki => @wiki, :title => "Big big page")
47
    page.content = WikiContent.new(:text => body, :author => User.find(1), :comments => "Eat that,i RDBMS")
48
    page.save
49
    page.reload
50
    assert_equal body.length, WikiPage.find(page.id).content.text.length, "Wiki content truncated!" 
51
  end
43 52
  
44 53
  def test_create_should_send_email_notification
45 54
    Setting.notified_events = ['wiki_content_added']
db/migrate/20091218160716_enlarge_wiki_contents.rb (révision 0)
1
class EnlargeWikiContents < ActiveRecord::Migration
2
  MAX_SIZE = 16.megabytes
3
  def self.up
4
    change_column :wiki_contents, :text, :text, :limit => MAX_SIZE
5
    change_column :wiki_content_versions, :data, :binary, :limit => MAX_SIZE
6
  end
7

  
8
  def self.down
9
    raise ActiveRecord::IrreversibleMigration 
10
  end
11
end