dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8113830
)
Remove 'USE INDEX' for non-mysql
author
Domas Mituzas
<midom@users.mediawiki.org>
Wed, 9 Jun 2004 16:14:41 +0000
(16:14 +0000)
committer
Domas Mituzas
<midom@users.mediawiki.org>
Wed, 9 Jun 2004 16:14:41 +0000
(16:14 +0000)
includes/Article.php
patch
|
blob
|
history
includes/DifferenceEngine.php
patch
|
blob
|
history
includes/PageHistory.php
patch
|
blob
|
history
includes/SpecialAncientpages.php
patch
|
blob
|
history
includes/SpecialWatchlist.php
patch
|
blob
|
history
diff --git
a/includes/Article.php
b/includes/Article.php
index
87e5633
..
1e47445
100644
(file)
--- a/
includes/Article.php
+++ b/
includes/Article.php
@@
-1,4
+1,6
@@
<?php
<?php
+# $Id$
+#
# Class representing a Wikipedia article and history.
# See design.doc for an overview.
# Class representing a Wikipedia article and history.
# See design.doc for an overview.
@@
-1322,7
+1324,7
@@
class Article {
function rollback()
{
function rollback()
{
- global $wgUser, $wgLang, $wgOut, $wgRequest;
+ global $wgUser, $wgLang, $wgOut, $wgRequest
, $wgIsMySQL
;
if ( ! $wgUser->isSysop() ) {
$wgOut->sysopRequired();
if ( ! $wgUser->isSysop() ) {
$wgOut->sysopRequired();
@@
-1370,8
+1372,10
@@
class Article {
}
# Get the last edit not by this guy
}
# 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 ' .
$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';
"WHERE old_namespace={$n} AND old_title='{$tt}'" .
"AND (old_user <> {$uid} OR old_user_text <> '{$ut}')" .
'ORDER BY inverse_timestamp LIMIT 1';
diff --git
a/includes/DifferenceEngine.php
b/includes/DifferenceEngine.php
index
4b8bca4
..
1890ae4
100644
(file)
--- a/
includes/DifferenceEngine.php
+++ b/
includes/DifferenceEngine.php
@@
-118,7
+118,7
@@
cellpadding='0' cellspacing='4px' class='diff'><tr>
#
function loadText()
{
#
function loadText()
{
- global $wgTitle, $wgOut, $wgLang;
+ global $wgTitle, $wgOut, $wgLang
, $wgIsMySQL
;
$fname = "DifferenceEngine::loadText";
if ( 0 == $this->mNewid || 0 == $this->mOldid ) {
$fname = "DifferenceEngine::loadText";
if ( 0 == $this->mNewid || 0 == $this->mOldid ) {
@@
-152,8
+152,9
@@
cellpadding='0' cellspacing='4px' class='diff'><tr>
$this->mNewComment = $s->old_comment;
}
if ( 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 " .
$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";
"old_namespace=" . $this->mNewPage->getNamespace() . " AND " .
"old_title='" . wfStrencode( $this->mNewPage->getDBkey() ) .
"' ORDER BY inverse_timestamp LIMIT 1";
diff --git
a/includes/PageHistory.php
b/includes/PageHistory.php
index
5b57eec
..
a79e76f
100644
(file)
--- a/
includes/PageHistory.php
+++ b/
includes/PageHistory.php
@@
-17,7
+17,7
@@
class PageHistory {
function history()
{
function history()
{
- global $wgUser, $wgOut, $wgLang;
+ global $wgUser, $wgOut, $wgLang
, $wgIsMySQL
;
# If page hasn't changed, client can cache this
# If page hasn't changed, client can cache this
@@
-54,9
+54,10
@@
class PageHistory {
$namespace = $this->mTitle->getNamespace();
$title = $this->mTitle->getText();
$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 ".
$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";
"WHERE old_namespace={$namespace} AND " .
"old_title='" . wfStrencode( $this->mTitle->getDBkey() ) . "' " .
"ORDER BY inverse_timestamp LIMIT $rawoffset, $limitplus";
diff --git
a/includes/SpecialAncientpages.php
b/includes/SpecialAncientpages.php
index
52bc005
..
3aa93a5
100644
(file)
--- a/
includes/SpecialAncientpages.php
+++ b/
includes/SpecialAncientpages.php
@@
-13,12
+13,14
@@
class AncientPagesPage extends QueryPage {
}
function getSQL() {
}
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
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";
}
WHERE cur_namespace=0 AND cur_is_redirect=0";
}
diff --git
a/includes/SpecialWatchlist.php
b/includes/SpecialWatchlist.php
index
619dc38
..
45c055c
100644
(file)
--- a/
includes/SpecialWatchlist.php
+++ b/
includes/SpecialWatchlist.php
@@
-5,7
+5,7
@@
require_once( "WatchedItem.php" );
function wfSpecialWatchlist()
{
global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc;
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";
global $days, $limit, $target; # From query string
$fname = "wfSpecialWatchlist";
@@
-137,11
+137,11
@@
function wfSpecialWatchlist()
$wgLang->formatNum( $nitems ), $wgLang->formatNum( $npages ), $y,
$specialTitle->escapeLocalUrl( "magic=yes" ) ) . "</i><br />\n" );
$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
$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
WHERE wl_user=$uid
AND $z
AND wl_title=cur_title