$sql = "SELECT img_size,img_description,img_user," .
"img_user_text,img_timestamp FROM image WHERE " .
"img_name='" . wfStrencode( $this->mTitle->getDBkey() ) . "'";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
if ( 0 == wfNumRows( $res ) ) { return; }
"oi_user_text,oi_timestamp,oi_archive_name FROM oldimage WHERE " .
"oi_name='" . wfStrencode( $this->mTitle->getDBkey() ) . "' " .
"ORDER BY oi_timestamp DESC";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
while ( $line = wfFetchObject( $res ) ) {
$s .= $sk->imageHistoryLine( false, $line->oi_timestamp,
$sql = "SELECT il_from FROM imagelinks WHERE il_to='" .
wfStrencode( $this->mTitle->getDBkey() ) . "'";
- $res = wfQuery( $sql, "Article::imageLinks" );
+ $res = wfQuery( $sql, DB_READ, "Article::imageLinks" );
if ( 0 == wfNumRows( $res ) ) {
$wgOut->addHtml( "<p>" . wfMsg( "nolinkstoimage" ) . "\n" );
}
$sql = "DELETE FROM image WHERE img_name='" .
wfStrencode( $image ) . "'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
$sql = "SELECT oi_archive_name FROM oldimage WHERE oi_name='" .
wfStrencode( $image ) . "'";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
while ( $s = wfFetchObject( $res ) ) {
$this->doDeleteOldImage( $s->oi_archive_name );
}
$sql = "DELETE FROM oldimage WHERE oi_name='" .
wfStrencode( $image ) . "'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
# Image itself is now gone, and database is cleaned.
# Now we remove the image description page.
$this->doDeleteOldImage( $oldimage );
$sql = "DELETE FROM oldimage WHERE oi_archive_name='" .
wfStrencode( $oldimage ) . "'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
$deleted = $oldimage;
} else {
if( $id === FALSE ) {
$sql = "SELECT HIGH_PRIORITY cur_id FROM cur WHERE cur_namespace=" .
"{$ns} AND cur_title='" . wfStrencode( $t ) . "'";
- $res = wfQuery( $sql, "LinkCache::addLink" );
+ $res = wfQuery( $sql, DB_READ, "LinkCache::addLink" );
if ( 0 == wfNumRows( $res ) ) {
$id = 0;
$sql = "SELECT HIGH_PRIORITY cur_id,cur_namespace,cur_title
FROM cur,links
WHERE cur_id=l_to AND l_from='{$dbkeyfrom}'";
- $res = wfQuery( $sql, "LinkCache::preFill" );
+ $res = wfQuery( $sql, DB_READ, "LinkCache::preFill" );
while( $s = wfFetchObject( $res ) ) {
$this->addGoodLink( $s->cur_id,
Title::makeName( $s->cur_namespace, $s->cur_title )
$sql = "SELECT HIGH_PRIORITY bl_to
FROM brokenlinks
WHERE bl_from='{$id}'";
- $res = wfQuery( $sql, "LinkCache::preFill" );
+ $res = wfQuery( $sql, DB_READ, "LinkCache::preFill" );
while( $s = wfFetchObject( $res ) ) {
$this->addBadLink( $s->bl_to );
}
if( $wgDBtransactions ) {
$sql = "BEGIN";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
#------------------------------------------------------------------------------
if ( count( $del ) ) {
$sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}' AND l_to IN(".
implode( ",", $del ) . ")";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
} else {
# Delete everything
$sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
# Get the addition list
$add = $wgLinkCache->getGoodLinks();
}
}
if ( "" != $sql ) {
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
#------------------------------------------------------------------------------
if ( count( $del ) ) {
$sql = "DELETE FROM brokenlinks WHERE bl_from={$this->mId} AND bl_to IN('" .
implode( "','", $del ) . "')";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
} else {
# Delete all
$sql = "DELETE FROM brokenlinks WHERE bl_from={$this->mId}";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
# Get addition list
$add = $wgLinkCache->getBadLinks();
}
}
if ( "" != $sql ) {
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
#------------------------------------------------------------------------------
# Image links
$sql = "DELETE FROM imagelinks WHERE il_from='{$this->mTitleEnc}'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
# Get addition list
$add = $wgLinkCache->getImageLinks();
$sql .= "('{$this->mTitleEnc}','{$iname}')";
}
}
- if ( "" != $sql ) { wfQuery( $sql, $fname ); }
+ if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
$this->fixBrokenLinks();
if( $wgDBtransactions ) {
$sql = "COMMIT";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
wfProfileOut();
}
if( $wgDBtransactions ) {
$sql = "BEGIN";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
$sql = "DELETE FROM links WHERE l_from='{$this->mTitleEnc}'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
$a = $wgLinkCache->getGoodLinks();
$sql = "";
$sql .= "('{$this->mTitleEnc}',{$lid})";
}
}
- if ( "" != $sql ) { wfQuery( $sql, $fname ); }
+ if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
$sql = "DELETE FROM brokenlinks WHERE bl_from={$this->mId}";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
$a = $wgLinkCache->getBadLinks();
$sql = "";
$sql .= "({$this->mId},'{$blt}')";
}
}
- if ( "" != $sql ) { wfQuery( $sql, $fname ); }
+ if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
$sql = "DELETE FROM imagelinks WHERE il_from='{$this->mTitleEnc}'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
$a = $wgLinkCache->getImageLinks();
$sql = "";
$sql .= "('{$this->mTitleEnc}','{$iname}')";
}
}
- if ( "" != $sql ) { wfQuery( $sql, $fname ); }
+ if ( "" != $sql ) { wfQuery( $sql, DB_WRITE, $fname ); }
$this->fixBrokenLinks();
if( $wgDBtransactions ) {
$sql = "COMMIT";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
wfProfileOut();
}
/* Call for a newly created page, or just to make sure state is consistent */
$sql = "SELECT bl_from FROM brokenlinks WHERE bl_to='{$this->mTitleEnc}'";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
if ( 0 == wfNumRows( $res ) ) { return; }
$sql = "INSERT INTO links (l_from,l_to) VALUES ";
$sql2 .= $row->bl_from;
}
$sql2 .= ")";
- wfQuery( $sql, $fname );
- wfQuery( $sql2, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
+ wfQuery( $sql2, DB_WRITE, $fname );
$sql = "DELETE FROM brokenlinks WHERE bl_to='{$this->mTitleEnc}'";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
}
$sql = "SELECT cur_id,cur_text,cur_timestamp FROM cur " .
"WHERE cur_namespace=" . Namespace::getWikipedia() . " AND " .
"cur_title='" . wfStrencode($this->mTitle ) . "'";
- $res = wfQuery( $sql, "LogPage::getContent" );
+ $res = wfQuery( $sql, DB_READ, "LogPage::getContent" );
if( wfNumRows( $res ) > 0 ) {
$s = wfFetchObject( $res );
wfStrencode( $this->mTitle ) . "', '" .
wfStrencode( $this->mContent ) . "', '" .
wfStrencode( $this->mComment ) . "', 'sysop', '{$won}','{$now}')";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
$this->mId = wfInsertId();
} else {
$sql = "UPDATE cur SET cur_timestamp='{$now}', " .
"cur_comment='" . wfStrencode( $this->mComment ) . "', " .
"cur_restrictions='sysop', inverse_timestamp='{$won}', cur_touched='{$now}' " .
"WHERE cur_id={$this->mId}";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
# And update recentchanges
rc_cur_id) VALUES ('{$now}','{$now}',{$uid},'{$ut}',4,'" .
wfStrencode( $this->mTitle ) . "','" .
wfStrencode( $this->mComment ) . "',{$this->mId})";
- wfQuery( $sql, $fname );
+ wfQuery( $sql, DB_WRITE, $fname );
}
return true;
}
else
$sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM math WHERE math_inputhash = '".$md5_sql."'";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
if ( wfNumRows( $res ) == 0 )
{
$cmd = "./math/texvc ".escapeshellarg($wgTmpDirectory)." ".
$sql = "REPLACE INTO math VALUES ('".$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html.", ".$sql_mathml.")";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_WRITE, $fname );
# we don't really care if it fails
if (($math == 0) || ($rpage->math_html == '') || (($math == 1) && ($conservativeness != 2)) || (($math == 4) && ($conservativeness == 0)))
global $wgUser ;
$sk = $wgUser->getSkin() ;
$sql = "SELECT l_from FROM links WHERE l_to={$id}" ;
- $res = wfQuery ( $sql ) ;
+ $res = wfQuery ( $sql, DB_READ ) ;
while ( $x = wfFetchObject ( $res ) )
{
# $t = new Title ;
"WHERE cur_id=si_page AND {$this->mTitlecond} " .
"{$searchnamespaces} {$redircond}" .
"LIMIT {$offset}, {$limit}";
- $res1 = wfQuery( $sql, $fname );
+ $res1 = wfQuery( $sql, DB_READ, $fname );
$num = wfNumRows($res1);
if ( $wgDisableTextSearch ) {
"WHERE cur_id=si_page AND {$this->mTextcond} " .
"{$searchnamespaces} {$redircond} " .
"LIMIT {$offset}, {$limit}";
- $res2 = wfQuery( $sql, $fname );
+ $res2 = wfQuery( $sql, DB_READ, $fname );
$num = $num + wfNumRows($res2);
}
"WHERE cur_id=si_page AND {$this->mTitlecond} ORDER BY cur_namespace LIMIT 1";
if ( "" != $this->mTitlecond ) {
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
}
if ( isset( $res ) && 0 != wfNumRows( $res ) ) {
$s = wfFetchObject( $res );
$sql = "UPDATE LOW_PRIORITY searchindex SET si_title='" .
wfStrencode( Title::indexTitle( $this->mNamespace, $this->mTitle ) ) .
"' WHERE si_page={$this->mId}";
- wfQuery( $sql, "SearchUpdate::doUpdate" );
+ wfQuery( $sql, DB_WRITE, "SearchUpdate::doUpdate" );
return;
}
$sql = "REPLACE DELAYED INTO searchindex (si_page,si_title,si_text) VALUES ({$this->mId},'" .
wfStrencode( Title::indexTitle( $this->mNamespace, $this->mTitle ) ) . "','" .
wfStrencode( $text ) . "')";
- wfQuery( $sql, "SearchUpdate::doUpdate" );
+ wfQuery( $sql, DB_WRITE, "SearchUpdate::doUpdate" );
}
}
$sql = "UPDATE LOW_PRIORITY site_stats SET " . implode ( ",", $a ) .
" WHERE ss_row_id=1";
- wfQuery( $sql, "SiteStatsUpdate::doUpdate" );
+ wfQuery( $sql, DB_WRITE, "SiteStatsUpdate::doUpdate" );
}
}
# Language class has internationalized names
#
/* private */ $wgValidSkinNames = array(
- "Standard", "Nostalgia", "CologneBlue", "Smarty", "Montparnasse"
+ "Standard", "Nostalgia", "CologneBlue" #, "Smarty", "Montparnasse"
);
# For some odd PHP bug, this function can't be part of a class
} else {
$threshold = $wgUser->getOption("stubthreshold") ;
if ( $threshold > 0 ) {
- $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'" ) ;
+ $res = wfQuery ( "SELECT HIGH_PRIORITY length(cur_text) AS x, cur_namespace, cur_is_redirect FROM cur WHERE cur_id='{$aid}'", DB_READ ) ;
if ( wfNumRows( $res ) > 0 ) {
$s = wfFetchObject( $res );
include_once( "SkinStandard.php" );
include_once( "SkinNostalgia.php" );
include_once( "SkinCologneBlue.php" );
-include_once( "SkinSmarty.php" );
+
+#include_once( "SkinSmarty.php" );
?>
$out = "";
$sql = "SELECT COUNT(*) AS count $fromwhere";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
$s = wfFetchObject( $res );
$count = $s->count;
$sections = ceil( $count / $indexMaxperpage );
$sql = "SELECT cur_title $fromwhere $order LIMIT 1";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
$s = wfFetchObject( $res );
$inpoint = $s->cur_title;
for( $i = 1; $i < $sections; $i++ ) {
$from = $i * $indexMaxperpage;
$sql = "SELECT cur_title $fromwhere $order LIMIT $from,2";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
$s = wfFetchObject( $res );
$outpoint = $s->cur_title;
$from = $i * $indexMaxperpage;
$sql = "SELECT cur_title $fromwhere $order LIMIT " . ($count-1) . ",1";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
$s = wfFetchObject( $res );
$outpoint = $s->cur_title;
$out .= indexShowline( $inpoint, $outpoint );
WHERE cur_namespace=0 AND cur_title >= '" . wfStrencode( $from ) . "'
ORDER BY cur_title
LIMIT {$indexMaxperpage}";
- $res = wfQuery( $sql, "indexShowChunk" );
+ $res = wfQuery( $sql, DB_READ, "indexShowChunk" );
# FIXME: Dynamic column widths, backlink to main list,
# side links to next and previous
"cur_timestamp FROM cur USE INDEX (cur_timestamp) " .
"WHERE cur_namespace=0 AND cur_is_redirect=0 " .
" ORDER BY cur_timestamp LIMIT {$offset}, {$limit}";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
$top = wfShowingResults( $offset, $limit );
$wgOut->addHTML( "<p>{$top}\n" );
$connection = wfGetDB( $wgDBsqluser, $wgDBsqlpassword );
}
$this->logQuery( $wpSqlQuery );
- $res = wfQuery( $wpSqlQuery, "SpecialAsksql::doSubmit" );
+ $res = wfQuery( $wpSqlQuery, DB_READ, "SpecialAsksql::doSubmit" );
$this->logFinishedQuery();
$n = 0;
$sql = "SELECT cur_text FROM cur " .
"WHERE cur_namespace=4 and cur_title='" .
wfStrencode( $bstitle->getDBkey() ) . "'";
- $res = wfQuery( $sql, $fname );
+ $res = wfQuery( $sql, DB_READ, $fname );
if( ( $s = wfFetchObject( $res ) ) and ( $s->cur_text != "" ) ) {
$bstext = $s->cur_text;
$bstext = str_replace( "MAGICNUMBER", $this->mIsbn, $bstext );
$r .= "<OL>\n" ;
$cat = ucfirst ( wfMsg ( "category" ) ) ;
$sql = "SELECT cur_title FROM cur WHERE cur_title LIKE \"{$cat}:%\"" ;
- $res = wfQuery ( $sql ) ;
+ $res = wfQuery ( $sql, DB_READ ) ;
while ( $x = wfFetchObject ( $res ) )
{
$t = explode ( ":" , $x->cur_title , 2 ) ;
$r .= "<hr>\n" ;
$sql = "SELECT DISTINCT bl_to FROM brokenlinks WHERE bl_to LIKE \"{$cat}:%\"" ;
- $res = wfQuery ( $sql ) ;
+ $res = wfQuery ( $sql, DB_READ ) ;
$r .= "<OL>\n" ;
while ( $x = wfFetchObject ( $res ) )
{
$sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment FROM cur " .
"WHERE cur_user_text='" . wfStrencode( $nt->getText() ) . "' {$cmq} " .
"ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
- $res1 = wfQuery( $sql, $fname );
+ $res1 = wfQuery( $sql, DB_READ, $fname );
$sql = "SELECT old_namespace,old_title,old_timestamp,old_comment FROM old " .
"WHERE old_user_text='" . wfStrencode( $nt->getText() ) . "' {$omq} " .
"ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
- $res2 = wfQuery( $sql, $fname );
+ $res2 = wfQuery( $sql, DB_READ, $fname );
} else {
$sql = "SELECT cur_namespace,cur_title,cur_timestamp,cur_comment FROM cur " .
"WHERE cur_user={$id} {$cmq} ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
- $res1 = wfQuery( $sql, $fname );
+ $res1 = wfQuery( $sql, DB_READ, $fname );
$sql = "SELECT old_namespace,old_title,old_timestamp,old_comment FROM old " .
"WHERE old_user={$id} {$omq} ORDER BY inverse_timestamp LIMIT {$offset}, {$limit}";
- $res2 = wfQuery( $sql, $fname );
+ $res2 = wfQuery( $sql, DB_READ, $fname );
}
$nCur = wfNumRows( $res1 );
$nOld = wfNumRows( $res2 );
$text = str_replace( "$2", $bydate, $text );
$wgOut->addHTML( "{$text}<br>\n<p>" );
- $res = wfQuery( $sql, "wfSpecialImagelist" );
+ $res = wfQuery( $sql, DB_READ, "wfSpecialImagelist" );
while ( $s = wfFetchObject( $res ) ) {
$name = $s->img_name;
$ut = $s->img_user_text;
$sql = "SELECT user_name,user_rights FROM user ORDER BY " .
"user_name LIMIT {$offset}, {$limit}";
- $res = wfQuery( $sql, "wfSpecialListusers" );
+ $res = wfQuery( $sql, DB_READ, "wfSpecialListusers" );
$sk = $wgUser->getSkin();
while ( $s = wfFetchObject( $res ) ) {