2012-01-20 09:44:39 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Contain classes to list log entries
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2004 Brion Vibber <brion@pobox.com>, 2008 Aaron Schulz
|
2014-03-13 22:23:56 +00:00
|
|
|
* https://www.mediawiki.org/
|
2012-01-20 09:44:39 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup Pager
|
|
|
|
|
*/
|
|
|
|
|
class LogPager extends ReverseChronologicalPager {
|
2013-12-03 18:26:59 +00:00
|
|
|
/** @var array Log types */
|
2016-02-17 09:09:32 +00:00
|
|
|
private $types = [];
|
2013-12-03 18:26:59 +00:00
|
|
|
|
|
|
|
|
/** @var string Events limited to those by performer when set */
|
2013-10-04 13:43:09 +00:00
|
|
|
private $performer = '';
|
2013-12-03 18:26:59 +00:00
|
|
|
|
|
|
|
|
/** @var string|Title Events limited to those about Title when set */
|
2013-10-04 13:43:09 +00:00
|
|
|
private $title = '';
|
2013-12-03 18:26:59 +00:00
|
|
|
|
|
|
|
|
/** @var string */
|
2013-10-04 13:43:09 +00:00
|
|
|
private $pattern = '';
|
2013-12-03 18:26:59 +00:00
|
|
|
|
|
|
|
|
/** @var string */
|
2012-01-20 09:44:39 +00:00
|
|
|
private $typeCGI = '';
|
2013-12-03 18:26:59 +00:00
|
|
|
|
2016-03-31 16:50:54 +00:00
|
|
|
/** @var string */
|
|
|
|
|
private $action = '';
|
|
|
|
|
|
2014-04-08 15:29:17 +00:00
|
|
|
/** @var LogEventsList */
|
2012-01-20 09:44:39 +00:00
|
|
|
public $mLogEventsList;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructor
|
|
|
|
|
*
|
2013-05-09 13:30:37 +00:00
|
|
|
* @param LogEventsList $list
|
2013-10-04 13:43:09 +00:00
|
|
|
* @param string|array $types Log types to show
|
2014-04-19 20:22:20 +00:00
|
|
|
* @param string $performer The user who made the log entries
|
|
|
|
|
* @param string|Title $title The page title the log entries are for
|
|
|
|
|
* @param string $pattern Do a prefix search rather than an exact title match
|
|
|
|
|
* @param array $conds Extra conditions for the query
|
2013-10-04 13:43:09 +00:00
|
|
|
* @param int|bool $year The year to start from. Default: false
|
|
|
|
|
* @param int|bool $month The month to start from. Default: false
|
2014-04-19 20:22:20 +00:00
|
|
|
* @param string $tagFilter Tag
|
2016-03-31 16:50:54 +00:00
|
|
|
* @param string $action Specific action (subtype) requested
|
2012-01-20 09:44:39 +00:00
|
|
|
*/
|
2016-03-31 16:50:54 +00:00
|
|
|
public function __construct( $list, $types = [], $performer = '', $title = '',
|
|
|
|
|
$pattern = '', $conds = [], $year = false, $month = false, $tagFilter = '',
|
|
|
|
|
$action = ''
|
|
|
|
|
) {
|
2012-01-20 09:44:39 +00:00
|
|
|
parent::__construct( $list->getContext() );
|
|
|
|
|
$this->mConds = $conds;
|
|
|
|
|
|
|
|
|
|
$this->mLogEventsList = $list;
|
|
|
|
|
|
|
|
|
|
$this->limitType( $types ); // also excludes hidden types
|
|
|
|
|
$this->limitPerformer( $performer );
|
|
|
|
|
$this->limitTitle( $title, $pattern );
|
2016-03-31 16:50:54 +00:00
|
|
|
$this->limitAction( $action );
|
2012-01-20 09:44:39 +00:00
|
|
|
$this->getDateCond( $year, $month );
|
|
|
|
|
$this->mTagFilter = $tagFilter;
|
2013-12-10 04:25:38 +00:00
|
|
|
|
|
|
|
|
$this->mDb = wfGetDB( DB_SLAVE, 'logpager' );
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDefaultQuery() {
|
|
|
|
|
$query = parent::getDefaultQuery();
|
|
|
|
|
$query['type'] = $this->typeCGI; // arrays won't work here
|
|
|
|
|
$query['user'] = $this->performer;
|
|
|
|
|
$query['month'] = $this->mMonth;
|
|
|
|
|
$query['year'] = $this->mYear;
|
2013-12-03 14:36:21 +00:00
|
|
|
|
2012-01-20 09:44:39 +00:00
|
|
|
return $query;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Call ONLY after calling $this->limitType() already!
|
|
|
|
|
public function getFilterParams() {
|
|
|
|
|
global $wgFilterLogTypes;
|
2016-02-17 09:09:32 +00:00
|
|
|
$filters = [];
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( count( $this->types ) ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
return $filters;
|
|
|
|
|
}
|
2013-04-20 15:38:24 +00:00
|
|
|
foreach ( $wgFilterLogTypes as $type => $default ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
// Avoid silly filtering
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( $type !== 'patrol' || $this->getUser()->useNPPatrol() ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
$hide = $this->getRequest()->getInt( "hide_{$type}_log", $default );
|
|
|
|
|
$filters[$type] = $hide;
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( $hide ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
$this->mConds[] = 'log_type != ' . $this->mDb->addQuotes( $type );
|
2013-04-20 15:38:24 +00:00
|
|
|
}
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-12-03 14:36:21 +00:00
|
|
|
|
2012-01-20 09:44:39 +00:00
|
|
|
return $filters;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the log reader to return only entries of the given type.
|
|
|
|
|
* Type restrictions enforced here
|
|
|
|
|
*
|
2013-12-03 18:26:59 +00:00
|
|
|
* @param string|array $types Log types ('upload', 'delete', etc);
|
2012-01-20 09:44:39 +00:00
|
|
|
* empty string means no restriction
|
|
|
|
|
*/
|
|
|
|
|
private function limitType( $types ) {
|
|
|
|
|
global $wgLogRestrictions;
|
2012-12-14 14:01:32 +00:00
|
|
|
|
|
|
|
|
$user = $this->getUser();
|
2012-01-20 09:44:39 +00:00
|
|
|
// If $types is not an array, make it an array
|
2016-02-17 09:09:32 +00:00
|
|
|
$types = ( $types === '' ) ? [] : (array)$types;
|
2012-01-20 09:44:39 +00:00
|
|
|
// Don't even show header for private logs; don't recognize it...
|
|
|
|
|
$needReindex = false;
|
|
|
|
|
foreach ( $types as $type ) {
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( isset( $wgLogRestrictions[$type] )
|
2012-12-14 14:01:32 +00:00
|
|
|
&& !$user->isAllowed( $wgLogRestrictions[$type] )
|
2012-01-20 09:44:39 +00:00
|
|
|
) {
|
|
|
|
|
$needReindex = true;
|
2016-02-17 09:09:32 +00:00
|
|
|
$types = array_diff( $types, [ $type ] );
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( $needReindex ) {
|
|
|
|
|
// Lots of this code makes assumptions that
|
|
|
|
|
// the first entry in the array is $types[0].
|
|
|
|
|
$types = array_values( $types );
|
|
|
|
|
}
|
|
|
|
|
$this->types = $types;
|
|
|
|
|
// Don't show private logs to unprivileged users.
|
|
|
|
|
// Also, only show them upon specific request to avoid suprises.
|
|
|
|
|
$audience = $types ? 'user' : 'public';
|
2012-12-14 14:01:32 +00:00
|
|
|
$hideLogs = LogEventsList::getExcludeClause( $this->mDb, $audience, $user );
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( $hideLogs !== false ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
$this->mConds[] = $hideLogs;
|
|
|
|
|
}
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( count( $types ) ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
$this->mConds['log_type'] = $types;
|
|
|
|
|
// Set typeCGI; used in url param for paging
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( count( $types ) == 1 ) {
|
|
|
|
|
$this->typeCGI = $types[0];
|
|
|
|
|
}
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the log reader to return only entries by the given user.
|
|
|
|
|
*
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param string $name (In)valid user name
|
2013-12-27 12:57:02 +00:00
|
|
|
* @return void
|
2012-01-20 09:44:39 +00:00
|
|
|
*/
|
|
|
|
|
private function limitPerformer( $name ) {
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( $name == '' ) {
|
2013-12-27 12:57:02 +00:00
|
|
|
return;
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
$usertitle = Title::makeTitleSafe( NS_USER, $name );
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( is_null( $usertitle ) ) {
|
2013-12-27 12:57:02 +00:00
|
|
|
return;
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
/* Fetch userid at first, if known, provides awesome query plan afterwards */
|
|
|
|
|
$userid = User::idFromName( $name );
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( !$userid ) {
|
2013-12-23 21:09:21 +00:00
|
|
|
$this->mConds['log_user_text'] = IP::sanitizeIP( $name );
|
2012-01-20 09:44:39 +00:00
|
|
|
} else {
|
|
|
|
|
$this->mConds['log_user'] = $userid;
|
|
|
|
|
}
|
2013-12-23 21:09:21 +00:00
|
|
|
// Paranoia: avoid brute force searches (bug 17342)
|
|
|
|
|
$user = $this->getUser();
|
|
|
|
|
if ( !$user->isAllowed( 'deletedhistory' ) ) {
|
|
|
|
|
$this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::DELETED_USER ) . ' = 0';
|
2014-06-12 22:18:51 +00:00
|
|
|
} elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
|
2013-12-23 21:09:21 +00:00
|
|
|
$this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::SUPPRESSED_USER ) .
|
|
|
|
|
' != ' . LogPage::SUPPRESSED_USER;
|
|
|
|
|
}
|
2013-12-27 12:57:02 +00:00
|
|
|
|
2013-12-23 21:09:21 +00:00
|
|
|
$this->performer = $usertitle->getText();
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the log reader to return only entries affecting the given page.
|
|
|
|
|
* (For the block and rights logs, this is a user page.)
|
|
|
|
|
*
|
2013-12-03 18:26:59 +00:00
|
|
|
* @param string|Title $page Title name
|
|
|
|
|
* @param string $pattern
|
2013-12-27 12:57:02 +00:00
|
|
|
* @return void
|
2012-01-20 09:44:39 +00:00
|
|
|
*/
|
|
|
|
|
private function limitTitle( $page, $pattern ) {
|
2015-04-30 17:48:52 +00:00
|
|
|
global $wgMiserMode, $wgUserrightsInterwikiDelimiter;
|
2012-01-20 09:44:39 +00:00
|
|
|
|
|
|
|
|
if ( $page instanceof Title ) {
|
|
|
|
|
$title = $page;
|
|
|
|
|
} else {
|
|
|
|
|
$title = Title::newFromText( $page );
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( strlen( $page ) == 0 || !$title instanceof Title ) {
|
2013-12-27 12:57:02 +00:00
|
|
|
return;
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->title = $title->getPrefixedText();
|
|
|
|
|
$ns = $title->getNamespace();
|
|
|
|
|
$db = $this->mDb;
|
|
|
|
|
|
2014-07-21 20:42:09 +00:00
|
|
|
$doUserRightsLogLike = false;
|
2016-02-17 09:09:32 +00:00
|
|
|
if ( $this->types == [ 'rights' ] ) {
|
2016-03-19 00:08:06 +00:00
|
|
|
$parts = explode( $wgUserrightsInterwikiDelimiter, $title->getDBkey() );
|
2013-02-12 19:33:23 +00:00
|
|
|
if ( count( $parts ) == 2 ) {
|
|
|
|
|
list( $name, $database ) = array_map( 'trim', $parts );
|
|
|
|
|
if ( strstr( $database, '*' ) ) { // Search for wildcard in database name
|
|
|
|
|
$doUserRightsLogLike = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-28 11:44:39 +00:00
|
|
|
/**
|
|
|
|
|
* Using the (log_namespace, log_title, log_timestamp) index with a
|
|
|
|
|
* range scan (LIKE) on the first two parts, instead of simple equality,
|
|
|
|
|
* makes it unusable for sorting. Sorted retrieval using another index
|
|
|
|
|
* would be possible, but then we might have to scan arbitrarily many
|
|
|
|
|
* nodes of that index. Therefore, we need to avoid this if $wgMiserMode
|
|
|
|
|
* is on.
|
|
|
|
|
*
|
|
|
|
|
* This is not a problem with simple title matches, because then we can
|
|
|
|
|
* use the page_time index. That should have no more than a few hundred
|
|
|
|
|
* log entries for even the busiest pages, so it can be safely scanned
|
|
|
|
|
* in full to satisfy an impossible condition on user or similar.
|
|
|
|
|
*/
|
2013-02-12 19:33:23 +00:00
|
|
|
$this->mConds['log_namespace'] = $ns;
|
|
|
|
|
if ( $doUserRightsLogLike ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$params = [ $name . $wgUserrightsInterwikiDelimiter ];
|
2013-02-12 19:33:23 +00:00
|
|
|
foreach ( explode( '*', $database ) as $databasepart ) {
|
|
|
|
|
$params[] = $databasepart;
|
|
|
|
|
$params[] = $db->anyString();
|
|
|
|
|
}
|
|
|
|
|
array_pop( $params ); // Get rid of the last % we added.
|
|
|
|
|
$this->mConds[] = 'log_title' . $db->buildLike( $params );
|
|
|
|
|
} elseif ( $pattern && !$wgMiserMode ) {
|
|
|
|
|
$this->mConds[] = 'log_title' . $db->buildLike( $title->getDBkey(), $db->anyString() );
|
2012-01-20 09:44:39 +00:00
|
|
|
$this->pattern = $pattern;
|
|
|
|
|
} else {
|
|
|
|
|
$this->mConds['log_title'] = $title->getDBkey();
|
|
|
|
|
}
|
|
|
|
|
// Paranoia: avoid brute force searches (bug 17342)
|
|
|
|
|
$user = $this->getUser();
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( !$user->isAllowed( 'deletedhistory' ) ) {
|
2013-04-27 12:02:08 +00:00
|
|
|
$this->mConds[] = $db->bitAnd( 'log_deleted', LogPage::DELETED_ACTION ) . ' = 0';
|
2015-06-11 12:59:33 +00:00
|
|
|
} elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
|
2013-04-27 12:02:08 +00:00
|
|
|
$this->mConds[] = $db->bitAnd( 'log_deleted', LogPage::SUPPRESSED_ACTION ) .
|
2012-01-20 09:44:39 +00:00
|
|
|
' != ' . LogPage::SUPPRESSED_ACTION;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-31 16:50:54 +00:00
|
|
|
/**
|
|
|
|
|
* Set the log_action field to a specified value (or values)
|
|
|
|
|
*
|
|
|
|
|
* @param string $action
|
|
|
|
|
*/
|
|
|
|
|
private function limitAction( $action ) {
|
|
|
|
|
global $wgActionFilteredLogs;
|
|
|
|
|
// Allow to filter the log by actions
|
|
|
|
|
$type = $this->typeCGI;
|
|
|
|
|
if ( $type === '' ) {
|
|
|
|
|
// nothing to do
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$actions = $wgActionFilteredLogs;
|
|
|
|
|
if ( isset( $actions[$type] ) ) {
|
|
|
|
|
// log type can be filtered by actions
|
|
|
|
|
$this->mLogEventsList->setAllowedActions( array_keys( $actions[$type] ) );
|
|
|
|
|
if ( $action !== '' && isset( $actions[$type][$action] ) ) {
|
|
|
|
|
// add condition to query
|
|
|
|
|
$this->mConds['log_action'] = $actions[$type][$action];
|
|
|
|
|
$this->action = $action;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-20 09:44:39 +00:00
|
|
|
/**
|
|
|
|
|
* Constructs the most part of the query. Extra conditions are sprinkled in
|
|
|
|
|
* all over this class.
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getQueryInfo() {
|
|
|
|
|
$basic = DatabaseLogEntry::getSelectQueryData();
|
|
|
|
|
|
|
|
|
|
$tables = $basic['tables'];
|
|
|
|
|
$fields = $basic['fields'];
|
|
|
|
|
$conds = $basic['conds'];
|
|
|
|
|
$options = $basic['options'];
|
|
|
|
|
$joins = $basic['join_conds'];
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$index = [];
|
2012-01-20 09:44:39 +00:00
|
|
|
# Add log_search table if there are conditions on it.
|
|
|
|
|
# This filters the results to only include log rows that have
|
|
|
|
|
# log_search records with the specified ls_field and ls_value values.
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( array_key_exists( 'ls_field', $this->mConds ) ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
$tables[] = 'log_search';
|
|
|
|
|
$index['log_search'] = 'ls_field_val';
|
|
|
|
|
$index['logging'] = 'PRIMARY';
|
|
|
|
|
if ( !$this->hasEqualsClause( 'ls_field' )
|
2013-12-01 20:39:00 +00:00
|
|
|
|| !$this->hasEqualsClause( 'ls_value' )
|
|
|
|
|
) {
|
2012-01-20 09:44:39 +00:00
|
|
|
# Since (ls_field,ls_value,ls_logid) is unique, if the condition is
|
|
|
|
|
# to match a specific (ls_field,ls_value) tuple, then there will be
|
|
|
|
|
# no duplicate log rows. Otherwise, we need to remove the duplicates.
|
|
|
|
|
$options[] = 'DISTINCT';
|
|
|
|
|
}
|
2013-09-19 19:51:16 +00:00
|
|
|
}
|
|
|
|
|
if ( count( $index ) ) {
|
|
|
|
|
$options['USE INDEX'] = $index;
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
# Don't show duplicate rows when using log_search
|
2016-02-17 09:09:32 +00:00
|
|
|
$joins['log_search'] = [ 'INNER JOIN', 'ls_log_id=log_id' ];
|
2012-01-20 09:44:39 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$info = [
|
2013-04-20 15:38:24 +00:00
|
|
|
'tables' => $tables,
|
|
|
|
|
'fields' => $fields,
|
|
|
|
|
'conds' => array_merge( $conds, $this->mConds ),
|
|
|
|
|
'options' => $options,
|
2012-01-20 09:44:39 +00:00
|
|
|
'join_conds' => $joins,
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2012-01-20 09:44:39 +00:00
|
|
|
# Add ChangeTags filter query
|
|
|
|
|
ChangeTags::modifyDisplayQuery( $info['tables'], $info['fields'], $info['conds'],
|
|
|
|
|
$info['join_conds'], $info['options'], $this->mTagFilter );
|
2013-12-03 14:36:21 +00:00
|
|
|
|
2012-01-20 09:44:39 +00:00
|
|
|
return $info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if $this->mConds has $field matched to a *single* value
|
2014-04-19 20:22:20 +00:00
|
|
|
* @param string $field
|
2012-01-20 09:44:39 +00:00
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
protected function hasEqualsClause( $field ) {
|
|
|
|
|
return (
|
|
|
|
|
array_key_exists( $field, $this->mConds ) &&
|
|
|
|
|
( !is_array( $this->mConds[$field] ) || count( $this->mConds[$field] ) == 1 )
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getIndexField() {
|
|
|
|
|
return 'log_timestamp';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getStartBody() {
|
|
|
|
|
# Do a link batch query
|
2013-04-20 15:38:24 +00:00
|
|
|
if ( $this->getNumRows() > 0 ) {
|
2012-01-20 09:44:39 +00:00
|
|
|
$lb = new LinkBatch;
|
|
|
|
|
foreach ( $this->mResult as $row ) {
|
|
|
|
|
$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 ) );
|
2012-01-20 16:57:46 +00:00
|
|
|
$formatter = LogFormatter::newFromRow( $row );
|
|
|
|
|
foreach ( $formatter->getPreloadTitles() as $title ) {
|
|
|
|
|
$lb->addObj( $title );
|
|
|
|
|
}
|
2012-01-20 09:44:39 +00:00
|
|
|
}
|
|
|
|
|
$lb->execute();
|
|
|
|
|
$this->mResult->seek( 0 );
|
|
|
|
|
}
|
2013-12-03 14:36:21 +00:00
|
|
|
|
2012-01-20 09:44:39 +00:00
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function formatRow( $row ) {
|
|
|
|
|
return $this->mLogEventsList->logLine( $row );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getType() {
|
|
|
|
|
return $this->types;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2016-04-09 23:49:52 +00:00
|
|
|
* Guaranteed to either return a valid title string or a Zero-Length String
|
|
|
|
|
*
|
2012-01-20 09:44:39 +00:00
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getPerformer() {
|
|
|
|
|
return $this->performer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getPage() {
|
|
|
|
|
return $this->title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getPattern() {
|
|
|
|
|
return $this->pattern;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getYear() {
|
|
|
|
|
return $this->mYear;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMonth() {
|
|
|
|
|
return $this->mMonth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getTagFilter() {
|
|
|
|
|
return $this->mTagFilter;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-31 16:50:54 +00:00
|
|
|
public function getAction() {
|
|
|
|
|
return $this->action;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-20 09:44:39 +00:00
|
|
|
public function doQuery() {
|
|
|
|
|
// Workaround MySQL optimizer bug
|
|
|
|
|
$this->mDb->setBigSelects();
|
|
|
|
|
parent::doQuery();
|
|
|
|
|
$this->mDb->setBigSelects( 'default' );
|
|
|
|
|
}
|
|
|
|
|
}
|