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