summaryrefslogtreecommitdiff
path: root/includes/logging/LogPage.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/logging/LogPage.php')
-rw-r--r--includes/logging/LogPage.php156
1 files changed, 21 insertions, 135 deletions
diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php
index ce5b972f..82e5808a 100644
--- a/includes/logging/LogPage.php
+++ b/includes/logging/LogPage.php
@@ -288,24 +288,8 @@ class LogPage {
$details = '';
array_unshift( $params, $titleLink );
- // User suppression
- if ( preg_match( '/^(block|suppress)\/(block|reblock)$/', $key ) ) {
- if ( $skin ) {
- // Localize the duration, and add a tooltip
- // in English to help visitors from other wikis.
- // The lrm is needed to make sure that the number
- // is shown on the correct side of the tooltip text.
- $durationTooltip = '‎' . htmlspecialchars( $params[1] );
- $params[1] = "<span class='blockExpiry' title='$durationTooltip'>" .
- $wgLang->translateBlockExpiry( $params[1] ) . '</span>';
- } else {
- $params[1] = $wgContLang->translateBlockExpiry( $params[1] );
- }
-
- $params[2] = isset( $params[2] ) ?
- self::formatBlockFlags( $params[2], $langObj ) : '';
// Page protections
- } elseif ( $type == 'protect' && count( $params ) == 3 ) {
+ if ( $type == 'protect' && count( $params ) == 3 ) {
// Restrictions and expiries
if ( $skin ) {
$details .= $wgLang->getDirMark() . htmlspecialchars( " {$params[1]}" );
@@ -370,69 +354,22 @@ class LogPage {
return $title->getPrefixedText();
}
- switch ( $type ) {
- case 'move':
- $titleLink = Linker::link(
- $title,
- htmlspecialchars( $title->getPrefixedText() ),
- array(),
- array( 'redirect' => 'no' )
- );
-
- $targetTitle = Title::newFromText( $params[0] );
-
- if ( !$targetTitle ) {
- # Workaround for broken database
- $params[0] = htmlspecialchars( $params[0] );
- } else {
- $params[0] = Linker::link(
- $targetTitle,
- htmlspecialchars( $params[0] )
- );
- }
- break;
- case 'block':
- if ( substr( $title->getText(), 0, 1 ) == '#' ) {
- $titleLink = $title->getText();
- } else {
- // @todo Store the user identifier in the parameters
- // to make this faster for future log entries
- $id = User::idFromName( $title->getText() );
- $titleLink = Linker::userLink( $id, $title->getText() )
- . 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() );
-
- # Use the language name for log titles, rather than Log/X
- if ( $name == 'Log' ) {
- $logPage = new LogPage( $par );
- $titleLink = Linker::link( $title, $logPage->getName()->escaped() );
- $titleLink = wfMessage( 'parentheses' )
- ->inLanguage( $lang )
- ->rawParams( $titleLink )
- ->escaped();
- } else {
- $titleLink = Linker::link( $title );
- }
- } else {
- $titleLink = Linker::link( $title );
- }
+ if ( $title->isSpecialPage() ) {
+ list( $name, $par ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
+
+ # Use the language name for log titles, rather than Log/X
+ if ( $name == 'Log' ) {
+ $logPage = new LogPage( $par );
+ $titleLink = Linker::link( $title, $logPage->getName()->escaped() );
+ $titleLink = wfMessage( 'parentheses' )
+ ->inLanguage( $lang )
+ ->rawParams( $titleLink )
+ ->escaped();
+ } else {
+ $titleLink = Linker::link( $title );
+ }
+ } else {
+ $titleLink = Linker::link( $title );
}
return $titleLink;
@@ -485,6 +422,10 @@ class LogPage {
$logEntry->setTarget( $target );
$logEntry->setPerformer( $doer );
$logEntry->setParameters( $params );
+ // All log entries using the LogPage to insert into the logging table
+ // are using the old logging system and therefore the legacy flag is
+ // needed to say the LogFormatter the parameters have numeric keys
+ $logEntry->setLegacy( true );
$formatter = LogFormatter::newFromEntry( $logEntry );
$context = RequestContext::newExtraneousContext( $target );
@@ -550,61 +491,6 @@ class LogPage {
}
/**
- * Convert a comma-delimited list of block log flags
- * into a more readable (and translated) form
- *
- * @param string $flags Flags to format
- * @param Language $lang
- * @return string
- */
- public static function formatBlockFlags( $flags, $lang ) {
- $flags = trim( $flags );
- if ( $flags === '' ) {
- return ''; //nothing to do
- }
- $flags = explode( ',', $flags );
- $flagsCount = count( $flags );
-
- for ( $i = 0; $i < $flagsCount; $i++ ) {
- $flags[$i] = self::formatBlockFlag( $flags[$i], $lang );
- }
-
- return wfMessage( 'parentheses' )->inLanguage( $lang )
- ->rawParams( $lang->commaList( $flags ) )->escaped();
- }
-
- /**
- * Translate a block log flag if possible
- *
- * @param int $flag Flag to translate
- * @param Language $lang Language object to use
- * @return string
- */
- public static function formatBlockFlag( $flag, $lang ) {
- static $messages = array();
-
- if ( !isset( $messages[$flag] ) ) {
- $messages[$flag] = htmlspecialchars( $flag ); // Fallback
-
- // For grepping. The following core messages can be used here:
- // * block-log-flags-angry-autoblock
- // * block-log-flags-anononly
- // * block-log-flags-hiddenname
- // * block-log-flags-noautoblock
- // * block-log-flags-nocreate
- // * block-log-flags-noemail
- // * block-log-flags-nousertalk
- $msg = wfMessage( 'block-log-flags-' . $flag )->inLanguage( $lang );
-
- if ( $msg->exists() ) {
- $messages[$flag] = $msg->escaped();
- }
- }
-
- return $messages[$flag];
- }
-
- /**
* Name of the log.
* @return Message
* @since 1.19