Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
UserMergeLogger
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 addMergeEntry
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
 addDeleteEntry
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3class UserMergeLogger implements IUserMergeLogger {
4
5    /**
6     * Adds a merge log entry
7     *
8     * @param User $performer
9     * @param User $oldUser
10     * @param User $newUser
11     */
12    public function addMergeEntry( User $performer, User $oldUser, User $newUser ) {
13        $logEntry = new ManualLogEntry( 'usermerge', 'mergeuser' );
14        $logEntry->setPerformer( $performer );
15        $logEntry->setTarget( $newUser->getUserPage() );
16        $logEntry->setParameters( [
17            'oldName' => $oldUser->getName(),
18            'oldId' => $oldUser->getId(),
19            'newName' => $newUser->getName(),
20            'newId' => $newUser->getId(),
21        ] );
22        $logEntry->setRelations( [ 'oldname' => $oldUser->getName() ] );
23        $logEntry->publish( $logEntry->insert() );
24    }
25
26    /**
27     * Adds a user deletion log entry
28     *
29     * @param User $performer
30     * @param User $oldUser
31     */
32    public function addDeleteEntry( User $performer, User $oldUser ) {
33        $logEntry = new ManualLogEntry( 'usermerge', 'deleteuser' );
34        $logEntry->setPerformer( $performer );
35        $logEntry->setTarget( $oldUser->getUserPage() );
36        $logEntry->setParameters( [
37            'oldName' => $oldUser->getName(),
38            'oldId' => $oldUser->getId(),
39        ] );
40        $logEntry->publish( $logEntry->insert() );
41    }
42}