Skip to content

Commit 49c1b49

Browse files
committed
Merge pull request #247 from VSEphpbb/bugfix
Increase rule message size for postgres and mssql
2 parents c1bf58a + ee6f908 commit 49c1b49

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
*
4+
* Board Rules extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2015 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
namespace phpbb\boardrules\migrations\v10x;
12+
13+
/**
14+
* Migration stage 12: Update the rule_message column type to MTEXT_UNI
15+
*/
16+
class m12_update_rule_message extends \phpbb\db\migration\migration
17+
{
18+
/**
19+
* Assign migration file dependencies for this migration
20+
*
21+
* @return array Array of migration files
22+
* @static
23+
* @access public
24+
*/
25+
static public function depends_on()
26+
{
27+
return array(
28+
'\phpbb\boardrules\migrations\v10x\m1_initial_schema',
29+
'\phpbb\boardrules\migrations\v10x\m7_sample_rule_data',
30+
);
31+
}
32+
33+
/**
34+
* Update boardrules table schema
35+
* Note: Do not revert this schema change or else an SQL error will occur
36+
* when purging data if a postgres or mssql db has a large rule message.
37+
*
38+
* @return array Array of table schema
39+
* @access public
40+
*/
41+
public function update_schema()
42+
{
43+
return array(
44+
'change_columns' => array(
45+
$this->table_prefix . 'boardrules' => array(
46+
'rule_message' => array('MTEXT_UNI', ''),
47+
),
48+
),
49+
);
50+
}
51+
}

migrations/v10x/m3_add_schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static public function depends_on()
3030
/**
3131
* Add table columns schema to the database:
3232
* boardrules:
33-
* rule_parents Basic rule data is serialzed and cached here
33+
* rule_parents Basic rule data is serialised and cached here
3434
*
3535
* @return array Array of table columns schema
3636
* @access public

tests/functional/admin_controller_test.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function test_acp_create_rule($crawler)
5454
$form = $crawler->selectButton($this->lang('SUBMIT'))->form(array(
5555
'rule_title' => 'Test Rule',
5656
'rule_anchor' => 'test-rule',
57-
'rule_message' => 'This is a test rule.',
57+
'rule_message' => str_repeat('test ', 1000), // 5000 character message
5858
));
5959
$crawler = self::submit($form);
6060

@@ -77,8 +77,6 @@ public function test_acp_edit_rule()
7777
// Assert edit page is displayed
7878
$this->assertContainsLang('ACP_BOARDRULES_EDIT_RULE', $crawler->filter('#main')->text());
7979
$this->assertContainsLang('ACP_BOARDRULES_EDIT_RULE_EXPLAIN', $crawler->filter('#main')->text());
80-
81-
return $rule_id;
8280
}
8381

8482
/**

0 commit comments

Comments
 (0)