Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| UserMergeHooks | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| onUserMergeAccountFields | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\WikiLove; |
| 4 | |
| 5 | use MediaWiki\Config\Config; |
| 6 | use MediaWiki\Extension\UserMerge\Hooks\AccountFieldsHook; |
| 7 | use Wikimedia\Rdbms\ILoadBalancer; |
| 8 | |
| 9 | /** |
| 10 | * All hooks from the UserMerge extension which is optional to use with this extension. |
| 11 | * |
| 12 | * @ingroup Extensions |
| 13 | */ |
| 14 | class UserMergeHooks implements AccountFieldsHook { |
| 15 | public function __construct( |
| 16 | private readonly Config $config, |
| 17 | private readonly ILoadBalancer $loadBalancer, |
| 18 | ) { |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Tables that Extension:UserMerge needs to update |
| 23 | */ |
| 24 | public function onUserMergeAccountFields( array &$updateFields ): void { |
| 25 | $dbr = $this->loadBalancer->getMaintenanceConnectionRef( DB_REPLICA ); |
| 26 | // FIXME HACK: The extension never actually required the 'wikilove_log' table |
| 27 | // and would suppress db errors if it didn't exist |
| 28 | if ( |
| 29 | $this->config->get( 'WikiLoveLogging' ) && |
| 30 | $dbr->tableExists( 'wikilove_log', __METHOD__ ) |
| 31 | ) { |
| 32 | $updateFields[] = [ 'wikilove_log', 'wll_sender' ]; |
| 33 | $updateFields[] = [ 'wikilove_log', 'wll_receiver' ]; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | } |