<?php
+# $Id$
+#
# Class representing a Wikipedia article and history.
# See design.doc for an overview.
function rollback()
{
- global $wgUser, $wgLang, $wgOut, $wgRequest;
+ global $wgUser, $wgLang, $wgOut, $wgRequest, $wgIsMySQL;
if ( ! $wgUser->isSysop() ) {
$wgOut->sysopRequired();
}
# Get the last edit not by this guy
+
+ $use_index=$wgIsMySQL?"USE INDEX (name_title_timestamp)":"";
$sql = 'SELECT old_text,old_user,old_user_text,old_timestamp,old_flags ' .
- 'FROM old USE INDEX (name_title_timestamp)' .
+ 'FROM old {$use_index}' .
"WHERE old_namespace={$n} AND old_title='{$tt}'" .
"AND (old_user <> {$uid} OR old_user_text <> '{$ut}')" .
'ORDER BY inverse_timestamp LIMIT 1';
#
function loadText()
{
- global $wgTitle, $wgOut, $wgLang;
+ global $wgTitle, $wgOut, $wgLang, $wgIsMySQL;
$fname = "DifferenceEngine::loadText";
if ( 0 == $this->mNewid || 0 == $this->mOldid ) {
$this->mNewComment = $s->old_comment;
}
if ( 0 == $this->mOldid ) {
+ $use_index=$wgIsMySQL?"USE INDEX (name_title_timestamp)":"";
$sql = "SELECT old_namespace,old_title,old_timestamp,old_text,old_flags,old_user_text,old_comment " .
- "FROM old USE INDEX (name_title_timestamp) WHERE " .
+ "FROM old $use_index WHERE " .
"old_namespace=" . $this->mNewPage->getNamespace() . " AND " .
"old_title='" . wfStrencode( $this->mNewPage->getDBkey() ) .
"' ORDER BY inverse_timestamp LIMIT 1";
function history()
{
- global $wgUser, $wgOut, $wgLang;
+ global $wgUser, $wgOut, $wgLang, $wgIsMySQL;
# If page hasn't changed, client can cache this
$namespace = $this->mTitle->getNamespace();
$title = $this->mTitle->getText();
+ $use_index=$wgIsMySQL?"USE INDEX (name_title_timestamp)":"";
$sql = "SELECT old_id,old_user," .
"old_comment,old_user_text,old_timestamp,old_minor_edit ".
- "FROM old USE INDEX (name_title_timestamp) " .
+ "FROM old $use_index " .
"WHERE old_namespace={$namespace} AND " .
"old_title='" . wfStrencode( $this->mTitle->getDBkey() ) . "' " .
"ORDER BY inverse_timestamp LIMIT $rawoffset, $limitplus";
}
function getSQL() {
+ global $wgIsMySQL;
+ $use_index=$wgIsMySQL?"USE INDEX (cur_timestamp)":"";
return
"SELECT 'Ancientpages' as type,
cur_namespace as namespace,
cur_title as title,
UNIX_TIMESTAMP(cur_timestamp) as value
- FROM cur USE INDEX (cur_timestamp)
+ FROM cur $use_index
WHERE cur_namespace=0 AND cur_is_redirect=0";
}
function wfSpecialWatchlist()
{
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc;
- global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname;
+ global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname, $wgIsMySQL;
global $days, $limit, $target; # From query string
$fname = "wfSpecialWatchlist";
$wgLang->formatNum( $nitems ), $wgLang->formatNum( $npages ), $y,
$specialTitle->escapeLocalUrl( "magic=yes" ) ) . "</i><br />\n" );
-
+ $use_index=$wgIsMySQL?"USE INDEX ($x)":"";
$sql = "SELECT
cur_namespace,cur_title,cur_comment, cur_id,
cur_user,cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new
- FROM watchlist,cur USE INDEX ($x)
+ FROM watchlist,cur $use_index
WHERE wl_user=$uid
AND $z
AND wl_title=cur_title