Exemplo n.º 1
0
 /**
  * Process the query
  *
  * @param array $conds
  * @param FormOptions $opts
  * @return bool|ResultWrapper Result or false
  */
 public function doMainQuery($conds, $opts)
 {
     $tables = ['recentchanges'];
     $fields = RecentChange::selectFields();
     $query_options = [];
     $join_conds = [];
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $query_options, '');
     if (!$this->runMainQueryHook($tables, $fields, $conds, $query_options, $join_conds, $opts)) {
         return false;
     }
     $dbr = $this->getDB();
     return $dbr->select($tables, $fields, $conds, __METHOD__, $query_options, $join_conds);
 }
Exemplo n.º 2
0
 /**
  * Process the query
  *
  * @param array $conds
  * @param FormOptions $opts
  * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
  */
 public function doMainQuery($conds, $opts)
 {
     $dbr = $this->getDB();
     $user = $this->getUser();
     # Toggle watchlist content (all recent edits or just the latest)
     if ($opts['extended']) {
         $limitWatchlist = $user->getIntOption('wllimit');
         $usePage = false;
     } else {
         # Top log Ids for a page are not stored
         $nonRevisionTypes = array(RC_LOG);
         Hooks::run('SpecialWatchlistGetNonRevisionTypes', array(&$nonRevisionTypes));
         if ($nonRevisionTypes) {
             $conds[] = $dbr->makeList(array('rc_this_oldid=page_latest', 'rc_type' => $nonRevisionTypes), LIST_OR);
         }
         $limitWatchlist = 0;
         $usePage = true;
     }
     $tables = array('recentchanges', 'watchlist');
     $fields = RecentChange::selectFields();
     $query_options = array('ORDER BY' => 'rc_timestamp DESC');
     $join_conds = array('watchlist' => array('INNER JOIN', array('wl_user' => $user->getId(), 'wl_namespace=rc_namespace', 'wl_title=rc_title')));
     if ($this->getConfig()->get('ShowUpdatedMarker')) {
         $fields[] = 'wl_notificationtimestamp';
     }
     if ($limitWatchlist) {
         $query_options['LIMIT'] = $limitWatchlist;
     }
     $rollbacker = $user->isAllowed('rollback');
     if ($usePage || $rollbacker) {
         $tables[] = 'page';
         $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
         if ($rollbacker) {
             $fields[] = 'page_latest';
         }
     }
     // Log entries with DELETED_ACTION must not show up unless the user has
     // the necessary rights.
     if (!$user->isAllowed('deletedhistory')) {
         $bitmask = LogPage::DELETED_ACTION;
     } elseif (!$user->isAllowedAny('suppressrevision', 'viewsuppressed')) {
         $bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
     } else {
         $bitmask = 0;
     }
     if ($bitmask) {
         $conds[] = $dbr->makeList(array('rc_type != ' . RC_LOG, $dbr->bitAnd('rc_deleted', $bitmask) . " != {$bitmask}"), LIST_OR);
     }
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $query_options, '');
     $this->runMainQueryHook($tables, $fields, $conds, $query_options, $join_conds, $opts);
     return $dbr->select($tables, $fields, $conds, __METHOD__, $query_options, $join_conds);
 }
Exemplo n.º 3
0
 /**
  * Process the query
  *
  * @param array $conds
  * @param FormOptions $opts
  * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
  */
 public function doMainQuery($conds, $opts)
 {
     $tables = array('recentchanges');
     $join_conds = array();
     $query_options = array('USE INDEX' => array('recentchanges' => 'rc_timestamp'));
     $uid = $this->getUser()->getId();
     $dbr = wfGetDB(DB_SLAVE);
     $limit = $opts['limit'];
     $namespace = $opts['namespace'];
     $invert = $opts['invert'];
     $associated = $opts['associated'];
     $fields = RecentChange::selectFields();
     // JOIN on watchlist for users
     if ($uid) {
         $tables[] = 'watchlist';
         $fields[] = 'wl_user';
         $fields[] = 'wl_notificationtimestamp';
         $join_conds['watchlist'] = array('LEFT JOIN', array('wl_user' => $uid, 'wl_title=rc_title', 'wl_namespace=rc_namespace'));
     }
     if ($this->getUser()->isAllowed('rollback')) {
         $tables[] = 'page';
         $fields[] = 'page_latest';
         $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
     }
     // Tag stuff.
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $query_options, $opts['tagfilter']);
     if (!wfRunHooks('SpecialRecentChangesQuery', array(&$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields))) {
         return false;
     }
     // Don't use the new_namespace_time timestamp index if:
     // (a) "All namespaces" selected
     // (b) We want pages in more than one namespace (inverted/associated)
     // (c) There is a tag to filter on (use tag index instead)
     // (d) UNION + sort/limit is not an option for the DBMS
     if ($namespace === '' || ($invert || $associated) || $opts['tagfilter'] != '' || !$dbr->unionSupportsOrderAndLimit()) {
         $res = $dbr->select($tables, $fields, $conds, __METHOD__, array('ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit) + $query_options, $join_conds);
     } else {
         // We have a new_namespace_time index! UNION over new=(0,1) and sort result set!
         // New pages
         $sqlNew = $dbr->selectSQLText($tables, $fields, array('rc_new' => 1) + $conds, __METHOD__, array('ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, 'USE INDEX' => array('recentchanges' => 'new_name_timestamp')), $join_conds);
         // Old pages
         $sqlOld = $dbr->selectSQLText($tables, $fields, array('rc_new' => 0) + $conds, __METHOD__, array('ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit, 'USE INDEX' => array('recentchanges' => 'new_name_timestamp')), $join_conds);
         # Join the two fast queries, and sort the result set
         $sql = $dbr->unionQueries(array($sqlNew, $sqlOld), false) . ' ORDER BY rc_timestamp DESC';
         $sql = $dbr->limitResult($sql, $limit, false);
         $res = $dbr->query($sql, __METHOD__);
     }
     return $res;
 }
Exemplo n.º 4
0
 /**
  * Process the query
  *
  * @param array $conds
  * @param FormOptions $opts
  * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
  */
 public function doMainQuery($conds, $opts)
 {
     $dbr = $this->getDB();
     $user = $this->getUser();
     $tables = array('recentchanges');
     $fields = RecentChange::selectFields();
     $query_options = array();
     $join_conds = array();
     // JOIN on watchlist for users
     if ($user->getId() && $user->isAllowed('viewmywatchlist')) {
         $tables[] = 'watchlist';
         $fields[] = 'wl_user';
         $fields[] = 'wl_notificationtimestamp';
         $join_conds['watchlist'] = array('LEFT JOIN', array('wl_user' => $user->getId(), 'wl_title=rc_title', 'wl_namespace=rc_namespace'));
     }
     if ($user->isAllowed('rollback')) {
         $tables[] = 'page';
         $fields[] = 'page_latest';
         $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
     }
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $query_options, $opts['tagfilter']);
     if (!$this->runMainQueryHook($tables, $fields, $conds, $query_options, $join_conds, $opts)) {
         return false;
     }
     // array_merge() is used intentionally here so that hooks can, should
     // they so desire, override the ORDER BY / LIMIT condition(s); prior to
     // MediaWiki 1.26 this used to use the plus operator instead, which meant
     // that extensions weren't able to change these conditions
     $query_options = array_merge(array('ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $opts['limit']), $query_options);
     $rows = $dbr->select($tables, $fields, $conds + array('rc_new' => array(0, 1)), __METHOD__, $query_options, $join_conds);
     // Build the final data
     if ($this->getConfig()->get('AllowCategorizedRecentChanges')) {
         $this->filterByCategories($rows, $opts);
     }
     return $rows;
 }
 /**
  * Process the query
  *
  * @param array $conds
  * @param FormOptions $opts
  * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
  */
 public function doMainQuery($conds, $opts)
 {
     global $wgAllowCategorizedRecentChanges;
     $dbr = $this->getDB();
     $user = $this->getUser();
     $tables = array('recentchanges');
     $fields = RecentChange::selectFields();
     $query_options = array();
     $join_conds = array();
     // JOIN on watchlist for users
     if ($user->getId() && $user->isAllowed('viewmywatchlist')) {
         $tables[] = 'watchlist';
         $fields[] = 'wl_user';
         $fields[] = 'wl_notificationtimestamp';
         $join_conds['watchlist'] = array('LEFT JOIN', array('wl_user' => $user->getId(), 'wl_title=rc_title', 'wl_namespace=rc_namespace'));
     }
     if ($user->isAllowed('rollback')) {
         $tables[] = 'page';
         $fields[] = 'page_latest';
         $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
     }
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $query_options, $opts['tagfilter']);
     if (!wfRunHooks('SpecialRecentChangesQuery', array(&$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields), '1.23')) {
         return false;
     }
     // rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
     // knowledge to use an index merge if it wants (it may use some other index though).
     $rows = $dbr->select($tables, $fields, $conds + array('rc_new' => array(0, 1)), __METHOD__, array('ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $opts['limit']) + $query_options, $join_conds);
     // Build the final data
     if ($wgAllowCategorizedRecentChanges) {
         $this->filterByCategories($rows, $opts);
     }
     return $rows;
 }
 public function doMainQuery($conds, $opts)
 {
     $target = $opts['target'];
     $showlinkedto = $opts['showlinkedto'];
     $limit = $opts['limit'];
     if ($target === '') {
         return false;
     }
     $outputPage = $this->getOutput();
     $title = Title::newFromURL($target);
     if (!$title || $title->isExternal()) {
         $outputPage->addHtml('<div class="errorbox">' . $this->msg('allpagesbadtitle')->parse() . '</div>');
         return false;
     }
     $outputPage->setPageTitle($this->msg('recentchangeslinked-title', $title->getPrefixedText()));
     /*
      * Ordinary links are in the pagelinks table, while transclusions are
      * in the templatelinks table, categorizations in categorylinks and
      * image use in imagelinks.  We need to somehow combine all these.
      * Special:Whatlinkshere does this by firing multiple queries and
      * merging the results, but the code we inherit from our parent class
      * expects only one result set so we use UNION instead.
      */
     $dbr = wfGetDB(DB_SLAVE, 'recentchangeslinked');
     $id = $title->getArticleID();
     $ns = $title->getNamespace();
     $dbkey = $title->getDBkey();
     $tables = array('recentchanges');
     $select = RecentChange::selectFields();
     $join_conds = array();
     $query_options = array();
     // left join with watchlist table to highlight watched rows
     $uid = $this->getUser()->getId();
     if ($uid && $this->getUser()->isAllowed('viewmywatchlist')) {
         $tables[] = 'watchlist';
         $select[] = 'wl_user';
         $join_conds['watchlist'] = array('LEFT JOIN', array('wl_user' => $uid, 'wl_title=rc_title', 'wl_namespace=rc_namespace'));
     }
     if ($this->getUser()->isAllowed('rollback')) {
         $tables[] = 'page';
         $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
         $select[] = 'page_latest';
     }
     ChangeTags::modifyDisplayQuery($tables, $select, $conds, $join_conds, $query_options, $opts['tagfilter']);
     if (!wfRunHooks('SpecialRecentChangesQuery', array(&$conds, &$tables, &$join_conds, $opts, &$query_options, &$select), '1.23')) {
         return false;
     }
     if ($ns == NS_CATEGORY && !$showlinkedto) {
         // special handling for categories
         // XXX: should try to make this less kludgy
         $link_tables = array('categorylinks');
         $showlinkedto = true;
     } else {
         // for now, always join on these tables; really should be configurable as in whatlinkshere
         $link_tables = array('pagelinks', 'templatelinks');
         // imagelinks only contains links to pages in NS_FILE
         if ($ns == NS_FILE || !$showlinkedto) {
             $link_tables[] = 'imagelinks';
         }
     }
     if ($id == 0 && !$showlinkedto) {
         return false;
         // nonexistent pages can't link to any pages
     }
     // field name prefixes for all the various tables we might want to join with
     $prefix = array('pagelinks' => 'pl', 'templatelinks' => 'tl', 'categorylinks' => 'cl', 'imagelinks' => 'il');
     $subsql = array();
     // SELECT statements to combine with UNION
     foreach ($link_tables as $link_table) {
         $pfx = $prefix[$link_table];
         // imagelinks and categorylinks tables have no xx_namespace field,
         // and have xx_to instead of xx_title
         if ($link_table == 'imagelinks') {
             $link_ns = NS_FILE;
         } elseif ($link_table == 'categorylinks') {
             $link_ns = NS_CATEGORY;
         } else {
             $link_ns = 0;
         }
         if ($showlinkedto) {
             // find changes to pages linking to this page
             if ($link_ns) {
                 if ($ns != $link_ns) {
                     continue;
                 }
                 // should never happen, but check anyway
                 $subconds = array("{$pfx}_to" => $dbkey);
             } else {
                 $subconds = array("{$pfx}_namespace" => $ns, "{$pfx}_title" => $dbkey);
             }
             $subjoin = "rc_cur_id = {$pfx}_from";
         } else {
             // find changes to pages linked from this page
             $subconds = array("{$pfx}_from" => $id);
             if ($link_table == 'imagelinks' || $link_table == 'categorylinks') {
                 $subconds["rc_namespace"] = $link_ns;
                 $subjoin = "rc_title = {$pfx}_to";
             } else {
                 $subjoin = array("rc_namespace = {$pfx}_namespace", "rc_title = {$pfx}_title");
             }
         }
         if ($dbr->unionSupportsOrderAndLimit()) {
             $order = array('ORDER BY' => 'rc_timestamp DESC');
         } else {
             $order = array();
         }
         $query = $dbr->selectSQLText(array_merge($tables, array($link_table)), $select, $conds + $subconds, __METHOD__, $order + $query_options, $join_conds + array($link_table => array('INNER JOIN', $subjoin)));
         if ($dbr->unionSupportsOrderAndLimit()) {
             $query = $dbr->limitResult($query, $limit);
         }
         $subsql[] = $query;
     }
     if (count($subsql) == 0) {
         return false;
         // should never happen
     }
     if (count($subsql) == 1 && $dbr->unionSupportsOrderAndLimit()) {
         $sql = $subsql[0];
     } else {
         // need to resort and relimit after union
         $sql = $dbr->unionQueries($subsql, false) . ' ORDER BY rc_timestamp DESC';
         $sql = $dbr->limitResult($sql, $limit, false);
     }
     $res = $dbr->query($sql, __METHOD__);
     if ($res->numRows() == 0) {
         $this->mResultEmpty = true;
     }
     return $res;
 }
Exemplo n.º 7
0
	/**
	 * Execute
	 * @param $par Parameter passed to the page
	 */
	function execute( $par ) {
		global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;

		$user = $this->getUser();
		$output = $this->getOutput();

		# Anons don't get a watchlist
		if ( $user->isAnon() ) {
			$output->setPageTitle( $this->msg( 'watchnologin' ) );
			$output->setRobotPolicy( 'noindex,nofollow' );
			$llink = Linker::linkKnown(
				SpecialPage::getTitleFor( 'Userlogin' ),
				$this->msg( 'loginreqlink' )->escaped(),
				array(),
				array( 'returnto' => $this->getTitle()->getPrefixedText() )
			);
			$output->addHTML( $this->msg( 'watchlistanontext' )->rawParams( $llink )->parse() );
			return;
		}

		// Check permissions
		$this->checkPermissions();

		// Add feed links
		$wlToken = $user->getTokenFromOption( 'watchlisttoken' );
		if ( $wlToken ) {
			$this->addFeedLinks( array( 'action' => 'feedwatchlist', 'allrev' => 'allrev',
								'wlowner' => $user->getName(), 'wltoken' => $wlToken ) );
		}

		$this->setHeaders();
		$this->outputHeader();

		$output->addSubtitle( $this->msg( 'watchlistfor2', $user->getName()
			)->rawParams( SpecialEditWatchlist::buildTools( null ) ) );

		$request = $this->getRequest();

		$mode = SpecialEditWatchlist::getMode( $request, $par );
		if ( $mode !== false ) {
			# TODO: localise?
			switch ( $mode ) {
				case SpecialEditWatchlist::EDIT_CLEAR:
					$mode = 'clear';
					break;
				case SpecialEditWatchlist::EDIT_RAW:
					$mode = 'raw';
					break;
				default:
					$mode = null;
			}
			$title = SpecialPage::getTitleFor( 'EditWatchlist', $mode );
			$output->redirect( $title->getLocalURL() );
			return;
		}

		$dbr = wfGetDB( DB_SLAVE, 'watchlist' );

		$nitems = $this->countItems( $dbr );
		if ( $nitems == 0 ) {
			$output->addWikiMsg( 'nowatchlist' );
			return;
		}

		// @todo use FormOptions!
		$defaults = array(
		/* float */ 'days' => floatval( $user->getOption( 'watchlistdays' ) ),
		/* bool  */ 'hideMinor' => (int)$user->getBoolOption( 'watchlisthideminor' ),
		/* bool  */ 'hideBots' => (int)$user->getBoolOption( 'watchlisthidebots' ),
		/* bool  */ 'hideAnons' => (int)$user->getBoolOption( 'watchlisthideanons' ),
		/* bool  */ 'hideLiu' => (int)$user->getBoolOption( 'watchlisthideliu' ),
		/* bool  */ 'hidePatrolled' => (int)$user->getBoolOption( 'watchlisthidepatrolled' ),
		/* bool  */ 'hideOwn' => (int)$user->getBoolOption( 'watchlisthideown' ),
		/* bool  */ 'extended' => (int)$user->getBoolOption( 'extendwatchlist' ),
		/* ?     */ 'namespace' => '', //means all
		/* ?     */ 'invert' => false,
		/* bool  */ 'associated' => false,
		);
		$this->customFilters = array();
		wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) );
		foreach ( $this->customFilters as $key => $params ) {
			$defaults[$key] = $params['default'];
		}

		# Extract variables from the request, falling back to user preferences or
		# other default values if these don't exist
		$values = array();
		$values['days'] = floatval( $request->getVal( 'days', $defaults['days'] ) );
		$values['hideMinor'] = (int)$request->getBool( 'hideMinor', $defaults['hideMinor'] );
		$values['hideBots'] = (int)$request->getBool( 'hideBots', $defaults['hideBots'] );
		$values['hideAnons'] = (int)$request->getBool( 'hideAnons', $defaults['hideAnons'] );
		$values['hideLiu'] = (int)$request->getBool( 'hideLiu', $defaults['hideLiu'] );
		$values['hideOwn'] = (int)$request->getBool( 'hideOwn', $defaults['hideOwn'] );
		$values['hidePatrolled'] = (int)$request->getBool( 'hidePatrolled', $defaults['hidePatrolled'] );
		$values['extended'] = (int)$request->getBool( 'extended', $defaults['extended'] );
		foreach ( $this->customFilters as $key => $params ) {
			$values[$key] = (int)$request->getBool( $key, $defaults[$key] );
		}

		# Get namespace value, if supplied, and prepare a WHERE fragment
		$nameSpace = $request->getIntOrNull( 'namespace' );
		$invert = $request->getBool( 'invert' );
		$associated = $request->getBool( 'associated' );
		if ( !is_null( $nameSpace ) ) {
			$eq_op = $invert ? '!=' : '=';
			$bool_op = $invert ? 'AND' : 'OR';
			$nameSpace = intval( $nameSpace ); // paranioa
			if ( !$associated ) {
				$nameSpaceClause = "rc_namespace $eq_op $nameSpace";
			} else {
				$associatedNS = MWNamespace::getAssociated( $nameSpace );
				$nameSpaceClause =
					"rc_namespace $eq_op $nameSpace " .
					$bool_op .
					" rc_namespace $eq_op $associatedNS";
			}
		} else {
			$nameSpace = '';
			$nameSpaceClause = '';
		}
		$values['namespace'] = $nameSpace;
		$values['invert'] = $invert;
		$values['associated'] = $associated;

		// Dump everything here
		$nondefaults = array();
		foreach ( $defaults as $name => $defValue ) {
			wfAppendToArrayIfNotDefault( $name, $values[$name], $defaults, $nondefaults );
		}

		if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
			$request->wasPosted() )
		{
			$user->clearAllNotifications();
			$output->redirect( $this->getTitle()->getFullURL( $nondefaults ) );
			return;
		}

		# Possible where conditions
		$conds = array();

		if ( $values['days'] > 0 ) {
			$conds[] = 'rc_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( time() - intval( $values['days'] * 86400 ) ) );
		}

		# Toggles
		if ( $values['hideOwn'] ) {
			$conds[] = 'rc_user != ' . $user->getId();
		}
		if ( $values['hideBots'] ) {
			$conds[] = 'rc_bot = 0';
		}
		if ( $values['hideMinor'] ) {
			$conds[] = 'rc_minor = 0';
		}
		if ( $values['hideLiu'] ) {
			$conds[] = 'rc_user = 0';
		}
		if ( $values['hideAnons'] ) {
			$conds[] = 'rc_user != 0';
		}
		if ( $user->useRCPatrol() && $values['hidePatrolled'] ) {
			$conds[] = 'rc_patrolled != 1';
		}
		if ( $nameSpaceClause ) {
			$conds[] = $nameSpaceClause;
		}

		# Toggle watchlist content (all recent edits or just the latest)
		if ( $values['extended'] ) {
			$limitWatchlist = $user->getIntOption( 'wllimit' );
			$usePage = false;
		} else {
			# Top log Ids for a page are not stored
			$nonRevisionTypes = array( RC_LOG );
			wfRunHooks( 'SpecialWatchlistGetNonRevisionTypes', array( &$nonRevisionTypes ) );
			if ( $nonRevisionTypes ) {
				if ( count( $nonRevisionTypes ) === 1 ) {
					// if only one use an equality instead of IN condition
					$nonRevisionTypes = reset( $nonRevisionTypes );
				}
				$conds[] = $dbr->makeList(
					array(
						'rc_this_oldid=page_latest',
						'rc_type' => $nonRevisionTypes,
					),
					LIST_OR
				);
			}
			$limitWatchlist = 0;
			$usePage = true;
		}

		# Show a message about slave lag, if applicable
		$lag = wfGetLB()->safeGetLag( $dbr );
		if ( $lag > 0 ) {
			$output->showLagWarning( $lag );
		}

		# Create output
		$form = '';

		# Show watchlist header
		$form .= "<p>";
		$form .= $this->msg( 'watchlist-details' )->numParams( $nitems )->parse() . "\n";
		if ( $wgEnotifWatchlist && $user->getOption( 'enotifwatchlistpages' ) ) {
			$form .= $this->msg( 'wlheader-enotif' )->parse() . "\n";
		}
		if ( $wgShowUpdatedMarker ) {
			$form .= $this->msg( 'wlheader-showupdated' )->parse() . "\n";
		}
		$form .= "</p>";

		if ( $wgShowUpdatedMarker ) {
			$form .= Xml::openElement( 'form', array( 'method' => 'post',
				'action' => $this->getTitle()->getLocalURL(),
				'id' => 'mw-watchlist-resetbutton' ) ) . "\n" .
			Xml::submitButton( $this->msg( 'enotif_reset' )->text(), array( 'name' => 'dummy' ) ) . "\n" .
			Html::hidden( 'reset', 'all' ) . "\n";
			foreach ( $nondefaults as $key => $value ) {
				$form .= Html::hidden( $key, $value ) . "\n";
			}
			$form .= Xml::closeElement( 'form' ) . "\n";
		}

		$form .= Xml::openElement( 'form', array(
			'method' => 'post',
			'action' => $this->getTitle()->getLocalURL(),
			'id' => 'mw-watchlist-form'
		) );
		$form .= Xml::fieldset(
			$this->msg( 'watchlist-options' )->text(),
			false,
			array( 'id' => 'mw-watchlist-options' )
		);

		$tables = array( 'recentchanges', 'watchlist' );
		$fields = RecentChange::selectFields();
		$join_conds = array(
			'watchlist' => array(
				'INNER JOIN',
				array(
					'wl_user' => $user->getId(),
					'wl_namespace=rc_namespace',
					'wl_title=rc_title'
				),
			),
		);
		$options = array( 'ORDER BY' => 'rc_timestamp DESC' );
		if ( $wgShowUpdatedMarker ) {
			$fields[] = 'wl_notificationtimestamp';
		}
		if ( $limitWatchlist ) {
			$options['LIMIT'] = $limitWatchlist;
		}

		$rollbacker = $user->isAllowed( 'rollback' );
		if ( $usePage || $rollbacker ) {
			$tables[] = 'page';
			$join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
			if ( $rollbacker ) {
				$fields[] = 'page_latest';
			}
		}

		// Log entries with DELETED_ACTION must not show up unless the user has
		// the necessary rights.
		if ( !$user->isAllowed( 'deletedhistory' ) ) {
			$bitmask = LogPage::DELETED_ACTION;
		} elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
			$bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
		} else {
			$bitmask = 0;
		}
		if ( $bitmask ) {
			$conds[] = $dbr->makeList( array(
				'rc_type != ' . RC_LOG,
				$dbr->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
			), LIST_OR );
		}

		ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
		wfRunHooks( 'SpecialWatchlistQuery', array( &$conds, &$tables, &$join_conds, &$fields, $values ) );

		$res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
		$numRows = $res->numRows();

		/* Start bottom header */

		$lang = $this->getLanguage();
		$wlInfo = '';
		if ( $values['days'] > 0 ) {
			$timestamp = wfTimestampNow();
			$wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $values['days'] * 24 ) )->params(
				$lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user ) )->parse() . "<br />\n";
		}

		$cutofflinks = $this->cutoffLinks( $values['days'], $nondefaults ) . "<br />\n";

		# Spit out some control panel links
		$filters = array(
			'hideMinor' => 'rcshowhideminor',
			'hideBots' => 'rcshowhidebots',
			'hideAnons' => 'rcshowhideanons',
			'hideLiu' => 'rcshowhideliu',
			'hideOwn' => 'rcshowhidemine',
			'hidePatrolled' => 'rcshowhidepatr'
		);
		foreach ( $this->customFilters as $key => $params ) {
			$filters[$key] = $params['msg'];
		}
		// Disable some if needed
		if ( !$user->useNPPatrol() ) {
			unset( $filters['hidePatrolled'] );
		}

		$links = array();
		foreach ( $filters as $name => $msg ) {
			$links[] = $this->showHideLink( $nondefaults, $msg, $name, $values[$name] );
		}

		$hiddenFields = $nondefaults;
		unset( $hiddenFields['namespace'] );
		unset( $hiddenFields['invert'] );
		unset( $hiddenFields['associated'] );

		# Namespace filter and put the whole form together.
		$form .= $wlInfo;
		$form .= $cutofflinks;
		$form .= $lang->pipeList( $links ) . "\n";
		$form .= "<hr />\n<p>";
		$form .= Html::namespaceSelector(
			array(
				'selected' => $nameSpace,
				'all' => '',
				'label' => $this->msg( 'namespace' )->text()
			), array(
				'name' => 'namespace',
				'id' => 'namespace',
				'class' => 'namespaceselector',
			)
		) . '&#160;';
		$form .= Xml::checkLabel(
			$this->msg( 'invert' )->text(),
			'invert',
			'nsinvert',
			$invert,
			array( 'title' => $this->msg( 'tooltip-invert' )->text() )
		) . '&#160;';
		$form .= Xml::checkLabel(
			$this->msg( 'namespace_association' )->text(),
			'associated',
			'associated',
			$associated,
			array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
		) . '&#160;';
		$form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "</p>\n";
		foreach ( $hiddenFields as $key => $value ) {
			$form .= Html::hidden( $key, $value ) . "\n";
		}
		$form .= Xml::closeElement( 'fieldset' ) . "\n";
		$form .= Xml::closeElement( 'form' ) . "\n";
		$output->addHTML( $form );

		# If there's nothing to show, stop here
		if ( $numRows == 0 ) {
			$output->wrapWikiMsg(
				"<div class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
			);
			return;
		}

		/* End bottom header */

		/* Do link batch query */
		$linkBatch = new LinkBatch;
		foreach ( $res as $row ) {
			$userNameUnderscored = str_replace( ' ', '_', $row->rc_user_text );
			if ( $row->rc_user != 0 ) {
				$linkBatch->add( NS_USER, $userNameUnderscored );
			}
			$linkBatch->add( NS_USER_TALK, $userNameUnderscored );

			$linkBatch->add( $row->rc_namespace, $row->rc_title );
		}
		$linkBatch->execute();
		$dbr->dataSeek( $res, 0 );

		$list = ChangesList::newFromContext( $this->getContext() );
		$list->setWatchlistDivs();

		$s = $list->beginRecentChangesList();
		$counter = 1;
		foreach ( $res as $obj ) {
			# Make RC entry
			$rc = RecentChange::newFromRow( $obj );
			$rc->counter = $counter++;

			if ( $wgShowUpdatedMarker ) {
				$updated = $obj->wl_notificationtimestamp;
			} else {
				$updated = false;
			}

			if ( $wgRCShowWatchingUsers && $user->getOption( 'shownumberswatching' ) ) {
				$rc->numberofWatchingusers = $dbr->selectField( 'watchlist',
					'COUNT(*)',
					array(
						'wl_namespace' => $obj->rc_namespace,
						'wl_title' => $obj->rc_title,
					),
					__METHOD__ );
			} else {
				$rc->numberofWatchingusers = 0;
			}

			$changeLine = $list->recentChangesLine( $rc, $updated, $counter );
			if ( $changeLine !== false ) {
				$s .= $changeLine;
			}
		}
		$s .= $list->endRecentChangesList();

		$output->addHTML( $s );
	}
Exemplo n.º 8
0
	/**
	 * Process the query
	 *
	 * @param array $conds
	 * @param FormOptions $opts
	 * @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
	 */
	public function doMainQuery( $conds, $opts ) {
		$tables = array( 'recentchanges' );
		$join_conds = array();
		$query_options = array(
			'USE INDEX' => array( 'recentchanges' => 'rc_timestamp' )
		);

		$uid = $this->getUser()->getId();
		$dbr = wfGetDB( DB_SLAVE );
		$limit = $opts['limit'];
		$namespace = $opts['namespace'];
		$invert = $opts['invert'];
		$associated = $opts['associated'];

		$fields = RecentChange::selectFields();
		// JOIN on watchlist for users
		if ( $uid && $this->getUser()->isAllowed( 'viewmywatchlist' ) ) {
			$tables[] = 'watchlist';
			$fields[] = 'wl_user';
			$fields[] = 'wl_notificationtimestamp';
			$join_conds['watchlist'] = array( 'LEFT JOIN', array(
				'wl_user' => $uid,
				'wl_title=rc_title',
				'wl_namespace=rc_namespace'
			) );
		}
		if ( $this->getUser()->isAllowed( 'rollback' ) ) {
			$tables[] = 'page';
			$fields[] = 'page_latest';
			$join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
		}
		// Tag stuff.
		ChangeTags::modifyDisplayQuery(
			$tables,
			$fields,
			$conds,
			$join_conds,
			$query_options,
			$opts['tagfilter']
		);

		if ( !wfRunHooks( 'SpecialRecentChangesQuery',
			array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ) )
		) {
			return false;
		}

		// rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
		// knowledge to use an index merge if it wants (it may use some other index though).
		return $dbr->select(
			$tables,
			$fields,
			$conds + array( 'rc_new' => array( 0, 1 ) ),
			__METHOD__,
			array( 'ORDER BY' => 'rc_timestamp DESC', 'LIMIT' => $limit ) + $query_options,
			$join_conds
		);
	}
 /**
  * Execute
  * @param $par Parameter passed to the page
  */
 function execute($par)
 {
     global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;
     $user = $this->getUser();
     $output = $this->getOutput();
     # Anons don't get a watchlist
     if ($user->isAnon()) {
         $output->setPageTitle($this->msg('watchnologin'));
         $output->setRobotPolicy('noindex,nofollow');
         $llink = Linker::linkKnown(SpecialPage::getTitleFor('Userlogin'), $this->msg('loginreqlink')->escaped(), array(), array('returnto' => $this->getTitle()->getPrefixedText()));
         $output->addHTML($this->msg('watchlistanontext')->rawParams($llink)->parse());
         return;
     }
     // Add feed links
     $wlToken = $user->getOption('watchlisttoken');
     if (!$wlToken) {
         $wlToken = MWCryptRand::generateHex(40);
         $user->setOption('watchlisttoken', $wlToken);
         $user->saveSettings();
     }
     $this->addFeedLinks(array('action' => 'feedwatchlist', 'allrev' => 'allrev', 'wlowner' => $user->getName(), 'wltoken' => $wlToken));
     $this->setHeaders();
     $this->outputHeader();
     $output->addSubtitle($this->msg('watchlistfor2', $user->getName())->rawParams(SpecialEditWatchlist::buildTools(null)));
     $request = $this->getRequest();
     $mode = SpecialEditWatchlist::getMode($request, $par);
     if ($mode !== false) {
         # TODO: localise?
         switch ($mode) {
             case SpecialEditWatchlist::EDIT_CLEAR:
                 $mode = 'clear';
                 break;
             case SpecialEditWatchlist::EDIT_RAW:
                 $mode = 'raw';
                 break;
             default:
                 $mode = null;
         }
         $title = SpecialPage::getTitleFor('EditWatchlist', $mode);
         $output->redirect($title->getLocalUrl());
         return;
     }
     $nitems = $this->countItems();
     if ($nitems == 0) {
         $output->addWikiMsg('nowatchlist');
         return;
     }
     // @TODO: use FormOptions!
     $defaults = array('days' => floatval($user->getOption('watchlistdays')), 'hideMinor' => (int) $user->getBoolOption('watchlisthideminor'), 'hideBots' => (int) $user->getBoolOption('watchlisthidebots'), 'hideAnons' => (int) $user->getBoolOption('watchlisthideanons'), 'hideLiu' => (int) $user->getBoolOption('watchlisthideliu'), 'hidePatrolled' => (int) $user->getBoolOption('watchlisthidepatrolled'), 'hideOwn' => (int) $user->getBoolOption('watchlisthideown'), 'namespace' => 'all', 'invert' => false, 'associated' => false);
     $this->customFilters = array();
     wfRunHooks('SpecialWatchlistFilters', array($this, &$this->customFilters));
     foreach ($this->customFilters as $key => $params) {
         $defaults[$key] = $params['msg'];
     }
     # Extract variables from the request, falling back to user preferences or
     # other default values if these don't exist
     $prefs['days'] = floatval($user->getOption('watchlistdays'));
     $prefs['hideminor'] = $user->getBoolOption('watchlisthideminor');
     $prefs['hidebots'] = $user->getBoolOption('watchlisthidebots');
     $prefs['hideanons'] = $user->getBoolOption('watchlisthideanons');
     $prefs['hideliu'] = $user->getBoolOption('watchlisthideliu');
     $prefs['hideown'] = $user->getBoolOption('watchlisthideown');
     $prefs['hidepatrolled'] = $user->getBoolOption('watchlisthidepatrolled');
     # Get query variables
     $values = array();
     $values['days'] = $request->getVal('days', $prefs['days']);
     $values['hideMinor'] = (int) $request->getBool('hideMinor', $prefs['hideminor']);
     $values['hideBots'] = (int) $request->getBool('hideBots', $prefs['hidebots']);
     $values['hideAnons'] = (int) $request->getBool('hideAnons', $prefs['hideanons']);
     $values['hideLiu'] = (int) $request->getBool('hideLiu', $prefs['hideliu']);
     $values['hideOwn'] = (int) $request->getBool('hideOwn', $prefs['hideown']);
     $values['hidePatrolled'] = (int) $request->getBool('hidePatrolled', $prefs['hidepatrolled']);
     foreach ($this->customFilters as $key => $params) {
         $values[$key] = (int) $request->getBool($key);
     }
     # Get namespace value, if supplied, and prepare a WHERE fragment
     $nameSpace = $request->getIntOrNull('namespace');
     $invert = $request->getBool('invert');
     $associated = $request->getBool('associated');
     if (!is_null($nameSpace)) {
         $eq_op = $invert ? '!=' : '=';
         $bool_op = $invert ? 'AND' : 'OR';
         $nameSpace = intval($nameSpace);
         // paranioa
         if (!$associated) {
             $nameSpaceClause = "rc_namespace {$eq_op} {$nameSpace}";
         } else {
             $associatedNS = MWNamespace::getAssociated($nameSpace);
             $nameSpaceClause = "rc_namespace {$eq_op} {$nameSpace} " . $bool_op . " rc_namespace {$eq_op} {$associatedNS}";
         }
     } else {
         $nameSpace = '';
         $nameSpaceClause = '';
     }
     $values['namespace'] = $nameSpace;
     $values['invert'] = $invert;
     $values['associated'] = $associated;
     if (is_null($values['days']) || !is_numeric($values['days'])) {
         $big = 1000;
         /* The magical big */
         if ($nitems > $big) {
             # Set default cutoff shorter
             $values['days'] = $defaults['days'] = 12.0 / 24.0;
             # 12 hours...
         } else {
             $values['days'] = $defaults['days'];
             # default cutoff for shortlisters
         }
     } else {
         $values['days'] = floatval($values['days']);
     }
     // Dump everything here
     $nondefaults = array();
     foreach ($defaults as $name => $defValue) {
         wfAppendToArrayIfNotDefault($name, $values[$name], $defaults, $nondefaults);
     }
     if (($wgEnotifWatchlist || $wgShowUpdatedMarker) && $request->getVal('reset') && $request->wasPosted()) {
         $user->clearAllNotifications();
         $output->redirect($this->getTitle()->getFullUrl($nondefaults));
         return;
     }
     $dbr = wfGetDB(DB_SLAVE, 'watchlist');
     # Possible where conditions
     $conds = array();
     if ($values['days'] > 0) {
         $conds[] = "rc_timestamp > '" . $dbr->timestamp(time() - intval($values['days'] * 86400)) . "'";
     }
     # If the watchlist is relatively short, it's simplest to zip
     # down its entirety and then sort the results.
     # If it's relatively long, it may be worth our while to zip
     # through the time-sorted page list checking for watched items.
     # Up estimate of watched items by 15% to compensate for talk pages...
     # Toggles
     if ($values['hideOwn']) {
         $conds[] = 'rc_user != ' . $user->getId();
     }
     if ($values['hideBots']) {
         $conds[] = 'rc_bot = 0';
     }
     if ($values['hideMinor']) {
         $conds[] = 'rc_minor = 0';
     }
     if ($values['hideLiu']) {
         $conds[] = 'rc_user = 0';
     }
     if ($values['hideAnons']) {
         $conds[] = 'rc_user != 0';
     }
     if ($user->useRCPatrol() && $values['hidePatrolled']) {
         $conds[] = 'rc_patrolled != 1';
     }
     if ($nameSpaceClause) {
         $conds[] = $nameSpaceClause;
     }
     # Toggle watchlist content (all recent edits or just the latest)
     if ($user->getOption('extendwatchlist')) {
         $limitWatchlist = intval($user->getOption('wllimit'));
         $usePage = false;
     } else {
         # Top log Ids for a page are not stored
         $conds[] = 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG;
         $limitWatchlist = 0;
         $usePage = true;
     }
     # Show a message about slave lag, if applicable
     $lag = wfGetLB()->safeGetLag($dbr);
     if ($lag > 0) {
         $output->showLagWarning($lag);
     }
     # Create output form
     $form = Xml::fieldset($this->msg('watchlist-options')->text(), false, array('id' => 'mw-watchlist-options'));
     # Show watchlist header
     $form .= $this->msg('watchlist-details')->numParams($nitems)->parse();
     if ($user->getOption('enotifwatchlistpages') && $wgEnotifWatchlist) {
         $form .= $this->msg('wlheader-enotif')->parseAsBlock() . "\n";
     }
     if ($wgShowUpdatedMarker) {
         $form .= Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'id' => 'mw-watchlist-resetbutton')) . $this->msg('wlheader-showupdated')->parse() . ' ' . Xml::submitButton($this->msg('enotif_reset')->text(), array('name' => 'dummy')) . Html::hidden('reset', 'all');
         foreach ($nondefaults as $key => $value) {
             $form .= Html::hidden($key, $value);
         }
         $form .= Xml::closeElement('form');
     }
     $form .= '<hr />';
     $tables = array('recentchanges', 'watchlist');
     $fields = RecentChange::selectFields();
     $join_conds = array('watchlist' => array('INNER JOIN', array('wl_user' => $user->getId(), 'wl_namespace=rc_namespace', 'wl_title=rc_title')));
     $options = array('ORDER BY' => 'rc_timestamp DESC');
     if ($wgShowUpdatedMarker) {
         $fields[] = 'wl_notificationtimestamp';
     }
     if ($limitWatchlist) {
         $options['LIMIT'] = $limitWatchlist;
     }
     $rollbacker = $user->isAllowed('rollback');
     if ($usePage || $rollbacker) {
         $tables[] = 'page';
         $join_conds['page'] = array('LEFT JOIN', 'rc_cur_id=page_id');
         if ($rollbacker) {
             $fields[] = 'page_latest';
         }
     }
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $options, '');
     wfRunHooks('SpecialWatchlistQuery', array(&$conds, &$tables, &$join_conds, &$fields));
     $res = $dbr->select($tables, $fields, $conds, __METHOD__, $options, $join_conds);
     $numRows = $res->numRows();
     /* Start bottom header */
     $lang = $this->getLanguage();
     $wlInfo = '';
     if ($values['days'] > 0) {
         $timestamp = wfTimestampNow();
         $wlInfo = $this->msg('wlnote')->numParams($numRows, round($values['days'] * 24))->params($lang->userDate($timestamp, $user), $lang->userTime($timestamp, $user))->parse() . '<br />';
     }
     $cutofflinks = "\n" . $this->cutoffLinks($values['days'], $nondefaults) . "<br />\n";
     # Spit out some control panel links
     $filters = array('hideMinor' => 'rcshowhideminor', 'hideBots' => 'rcshowhidebots', 'hideAnons' => 'rcshowhideanons', 'hideLiu' => 'rcshowhideliu', 'hideOwn' => 'rcshowhidemine', 'hidePatrolled' => 'rcshowhidepatr');
     foreach ($this->customFilters as $key => $params) {
         $filters[$key] = $params['msg'];
     }
     // Disable some if needed
     if (!$user->useNPPatrol()) {
         unset($filters['hidePatrolled']);
     }
     $links = array();
     foreach ($filters as $name => $msg) {
         $links[] = $this->showHideLink($nondefaults, $msg, $name, $values[$name]);
     }
     # Namespace filter and put the whole form together.
     $form .= $wlInfo;
     $form .= $cutofflinks;
     $form .= $lang->pipeList($links);
     $form .= Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl(), 'id' => 'mw-watchlist-form-namespaceselector'));
     $form .= '<hr /><p>';
     $form .= Html::namespaceSelector(array('selected' => $nameSpace, 'all' => '', 'label' => $this->msg('namespace')->text()), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;';
     $form .= Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $invert, array('title' => $this->msg('tooltip-invert')->text())) . '&#160;';
     $form .= Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $associated, array('title' => $this->msg('tooltip-namespace_association')->text())) . '&#160;';
     $form .= Xml::submitButton($this->msg('allpagessubmit')->text()) . '</p>';
     $form .= Html::hidden('days', $values['days']);
     foreach ($filters as $key => $msg) {
         if ($values[$key]) {
             $form .= Html::hidden($key, 1);
         }
     }
     $form .= Xml::closeElement('form');
     $form .= Xml::closeElement('fieldset');
     $output->addHTML($form);
     # If there's nothing to show, stop here
     if ($numRows == 0) {
         $output->addWikiMsg('watchnochange');
         return;
     }
     /* End bottom header */
     /* Do link batch query */
     $linkBatch = new LinkBatch();
     foreach ($res as $row) {
         $userNameUnderscored = str_replace(' ', '_', $row->rc_user_text);
         if ($row->rc_user != 0) {
             $linkBatch->add(NS_USER, $userNameUnderscored);
         }
         $linkBatch->add(NS_USER_TALK, $userNameUnderscored);
         $linkBatch->add($row->rc_namespace, $row->rc_title);
     }
     $linkBatch->execute();
     $dbr->dataSeek($res, 0);
     $list = ChangesList::newFromContext($this->getContext());
     $list->setWatchlistDivs();
     $s = $list->beginRecentChangesList();
     $counter = 1;
     foreach ($res as $obj) {
         # Make RC entry
         $rc = RecentChange::newFromRow($obj);
         $rc->counter = $counter++;
         if ($wgShowUpdatedMarker) {
             $updated = $obj->wl_notificationtimestamp;
         } else {
             $updated = false;
         }
         if ($wgRCShowWatchingUsers && $user->getOption('shownumberswatching')) {
             $rc->numberofWatchingusers = $dbr->selectField('watchlist', 'COUNT(*)', array('wl_namespace' => $obj->rc_namespace, 'wl_title' => $obj->rc_title), __METHOD__);
         } else {
             $rc->numberofWatchingusers = 0;
         }
         $s .= $list->recentChangesLine($rc, $updated, $counter);
     }
     $s .= $list->endRecentChangesList();
     $output->addHTML($s);
 }
 /**
  * Process the query
  *
  * @param array $conds
  * @param FormOptions $opts
  * @return bool|ResultWrapper Result or false
  */
 public function doMainQuery($conds, $opts)
 {
     $tables = array('recentchanges');
     $fields = RecentChange::selectFields();
     $query_options = array();
     $join_conds = array();
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $query_options, '');
     if (!wfRunHooks('ChangesListSpecialPageQuery', array($this->getName(), &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts))) {
         return false;
     }
     $dbr = $this->getDB();
     return $dbr->select($tables, $fields, $conds, __METHOD__, $query_options, $join_conds);
 }
 /**
  * Process the query
  *
  * @param array $conds
  * @param FormOptions $opts
  * @return bool|ResultWrapper Result or false
  */
 public function doMainQuery($conds, $opts)
 {
     $tables = array('recentchanges');
     $fields = RecentChange::selectFields();
     $query_options = array();
     $join_conds = array();
     ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $query_options, '');
     // @todo Fire a Special{$this->getName()}Query hook here
     // @todo Uncomment and document
     // if ( !wfRunHooks( 'ChangesListSpecialPageQuery',
     // 	array( &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) )
     // ) {
     // 	return false;
     // }
     $dbr = $this->getDB();
     return $dbr->select($tables, $fields, $conds, __METHOD__, $query_options, $join_conds);
 }