Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| UserMergeHookHandlers | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onUserMergeAccountFields | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of the CentralNotice Extension to MediaWiki |
| 5 | * https://www.mediawiki.org/wiki/Extension:CentralNotice |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | * http://www.gnu.org/copyleft/gpl.html |
| 21 | * |
| 22 | * @file |
| 23 | */ |
| 24 | |
| 25 | use MediaWiki\Config\Config; |
| 26 | use MediaWiki\Extension\UserMerge\Hooks\AccountFieldsHook; |
| 27 | |
| 28 | /** |
| 29 | * All hooks from the UserMerge extension which is optional to use with this extension. |
| 30 | * |
| 31 | * @ingroup Extensions |
| 32 | */ |
| 33 | class UserMergeHookHandlers implements AccountFieldsHook { |
| 34 | |
| 35 | public function __construct( |
| 36 | private readonly Config $config, |
| 37 | ) { |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Tell the UserMerge extension where we store user ids |
| 42 | * @param array[] &$updateFields |
| 43 | */ |
| 44 | public function onUserMergeAccountFields( array &$updateFields ): void { |
| 45 | if ( $this->config->get( 'NoticeInfrastructure' ) ) { |
| 46 | // array( tableName, idField, textField ) |
| 47 | $updateFields[] = [ 'cn_notice_log', 'notlog_user_id' ]; |
| 48 | $updateFields[] = [ 'cn_template_log', 'tmplog_user_id' ]; |
| 49 | } |
| 50 | } |
| 51 | } |