Merge "Translate password reset e-mail subject into proper language"
[mediawiki.git] / includes / logging / ProtectLogFormatter.php
blob5327e072433f06bff1f882acbf7073fcb8ad7068
1 <?php
2 /**
3 * Formatter for protect log entries.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
22 * @since 1.26
25 /**
26 * This class formats protect log entries.
28 * @since 1.26
30 class ProtectLogFormatter extends LogFormatter {
31 public function getPreloadTitles() {
32 $subtype = $this->entry->getSubtype();
33 if ( $subtype === 'move_prot' ) {
34 $params = $this->extractParameters();
35 return array( Title::newFromText( $params[3] ) );
37 return array();
40 protected function getMessageParameters() {
41 $params = parent::getMessageParameters();
43 $subtype = $this->entry->getSubtype();
44 if ( $subtype === 'move_prot' ) {
45 $oldname = $this->makePageLink( Title::newFromText( $params[3] ), array( 'redirect' => 'no' ) );
46 $params[3] = Message::rawParam( $oldname );
49 return $params;
52 protected function getParametersForApi() {
53 $entry = $this->entry;
54 $params = $entry->getParameters();
56 static $map = array(
57 // param keys for move_prot sub type
58 '4:title:oldtitle',
59 '4::oldtitle' => '4:title:oldtitle',
61 foreach ( $map as $index => $key ) {
62 if ( isset( $params[$index] ) ) {
63 $params[$key] = $params[$index];
64 unset( $params[$index] );
68 return $params;