MediaWiki REL1_33
RenameuserLogFormatter.php
Go to the documentation of this file.
1<?php
2
7
8 protected function getMessageParameters() {
9 $params = parent::getMessageParameters();
10 /* Current format:
11 * 1,2,3: normal logformatter params
12 * 4: old username (linked)
13 * (legaciest doesn't have this at all, all in comment)
14 * (legacier uses this as new name and stores old name in target)
15 * 5: new username (linked)
16 * 6: number of edits the user had at the time
17 * (not available except in newest log entries)
18 * 7: new username (raw format for GENDER)
19 * Note that the arrays are zero-indexed, while message parameters
20 * start from 1, so substract one to get array entries below.
21 */
22
23 if ( !isset( $params[3] ) ) {
24 // The oldest format
25 return $params;
26 } elseif ( !isset( $params[4] ) ) {
27 // See comments above
28 $params[4] = $params[3];
29 $params[3] = $this->entry->getTarget()->getText();
30 }
31
32 // Nice link to old user page
33 $title = Title::makeTitleSafe( NS_USER, $params[3] );
34 $link = $this->myPageLink( $title, $params[3],
35 [ 'redirect' => 'no' ] );
36 $params[3] = Message::rawParam( $link );
37
38 // Nice link to new user page
39 $title = Title::makeTitleSafe( NS_USER, $params[4] );
40 $link = $this->myPageLink( $title, $params[4] );
41 $params[4] = Message::rawParam( $link );
42 // GENDER support (using new user page)
43 $params[6] = $title->getText();
44
45 return $params;
46 }
47
55 protected function myPageLink( Title $title = null, $text, $query = [] ) {
56 if ( !$this->plaintext ) {
57 if ( !$title instanceof Title ) {
58 $link = htmlspecialchars( $text );
59 } else {
60 $link = $this->getLinkRenderer()->makeLink( $title, $text, [], $query );
61 }
62 } else {
63 if ( !$title instanceof Title ) {
64 $link = "[[User:$text]]";
65 } else {
66 $link = '[[' . $title->getPrefixedText() . ']]';
67 }
68 }
69
70 return $link;
71 }
72
73 public function getMessageKey() {
74 $key = parent::getMessageKey();
75 $params = $this->extractParameters();
76
77 // Very old log format, everything in comment
78 if ( !isset( $params[3] ) ) {
79 return "$key-legaciest";
80 } elseif ( !isset( $params[5] ) ) {
81 return "$key-legacier";
82 }
83
84 return $key;
85 }
86
87 public function getPreloadTitles() {
88 $params = $this->extractParameters();
89 if ( !isset( $params[3] ) ) {
90 // Very old log format, everything in comment - legaciest
91 return [];
92 }
93 if ( !isset( $params[4] ) ) {
94 // Old log format - legacier
95 $newUserName = $params[3];
96 } else {
97 $newUserName = $params[4];
98 }
99
100 $title = Title::makeTitleSafe( NS_USER, $newUserName );
101 if ( $title ) {
102 return [ $title ];
103 }
104
105 return [];
106 }
107}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Implements the default log formatting.
extractParameters()
Extracts the optional extra parameters for use in action messages.
LogFormatter for renameuser/renameuser logs.
getMessageKey()
Returns a key to be used for formatting the action sentence.
getMessageParameters()
Formats parameters intented for action message from array of all parameters.
myPageLink(Title $title=null, $text, $query=[])
Represents a title within MediaWiki.
Definition Title.php:40
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:955
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition hooks.txt:3069
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition hooks.txt:1617
$params