Wikia code/DONE/includes/LogEventsList.php
Appearance
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. The information shown below refers to the now unmaintained 1.16 MediaWiki release. The current stable release number is 1.42.3. |
Merged into core here: https://www.mediawiki.org/wiki/Special:Code/MediaWiki/97342
--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\LogEventsList.php 2011-07-18 22:31:28.147461000 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\LogEventsList.php 2011-08-17 15:28:46.510742200 +0100
@@ -273,6 +273,7 @@
public function logLine( $row ) {
global $wgLang, $wgUser, $wgContLang;
+ $row->user_name = $this->fixUserName($row->user_name, $row->log_user);
$title = Title::makeTitle( $row->log_namespace, $row->log_title );
$classes = array( "mw-logline-{$row->log_type}" );
$time = $wgLang->timeanddate( wfTimestamp( TS_MW, $row->log_timestamp ), true );
@@ -690,6 +691,13 @@
$s = str_replace( '$1', $s, $wrap );
}
+ /* Wikia change begin - @author: Macbre */
+ /* hook can return false, if we don't want the message to be emitted (BugId:7093) */
+ if (!wfRunHooks('LogEventsListShowLogExtract', array(&$s, $types, $page, $user, $param))) {
+ return $pager->getNumRows();
+ }
+ /* Wikia change end */
+
// $out can be either an OutputPage object or a String-by-reference
if( $out instanceof OutputPage ){
$out->addHTML( $s );
@@ -723,6 +731,23 @@
}
return false;
}
+
+ /**
+ * if user_name is empty - use User class to get his name
+ * @param $user_name string
+ * @param $user_id integer
+ * @return string
+ */
+ public function fixUserName($user_name, $user_id) {
+ if ( empty($user_name) ) {
+ $oUser = User::newFromID($user_id);
+ if ( $oUser instanceof User ) {
+ $user_name = $oUser->getName();
+ }
+ }
+
+ return $user_name;
+ }
}
/**
@@ -952,6 +977,10 @@
if( $this->getNumRows() > 0 ) {
$lb = new LinkBatch;
while( $row = $this->mResult->fetchObject() ) {
+ $row->user_name = $this->mLogEventsList->fixUserName($row->user_name, $row->log_user);
+ if ( empty($row->user_name) ) {
+ continue;
+ }
$lb->add( $row->log_namespace, $row->log_title );
$lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
$lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );