Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 47 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
auth_provider_oauth | |
0.00% |
0 / 47 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
effectively_installed | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
depends_on | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
update_schema | |
0.00% |
0 / 27 |
|
0.00% |
0 / 1 |
2 | |||
revert_schema | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
update_data | |
0.00% |
0 / 12 |
|
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 | |
14 | namespace phpbb\db\migration\data\v310; |
15 | |
16 | class auth_provider_oauth extends \phpbb\db\migration\migration |
17 | { |
18 | public function effectively_installed() |
19 | { |
20 | return $this->db_tools->sql_table_exists($this->table_prefix . 'oauth_tokens'); |
21 | } |
22 | |
23 | public static function depends_on() |
24 | { |
25 | return array('\phpbb\db\migration\data\v30x\release_3_0_0'); |
26 | } |
27 | |
28 | public function update_schema() |
29 | { |
30 | return array( |
31 | 'add_tables' => array( |
32 | $this->table_prefix . 'oauth_tokens' => array( |
33 | 'COLUMNS' => array( |
34 | 'user_id' => array('UINT', 0), // phpbb_users.user_id |
35 | 'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set |
36 | 'provider' => array('VCHAR', ''), // Name of the OAuth provider |
37 | 'oauth_token' => array('MTEXT', ''), // Serialized token |
38 | ), |
39 | 'KEYS' => array( |
40 | 'user_id' => array('INDEX', 'user_id'), |
41 | 'provider' => array('INDEX', 'provider'), |
42 | ), |
43 | ), |
44 | $this->table_prefix . 'oauth_accounts' => array( |
45 | 'COLUMNS' => array( |
46 | 'user_id' => array('UINT', 0), |
47 | 'provider' => array('VCHAR', ''), |
48 | 'oauth_provider_id' => array('TEXT_UNI', ''), |
49 | ), |
50 | 'PRIMARY_KEY' => array( |
51 | 'user_id', |
52 | 'provider', |
53 | ), |
54 | ), |
55 | ), |
56 | ); |
57 | } |
58 | |
59 | public function revert_schema() |
60 | { |
61 | return array( |
62 | 'drop_tables' => array( |
63 | $this->table_prefix . 'oauth_tokens', |
64 | $this->table_prefix . 'oauth_accounts', |
65 | ), |
66 | ); |
67 | } |
68 | |
69 | public function update_data() |
70 | { |
71 | return array( |
72 | array('module.add', array( |
73 | 'ucp', |
74 | 'UCP_PROFILE', |
75 | array( |
76 | 'module_basename' => 'ucp_auth_link', |
77 | 'module_langname' => 'UCP_AUTH_LINK_MANAGE', |
78 | 'module_mode' => 'auth_link', |
79 | 'module_auth' => 'authmethod_oauth', |
80 | ), |
81 | )), |
82 | ); |
83 | } |
84 | } |