'LogPage' => 'includes/logging/LogPage.php',
'LogPager' => 'includes/logging/LogPager.php',
'ManualLogEntry' => 'includes/logging/LogEntry.php',
+ 'MergeLogFormatter' => 'includes/logging/MergeLogFormatter.php',
'MoveLogFormatter' => 'includes/logging/MoveLogFormatter.php',
'NewUsersLogFormatter' => 'includes/logging/NewUsersLogFormatter.php',
'PageLangLogFormatter' => 'includes/logging/PageLangLogFormatter.php',
'protect/move_prot' => 'movedarticleprotection',
'import/upload' => 'import-logentry-upload',
'import/interwiki' => 'import-logentry-interwiki',
- 'merge/merge' => 'pagemerge-logentry',
'suppress/block' => 'blocklogentry',
'suppress/reblock' => 'reblock-logentry',
);
'upload/upload' => 'LogFormatter',
'upload/overwrite' => 'LogFormatter',
'upload/revert' => 'LogFormatter',
+ 'merge/merge' => 'MergeLogFormatter',
);
/**
$params['img_timestamp'] = wfTimestamp( TS_ISO_8601, $params['img_timestamp'] );
}
break;
+ case 'merge':
+ // replace the named parameter with numbered for backward compatibility
+ if ( isset( $params['4::dest'] ) ) {
+ $params[] = $params['4::dest'];
+ unset( $params['4::dest'] );
+ }
+ if ( isset( $params['5::mergepoint'] ) ) {
+ $params[] = $params['5::mergepoint'];
+ unset( $params['5::mergepoint'] );
+ }
+ break;
}
if ( !is_null( $params ) ) {
$logParams = array();
break;
}
break;
+
+ case 'merge':
+ $text = wfMessage( 'pagemerge-logentry' )
+ ->rawParams( $target, $parameters['4::dest'], $parameters['5::mergepoint'] )
+ ->inContentLanguage()->escaped();
+ break;
// case 'suppress' --private log -- aaron (so we know who to blame in a few years :-D)
// default:
}
return $this->msg( 'parentheses' )->rawParams(
$this->context->getLanguage()->pipeList( $links ) )->escaped();
- // Show unmerge link
- } elseif ( $type == 'merge' && $subtype == 'merge' ) {
- if ( !$this->context->getUser()->isAllowed( 'mergehistory' ) ) {
- return '';
- }
-
- $params = $this->extractParameters();
- $revert = Linker::linkKnown(
- SpecialPage::getTitleFor( 'MergeHistory' ),
- $this->msg( 'revertmerge' )->escaped(),
- array(),
- array(
- 'target' => $params[3],
- 'dest' => $title->getPrefixedDBkey(),
- 'mergepoint' => $params[4],
- 'submitted' => 1 // show the revisions immediately
- )
- );
-
- return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
}
// Do nothing. The implementation is handled by the hook modifiying the
. Linker::userToolLinks( $id, $title->getText(), false, Linker::TOOL_LINKS_NOBLOCK );
}
break;
- case 'merge':
- $titleLink = Linker::link(
- $title,
- $title->getPrefixedText(),
- array(),
- array( 'redirect' => 'no' )
- );
- $params[0] = Linker::link(
- Title::newFromText( $params[0] ),
- htmlspecialchars( $params[0] )
- );
- $params[1] = $lang->timeanddate( $params[1] );
- break;
default:
if ( $title->isSpecialPage() ) {
list( $name, $par ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
--- /dev/null
+<?php
+/**
+ * Formatter for merge log entries.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ * @since 1.24
+ */
+
+/**
+ * This class formats merge log entries.
+ *
+ * @since 1.24
+ */
+class MergeLogFormatter extends LogFormatter {
+ public function getPreloadTitles() {
+ $params = $this->extractParameters();
+
+ return array( Title::newFromText( $params[3] ) );
+ }
+
+ protected function getMessageParameters() {
+ $params = parent::getMessageParameters();
+ $oldname = $this->makePageLink( $this->entry->getTarget(), array( 'redirect' => 'no' ) );
+ $newname = $this->makePageLink( Title::newFromText( $params[3] ) );
+ $params[2] = Message::rawParam( $oldname );
+ $params[3] = Message::rawParam( $newname );
+ $params[4] = $this->context->getLanguage()->timeanddate( $params[4] );
+ return $params;
+ }
+
+ public function getActionLinks() {
+ if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
+ || !$this->context->getUser()->isAllowed( 'mergehistory' )
+ ) {
+ return '';
+ }
+
+ // Show unmerge link
+ $params = $this->extractParameters();
+ $revert = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'MergeHistory' ),
+ $this->msg( 'revertmerge' )->escaped(),
+ array(),
+ array(
+ 'target' => $params[3],
+ 'dest' => $this->entry->getTarget()->getPrefixedDBkey(),
+ 'mergepoint' => $params[4],
+ 'submitted' => 1 // show the revisions immediately
+ )
+ );
+
+ return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
+ }
+}
return false;
}
# Update our logs
- $log = new LogPage( 'merge' );
- $log->addEntry(
- 'merge', $targetTitle, $this->mComment,
- array( $destTitle->getPrefixedText(), $timestampLimit ), $this->getUser()
- );
+ $logEntry = new ManualLogEntry( 'merge', 'merge' );
+ $logEntry->setPerformer( $this->getUser() );
+ $logEntry->setComment( $this->mComment );
+ $logEntry->setTarget( $targetTitle );
+ $logEntry->setParameters( array(
+ '4::dest' => $destTitle->getPrefixedText(),
+ '5::mergepoint' => $timestampLimit
+ ) );
+ $logId = $logEntry->insert();
+ $logEntry->publish( $logId );
# @todo message should use redirect=no
$this->getOutput()->addWikiText( $this->msg( 'mergehistory-success',
"revdelete-uname-unhid": "username unhidden",
"revdelete-restricted": "applied restrictions to administrators",
"revdelete-unrestricted": "removed restrictions for administrators",
+ "logentry-merge-merge": "$1 {{GENDER:$2|merged}} $3 into $4 (revisions up to $5)",
"logentry-move-move": "$1 {{GENDER:$2|moved}} page $3 to $4",
"logentry-move-move-noredirect": "$1 {{GENDER:$2|moved}} page $3 to $4 without leaving a redirect",
"logentry-move-move_redir": "$1 {{GENDER:$2|moved}} page $3 to $4 over redirect",
"mergehistory-reason": "{{Identical|Reason}}",
"mergehistory-revisionrow": "{{Optional}}\nA revision row in the merge history page. Parameters:\n* $1 - a radio button to indicate a merge point\n* $2 - a link to the last revision of a page ({{msg-mw|Last}})\n* $3 - a page link\n* $4 - a user link\n* $5 - a revision size\n* $6 - a revision comment",
"mergelog": "{{doc-logpage}}\n\nThis is the name of a log of merge actions done on [[Special:MergeHistory]]. This special page and this log is not enabled by default.",
- "pagemerge-logentry": "This log message is used in a merge log entry.\n\nParameters:\n* $1 - the page name of the source of the content to be merged\n* $2 - the page into which the content is merged\n* $3 - a timestamp of limit\n\nThe log and its associated special page 'MergeHistory' is not enabled by default.\n\nPlease note that the parameters in a log entry will appear in the log only in the default language of the wiki. View [[Special:Log]] for examples on translatewiki.net with English default language.",
+ "pagemerge-logentry": "{{ignored}}This is ''logentry'' message only used on IRC.\n\nParameters:\n* $1 - the page name of the source of the content to be merged\n* $2 - the page into which the content is merged\n* $3 - a timestamp of limit\n\nThe log and its associated special page 'MergeHistory' is not enabled by default.\n\nPlease note that the parameters in a log entry will appear in the log only in the default language of the wiki. View [[Special:Log]] for examples on translatewiki.net with English default language.",
"revertmerge": "Used as link text",
"mergelogpagetext": "Description of the [{{canonicalurl:Special:Log|type=merge&user=&page=&year=&month=-1}} merge log], on the log. The associated [[Special:MergeHistory|Merge]] special page is not enabled by default.",
"history-title": "Displayed as page title when you click on the \"history\" tab. Parameters:\n* $1 - the normal page title",
"revdelete-uname-unhid": "Used on\n* {{msg-mw|logentry-delete-event}}\n* {{msg-mw|logentry-delete-revision}}\n* {{msg-mw|logentry-suppress-event}}\n* {{msg-mw|logentry-suppress-event}}",
"revdelete-restricted": "Used as <code>$4</code> in the following messages when setting visibility restrictions for administrators:\n* {{msg-mw|Logentry-delete-event}}\n* {{msg-mw|Logentry-delete-revision}}\n* {{msg-mw|Logentry-suppress-event}}\n* {{msg-mw|Logentry-suppress-event}}",
"revdelete-unrestricted": "Used as <code>$4</code> in the following messages when setting visibility restrictions for administrators:\n* {{msg-mw|Logentry-delete-event}}\n* {{msg-mw|Logentry-delete-revision}}\n* {{msg-mw|Logentry-suppress-event}}\n* {{msg-mw|Logentry-suppress-event}}",
+ "logentry-merge-merge": "{{Logentry|[[Special:Log/merge]]}}\n* $4 - the page into which the content is merged\n* $5 - a timestamp of limit\n\nThe log and its associated special page 'MergeHistory' is not enabled by default.\n\nPlease note that the parameters in a log entry will appear in the log only in the default language of the wiki. View [[Special:Log]] for examples on translatewiki.net with English default language.",
"logentry-move-move": "{{Logentry|[[Special:Log/move]]}}\nParameter $4, the target page, is also not visible to parser functions.",
"logentry-move-move-noredirect": "{{Logentry|[[Special:Log/move]]}}\nParameter $4, the target page, is also not visible to parser functions.",
"logentry-move-move_redir": "{{Logentry|[[Special:Log/move]]}}\nParameter $4, the target page, is also not visible to parser functions.",
* - protect/modifyprotect
* - protect/unprotect
* - upload/upload
+ * - merge/merge
*
* As well as the following Auto Edit Summaries:
* - blank
);
}
+ /**
+ * @covers LogFormatter::getIRCActionText
+ */
+ public function testIrcMsgForLogTypeMerge() {
+ $sep = $this->context->msg( 'colon-separator' )->text();
+
+ # merge/merge
+ $this->assertIRCComment(
+ $this->context->msg( 'pagemerge-logentry', 'SomeTitle', 'Dest', 'timestamp' )->plain()
+ . $sep . $this->user_comment,
+ 'merge', 'merge',
+ array(
+ '4::dest' => 'Dest',
+ '5::mergepoint' => 'timestamp',
+ ),
+ $this->user_comment
+ );
+ }
+
/**
* @todo Emulate these edits somehow and extract
* raw edit summary from RecentChange object