release_1_0_0::update_data()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 35
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 23
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 35
rs 9.552
1
<?php
2
/**
3
*
4
* @package migration
5
* @copyright (c) 2014 phpBB Group
6
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
7
*
8
*/
9
10
namespace anavaro\pmsearch\migrations;
11
12
class release_1_0_0 extends \phpbb\db\migration\migration
0 ignored issues
show
Bug introduced by
The type phpbb\db\migration\migration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
{
14
	public function update_data()
15
	{
16
		return array(
17
			//Add extension ACP module
18
			array('module.add', array(
19
				'acp',
20
				'ACP_CAT_DOT_MODS',
21
				'ACP_PMSEARCH_GRP'
22
			)),
23
			array('module.add', array(
24
				'acp',
25
				'ACP_PMSEARCH_GRP',
26
				array(
27
					'module_basename'	=> '\anavaro\pmsearch\acp\acp_pmsearch_module',
28
					'module_mode'		=> array('main'),
29
					'module_auth'        => 'ext_anavaro/pmsearch && acl_a_user',
30
				)
31
			)),
32
			//Add extension UCP module
33
			array('module.add', array(
34
				'ucp',
35
				'UCP_PM',
36
				array(
37
					'module_basename'	=> '\anavaro\pmsearch\ucp\ucp_pmsearch_module',
38
					'module_modes' => array('search'),
39
					'module_auth'	=> 'ext_anavaro/pmsearch',
40
				),
41
42
			)),
43
			//set configs
44
			array('config.add', array('pmsearch_version', '1.0.0')),
45
			array('config.add', array('pmsearch_pm_index', true)),
46
			array('config.add', array('pmsearch_search', true)),
47
			//add permissions
48
			array('permission.add', array('u_pmsearch', true, 'u_readpm')),
49
		);
50
	}
51
52
	//lets create the needed table
53
	public function update_schema()
54
	{
55
		return array(
56
			'add_tables'    => array(
57
				$this->table_prefix . 'privmsgs_swl'	=> array(
58
					'COLUMNS'	=> array(
59
						'word_id'	=> array('UINT', null, 'auto_increment'),
60
						'word_text'	=> array('VCHAR_UNI', ''),
61
						'word_common'	=> array('BOOL', 0),
62
						'word_count'	=> array('UINT', 0),
63
					),
64
					'PRIMARY_KEY'	=> 'word_id',
65
					'KEYS'	=> array(
66
						'wrd_txt'	=> array('UNIQUE', 'word_text'),
67
						'wrd_cnt'	=> array('INDEX', 'word_count'),
68
					),
69
				),
70
				$this->table_prefix . 'privmsgs_swm'	=> array(
71
					'COLUMNS'	=> array(
72
						'post_id'	=> array('UINT', 0),
73
						'word_id'	=> array('UINT', 0),
74
						'title_match'	=> array('BOOL', 0),
75
					),
76
					'KEYS'	=> array(
77
						'unq_mtch'	=> array('UNIQUE', array('word_id', 'post_id', 'title_match')),
78
						'word_id'	=> array('INDEX', 'word_id'),
79
						'post_id'	=> array('INDEX', 'post_id')
80
					),
81
				),
82
			),
83
		);
84
	}
85
/*
86
	public function revert_schema()
87
	{
88
		return array(
89
			'drop_tables'		=> array(
90
				$this->table_prefix . 'privmsgs_swl',
91
				$this->table_prefix . 'privmsgs_swm',
92
			),
93
		);
94
	}
95
*/
96
}
97