Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
profilefield_remove_underscore_from_alpha | |
0.00% |
0 / 13 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
depends_on | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
update_data | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
remove_underscore_from_alpha_validations | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
update_validation_rule | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * |
5 | * This file is part of the phpBB Forum Software package. |
6 | * |
7 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
8 | * @license GNU General Public License, version 2 (GPL-2.0) |
9 | * |
10 | * For full copyright and license information, please see |
11 | * the docs/CREDITS.txt file. |
12 | * |
13 | */ |
14 | |
15 | namespace phpbb\db\migration\data\v31x; |
16 | |
17 | class profilefield_remove_underscore_from_alpha extends \phpbb\db\migration\migration |
18 | { |
19 | public static function depends_on() |
20 | { |
21 | return array('\phpbb\db\migration\data\v31x\v311'); |
22 | } |
23 | |
24 | public function update_data() |
25 | { |
26 | return array( |
27 | array('custom', array(array($this, 'remove_underscore_from_alpha_validations'))), |
28 | ); |
29 | } |
30 | |
31 | public function remove_underscore_from_alpha_validations() |
32 | { |
33 | $this->update_validation_rule('[\w]+', '[a-zA-Z0-9]+'); |
34 | $this->update_validation_rule('[\w_]+', '[\w]+'); |
35 | $this->update_validation_rule('[\w.]+', '[a-zA-Z0-9.]+'); |
36 | $this->update_validation_rule('[\w\x20_+\-\[\]]+', '[\w\x20+\-\[\]]+'); |
37 | $this->update_validation_rule('[a-zA-Z][\w\.,\-_]+', '[a-zA-Z][\w\.,\-]+'); |
38 | } |
39 | |
40 | public function update_validation_rule($old_validation, $new_validation) |
41 | { |
42 | $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " |
43 | SET field_validation = '" . $this->db->sql_escape($new_validation) . "' |
44 | WHERE field_validation = '" . $this->db->sql_escape($old_validation) . "'"; |
45 | $this->db->sql_query($sql); |
46 | } |
47 | } |