r110953 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110952‎ | r110953 | r110954 >
Date:19:52, 8 February 2012
Author:aaron
Status:ok
Tags:core 
Comment:
Fixes for r96546 (bug 33167):
* Made LegacyLogFormatter try to respect the 'plaintext' parameter.
* Changed LogPage::addEntry() to use LogFormatter to get the action text as such calls to LogPage::actionText() are broken.
* Added comment to LogPage::actionText(). It's only OK to call this from the legacy log formatter, fetched via the proper factory functions.
* Converted CheckUser to using LogFormatter so that cuc_actiontext values work. Eventually, cuc_actiontext should be replaced with new cuc_params, cuc_log_type, and cuc_log_action fields, similar to the RC table.
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser.hooks.php (modified) (history)
  • /trunk/phase3/includes/logging/LogFormatter.php (modified) (history)
  • /trunk/phase3/includes/logging/LogPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/logging/LogPage.php
@@ -201,7 +201,8 @@
202202 }
203203
204204 /**
205 - * Generate text for a log entry
 205+ * Generate text for a log entry.
 206+ * Only LogFormatter should call this function.
206207 *
207208 * @param $type String: log type
208209 * @param $action String: log action
@@ -420,6 +421,7 @@
421422 * @param $doer User object: the user doing the action
422423 *
423424 * @return bool|int|null
 425+ * @TODO: make this use LogEntry::saveContent()
424426 */
425427 public function addEntry( $action, $target, $comment, $params = array(), $doer = null ) {
426428 global $wgContLang;
@@ -449,8 +451,17 @@
450452
451453 $this->doer = $doer;
452454
453 - $this->actionText = LogPage::actionText( $this->type, $action, $target, null, $params );
 455+ $logEntry = new ManualLogEntry( $this->type, $action );
 456+ $logEntry->setTarget( $target );
 457+ $logEntry->setPerformer( $doer );
 458+ $logEntry->setParameters( $params );
454459
 460+ $formatter = LogFormatter::newFromEntry( $logEntry );
 461+ $context = RequestContext::newExtraneousContext( $target );
 462+ $formatter->setContext( $context );
 463+
 464+ $this->actionText = $formatter->getPlainActionText();
 465+
455466 return $this->saveContent();
456467 }
457468
Index: trunk/phase3/includes/logging/LogFormatter.php
@@ -393,9 +393,9 @@
394394 $entry->getType(),
395395 $entry->getSubtype(),
396396 $entry->getTarget(),
397 - $this->context->getSkin(),
 397+ $this->plaintext ? null : $this->context->getSkin(),
398398 (array)$entry->getParameters(),
399 - true
 399+ !$this->plaintext // whether to filter [[]] links
400400 );
401401
402402 $performer = $this->getPerformerElement();
Index: trunk/extensions/CheckUser/CheckUser.hooks.php
@@ -22,9 +22,11 @@
2323 // If not, then $rc_comment is the actiontext and comment
2424 if ( isset( $rc_log_type ) && $rc_type == RC_LOG ) {
2525 $target = Title::makeTitle( $rc_namespace, $rc_title );
26 - $actionText = LogPage::actionText( $rc_log_type, $rc_log_action, $target,
27 - null, LogPage::extractParams( $rc_params )
28 - );
 26+ $context = RequestContext::newExtraneousContext( $target );
 27+
 28+ $formatter = LogFormatter::newFromRow( $rc->mAttribs );
 29+ $formatter->setContext( $context );
 30+ $actionText = $formatter->getPlainActionText();
2931 } else {
3032 $actionText = '';
3133 }

Sign-offs

UserFlagDate
Nikerabbitinspected21:41, 8 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96546Enabled MoveLogFormatter...nikerabbit09:09, 8 September 2011

Status & tagging log