MediaWiki REL1_33
MoveLogFormatter.php
Go to the documentation of this file.
1<?php
32 public function getPreloadTitles() {
33 $params = $this->extractParameters();
34
35 return [ Title::newFromText( $params[3] ) ];
36 }
37
38 protected function getMessageKey() {
39 $key = parent::getMessageKey();
40 $params = $this->extractParameters();
41 if ( isset( $params[4] ) && $params[4] === '1' ) {
42 // Messages: logentry-move-move-noredirect, logentry-move-move_redir-noredirect
43 $key .= '-noredirect';
44 }
45
46 return $key;
47 }
48
49 protected function getMessageParameters() {
50 $params = parent::getMessageParameters();
51 $oldname = $this->makePageLink( $this->entry->getTarget(), [ 'redirect' => 'no' ] );
52 $newname = $this->makePageLink( Title::newFromText( $params[3] ) );
53 $params[2] = Message::rawParam( $oldname );
54 $params[3] = Message::rawParam( $newname );
55 unset( $params[4] ); // handled in getMessageKey
56
57 return $params;
58 }
59
60 public function getActionLinks() {
61 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
62 || $this->entry->getSubtype() !== 'move'
63 || !$this->context->getUser()->isAllowed( 'move' )
64 ) {
65 return '';
66 }
67
68 $params = $this->extractParameters();
69 $destTitle = Title::newFromText( $params[3] );
70 if ( !$destTitle ) {
71 return '';
72 }
73
74 $revert = $this->getLinkRenderer()->makeKnownLink(
75 SpecialPage::getTitleFor( 'Movepage' ),
76 $this->msg( 'revertmove' )->text(),
77 [],
78 [
79 'wpOldTitle' => $destTitle->getPrefixedDBkey(),
80 'wpNewTitle' => $this->entry->getTarget()->getPrefixedDBkey(),
81 'wpReason' => $this->msg( 'revertmove' )->inContentLanguage()->text(),
82 'wpMovetalk' => 0
83 ]
84 );
85
86 return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
87 }
88
89 protected function getParametersForApi() {
92
93 static $map = [
94 '4:title:target',
95 '5:bool:suppressredirect',
96 '4::target' => '4:title:target',
97 '5::noredir' => '5:bool:suppressredirect',
98 ];
99 foreach ( $map as $index => $key ) {
100 if ( isset( $params[$index] ) ) {
101 $params[$key] = $params[$index];
102 unset( $params[$index] );
103 }
104 }
105
106 if ( !isset( $params['5:bool:suppressredirect'] ) ) {
107 $params['5:bool:suppressredirect'] = false;
108 }
109
110 return $params;
111 }
112
113}
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
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.
LogEntryBase $entry
msg( $key)
Shortcut for wfMessage which honors local context.
makePageLink(Title $title=null, $parameters=[], $html=null)
Helper to make a link to the page, taking the plaintext value in consideration.
extractParameters()
Extracts the optional extra parameters for use in action messages.
const DELETED_ACTION
Definition LogPage.php:34
This class formats move log entries.
getMessageKey()
Returns a key to be used for formatting the action sentence.
getMessageParameters()
Formats parameters intented for action message from array of all parameters.
getParametersForApi()
Get the array of parameters, converted from legacy format if necessary.
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
returning false will NOT prevent logging a wrapping ErrorException create2 Corresponds to logging log_action database field and which is displayed in the UI & $revert
Definition hooks.txt:2196
getParameters()
Get the extra parameters stored for this message.
$params