[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\db\migration\data\v310; 15 16 class profilefield_field_validation_length extends \phpbb\db\migration\migration 17 { 18 protected $validation_options_old = array( 19 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+', 20 ); 21 22 protected $validation_options_new = array( 23 'ALPHA_SPACERS' => '[\w\x20_+\-\[\]]+', 24 ); 25 26 static public function depends_on() 27 { 28 return array( 29 '\phpbb\db\migration\data\v310\rc3', 30 ); 31 } 32 33 public function update_schema() 34 { 35 return array( 36 'change_columns' => array( 37 $this->table_prefix . 'profile_fields' => array( 38 'field_validation' => array('VCHAR_UNI:64', ''), 39 ), 40 ), 41 ); 42 } 43 44 public function revert_schema() 45 { 46 return array( 47 'change_columns' => array( 48 $this->table_prefix . 'profile_fields' => array( 49 'field_validation' => array('VCHAR_UNI:20', ''), 50 ), 51 ), 52 ); 53 } 54 55 public function update_data() 56 { 57 return array( 58 array('custom', array(array($this, 'update_profile_fields_validation'))), 59 ); 60 } 61 62 public function revert_data() 63 { 64 return array( 65 array('custom', array(array($this, 'revert_profile_fields_validation'))), 66 ); 67 } 68 69 public function update_profile_fields_validation() 70 { 71 foreach ($this->validation_options_new as $validation_type => $regex) 72 { 73 $sql = 'UPDATE ' . $this->table_prefix . "profile_fields 74 SET field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "' 75 WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "'"; 76 $this->sql_query($sql); 77 } 78 } 79 80 public function revert_profile_fields_validation() 81 { 82 foreach ($this->validation_options_new as $validation_type => $regex) 83 { 84 $sql = 'UPDATE ' . $this->table_prefix . "profile_fields 85 SET field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "' 86 WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "'"; 87 $this->sql_query($sql); 88 } 89 } 90 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |