Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
profilefield_cleanup
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 6
56
0.00% covered (danger)
0.00%
0 / 1
 depends_on
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 effectively_installed
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
6
 update_schema
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 revert_schema
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 update_data
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 revert_data
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
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
14namespace phpbb\db\migration\data\v33x;
15
16class profilefield_cleanup extends \phpbb\db\migration\profilefield_base_migration
17{
18    protected $profilefield_name = 'phpbb_googleplus';
19    protected $profilefield_database_type = ['VCHAR', ''];
20    protected $profilefield_data = [
21        'field_name'            => 'phpbb_googleplus',
22        'field_type'            => 'profilefields.type.googleplus',
23        'field_ident'            => 'phpbb_googleplus',
24        'field_length'            => '20',
25        'field_minlen'            => '3',
26        'field_maxlen'            => '255',
27        'field_novalue'            => '',
28        'field_default_value'    => '',
29        'field_validation'        => '(?:(?!\.{2,})([^<>=+]))+',
30        'field_required'        => 0,
31        'field_show_novalue'    => 0,
32        'field_show_on_reg'        => 0,
33        'field_show_on_pm'        => 1,
34        'field_show_on_vt'        => 1,
35        'field_show_profile'    => 1,
36        'field_hide'            => 0,
37        'field_no_view'            => 0,
38        'field_active'            => 1,
39        'field_is_contact'        => 1,
40        'field_contact_desc'    => 'VIEW_GOOGLEPLUS_PROFILE',
41        'field_contact_url'        => 'http://plus.google.com/%s'
42    ];
43
44    public static function depends_on()
45    {
46        return ['\phpbb\db\migration\data\v330\v330'];
47    }
48
49    public function effectively_installed()
50    {
51        $sql = 'SELECT field_id
52            FROM ' . $this->table_prefix . 'profile_fields
53            WHERE ' . $this->db->sql_build_array('SELECT', ['field_name' => $this->profilefield_name]);
54        $result = $this->db->sql_query($sql);
55        $profile_field = (bool) $this->db->sql_fetchfield('field_id');
56        $this->db->sql_freeresult($result);
57
58        $profile_field_data = $this->db_tools->sql_column_exists($this->table_prefix . 'profile_fields_data', 'pf_' . $this->profilefield_name);
59
60        return (!$profile_field && !$profile_field_data);
61    }
62
63    public function update_schema()
64    {
65        return parent::revert_schema();
66    }
67
68    public function revert_schema()
69    {
70        return [];
71    }
72
73    public function update_data()
74    {
75        return parent::revert_data();
76    }
77
78    public function revert_data()
79    {
80        return [];
81    }
82}