if ( strlen( str_replace( '_', '', $term ) )<3 )
return;
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$res = $db->select( 'page', 'page_title',
array( 'page_namespace' => 0,
"page_title LIKE '". $db->strencode( $term) ."%'" ),
if($watch) {
if(!$watching) {
- $dbw =& wfGetDB(DB_MASTER);
+ $dbw = wfGetDB(DB_MASTER);
$dbw->begin();
$article->doWatch();
$dbw->commit();
}
} else {
if($watching) {
- $dbw =& wfGetDB(DB_MASTER);
+ $dbw = wfGetDB(DB_MASTER);
$dbw->begin();
$article->doUnwatch();
$dbw->commit();
* @param array $conditions
* @private
*/
- function pageData( &$dbr, $conditions ) {
+ function pageData( $dbr, $conditions ) {
$fields = array(
'page_id',
'page_namespace',
* @param Database $dbr
* @param Title $title
*/
- function pageDataFromTitle( &$dbr, $title ) {
+ function pageDataFromTitle( $dbr, $title ) {
return $this->pageData( $dbr, array(
'page_namespace' => $title->getNamespace(),
'page_title' => $title->getDBkey() ) );
* @param Database $dbr
* @param int $id
*/
- function pageDataFromId( &$dbr, $id ) {
+ function pageDataFromId( $dbr, $id ) {
return $this->pageData( $dbr, array( 'page_id' => $id ) );
}
*/
function loadPageData( $data = 'fromdb' ) {
if ( $data === 'fromdb' ) {
- $dbr =& $this->getDB();
+ $dbr = $this->getDB();
$data = $this->pageDataFromId( $dbr, $this->getId() );
}
return $this->mContent;
}
- $dbr =& $this->getDB();
+ $dbr = $this->getDB();
# Pre-fill content with error message so that if something
# fails we'll have something telling us what we intended.
*
* @return Database
*/
- function &getDB() {
+ function getDB() {
return wfGetDB( DB_MASTER );
}
if ( $id == 0 ) {
$this->mCounter = 0;
} else {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$this->mCounter = $dbr->selectField( 'page', 'page_counter', array( 'page_id' => $id ),
'Article::getCount', $this->getSelectOptions() );
}
# XXX: this is expensive; cache this info somewhere.
$contribs = array();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$revTable = $dbr->tableName( 'revision' );
$userTable = $dbr->tableName( 'user' );
$user = $this->getUser();
function addTrackbacks() {
global $wgOut, $wgUser;
- $dbr =& wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_SLAVE);
$tbs = $dbr->select(
/* FROM */ 'trackbacks',
/* SELECT */ array('tb_id', 'tb_title', 'tb_url', 'tb_ex', 'tb_name'),
return;
}
- $db =& wfGetDB(DB_MASTER);
+ $db = wfGetDB(DB_MASTER);
$db->delete('trackbacks', array('tb_id' => $wgRequest->getInt('tbid')));
$wgTitle->invalidateCache();
$wgOut->addWikiText(wfMsg('trackbackdeleteok'));
if( is_null( $edittime ) ) {
$rev = Revision::newFromTitle( $this->mTitle );
} else {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime );
}
if( is_null( $rev ) ) {
$this->doEdit( $text, $summary, $flags );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if ($watchthis) {
if (!$this->mTitle->userIsWatching()) {
$dbw->begin();
$good = $this->doEdit( $text, $summary, $flags );
if ( $good ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if ($watchthis) {
if (!$this->mTitle->userIsWatching()) {
$dbw->begin();
$text = $this->preSaveTransform( $text );
$newsize = strlen( $text );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$now = wfTimestampNow();
if ( $flags & EDIT_UPDATE ) {
if( $changed ) {
if( wfRunHooks( 'ArticleProtect', array( &$this, &$wgUser, $limit, $reason ) ) ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
# Prepare a null revision to be added to the history
$comment = $wgContLang->ucfirst( wfMsgForContent( $protect ? 'protectedarticle' : 'unprotectedarticle', $this->mTitle->getPrefixedText() ) );
$wgOut->setPagetitle( wfMsg( 'confirmdelete' ) );
# Better double-check that it hasn't been deleted yet!
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$conds = $this->mTitle->pageCond();
$latest = $dbw->selectField( 'page', 'page_latest', $conds, __METHOD__ );
if ( $latest === false ) {
// First try the slave
// If that doesn't have the latest revision, try the master
$continue = 2;
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
do {
$res = $db->select( array( 'page', 'revision' ),
array( 'rev_id', 'rev_user_text' ),
}
$row = $db->fetchObject( $res );
if ( $continue == 2 && $revLatest && $row->rev_id != $revLatest ) {
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
$continue--;
} else {
$continue = 0;
wfDebug( __METHOD__."\n" );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$ns = $this->mTitle->getNamespace();
$t = $this->mTitle->getDBkey();
$id = $this->mTitle->getArticleID();
$wgOut->addWikiText( wfMsg( 'sessionfailure' ) );
return;
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
# Enhanced rollback, marks edits rc_bot=1
$bot = $wgRequest->getBool( 'bot' );
# Periodically flush old entries from the recentchanges table.
global $wgRCMaxAge;
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
$recentchanges = $dbw->tableName( 'recentchanges' );
$sql = "DELETE FROM $recentchanges WHERE rc_timestamp < '{$cutoff}'";
function quickEdit( $text, $comment = '', $minor = 0 ) {
wfProfileIn( __METHOD__ );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$revision = new Revision( array(
'page' => $this->getId(),
$id = intval( $id );
global $wgHitcounterUpdateFreq, $wgDBtype;
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$pageTable = $dbw->tableName( 'page' );
$hitcounterTable = $dbw->tableName( 'hitcounter' );
$acchitsTable = $dbw->tableName( 'acchits' );
$wgOut->addHTML(wfMsg( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon' ) );
}
} else {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$wl_clause = array(
'wl_title' => $page->getDBkey(),
'wl_namespace' => $page->getNamespace() );
return false;
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$rev_clause = array( 'rev_page' => $id );
return array();
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'templatelinks' ),
array( 'tl_namespace', 'tl_title' ),
array( 'tl_from' => $id ),
$tlTemplates = array();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'templatelinks' ),
array( 'tl_namespace', 'tl_title' ),
array( 'tl_from' => $id ),
# Whee, link updates time.
$u = new LinksUpdate( $this->mTitle, $parserOutput );
- $dbw =& wfGetDb( DB_MASTER );
+ $dbw = wfGetDb( DB_MASTER );
$dbw->begin();
$u->doUpdate();
var $tableInitialised = false;
function _doquery($sql) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->query($sql, 'MediaWikiBagOStuff::_doquery');
}
function _doinsert($t, $v) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->insert($t, $v, 'MediaWikiBagOStuff::_doinsert',
array( 'IGNORE' ) );
}
function _fetchobject($result) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->fetchObject($result);
}
function _freeresult($result) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->freeResult($result);
}
function _dberror($result) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->lastError();
}
function _maxdatetime() {
}
}
function _fromunixtime($ts) {
- $dbw =& wfGetDB(DB_MASTER);
+ $dbw = wfGetDB(DB_MASTER);
return $dbw->timestamp($ts);
}
function _strencode($s) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->strencode($s);
}
function _blobencode($s) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->encodeBlob($s);
}
function _blobdecode($s) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->decodeBlob($s);
}
function getTableName() {
if ( !$this->tableInitialised ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
/* This is actually a hack, we should be able
to use Language classes here... or not */
if (!$dbw)
static function newFromID( $id )
{
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->resultObject( $dbr->select( 'ipblocks', '*',
array( 'ipb_id' => $id ), __METHOD__ ) );
$block = new Block;
{
global $wgAntiLockFlags;
if ( $this->mForUpdate || $this->mFromMaster ) {
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
if ( !$this->mForUpdate || ($wgAntiLockFlags & ALF_NO_BLOCK_LOCK) ) {
$options = array();
} else {
$options = array( 'FOR UPDATE' );
}
} else {
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$options = array();
}
return $db;
$block = new Block();
if ( $flags & Block::EB_FOR_UPDATE ) {
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
if ( $wgAntiLockFlags & ALF_NO_BLOCK_LOCK ) {
$options = '';
} else {
}
$block->forUpdate( true );
} else {
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$options = '';
}
if ( $flags & Block::EB_RANGE_ONLY ) {
throw new MWException( "Block::delete() now requires that the mId member be filled\n" );
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'ipblocks', array( 'ipb_id' => $this->mId ), __METHOD__ );
return $dbw->affectedRows() > 0;
}
function insert()
{
wfDebug( "Block::insert; timestamp {$this->mTimestamp}\n" );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
# Unset ipb_anon_only for user blocks, makes no sense
*/
function doAutoblock( $autoblockip ) {
# Check if this IP address is already blocked
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
# If autoblocks are disabled, go away.
$this->mTimestamp = wfTimestamp();
$this->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'ipblocks',
array( /* SET */
'ipb_timestamp' => $dbw->timestamp($this->mTimestamp),
* Purge expired blocks from the ipblocks table
*/
static function purgeExpired() {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'ipblocks', array( 'ipb_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ), __METHOD__ );
}
/*
static $infinity;
if ( !isset( $infinity ) ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$infinity = $dbr->bigTimestamp();
}
return $infinity;
# Do the query
if ( count( $timestamps ) ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$where = $this->getLinkBatch()->constructSet( 'page', $dbr );
$res = $dbr->select( 'page',
array( 'page_namespace', 'page_title', 'page_touched' ),
}
function doCategoryQuery() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
if( $this->from != '' ) {
$pageCondition = 'cl_sortkey >= ' . $dbr->addQuotes( $this->from );
$this->flip = false;
*/
function pagingLinks( $title, $first, $last, $limit, $query = array() ) {
global $wgUser, $wgLang;
- $sk =& $this->getSkin();
+ $sk = $this->getSkin();
$limitText = $wgLang->formatNum( $limit );
$prevLink = htmlspecialchars( wfMsg( 'prevn', $limitText ) );
@return array of page_ids (those given to seed() that match the conditions)
*/
function run () {
- $this->dbr =& wfGetDB( DB_SLAVE );
+ $this->dbr = wfGetDB( DB_SLAVE );
while ( count ( $this->next ) > 0 ) {
$this->scan_next_layer () ;
}
* @return ChangesList derivative
*/
public static function newFromUser( &$user ) {
- $sk =& $user->getSkin();
+ $sk = $user->getSkin();
$list = NULL;
if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
# Someone has tried to call this the old way
throw new FatalError( wfMsgNoDB( 'wrong_wfQuery_params', $db, $sql ) );
}
- $c =& wfGetDB( $db );
+ $c = wfGetDB( $db );
if ( $c !== false ) {
return $c->query( $sql, $fname );
} else {
* @return Array: first row from the database
*/
function wfSingleQuery( $sql, $dbi, $fname = '' ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
$res = $db->query($sql, $fname );
$row = $db->fetchRow( $res );
$ret = $row[0];
* @return Returns the previous state.
*/
function wfIgnoreSQLErrors( $newstate, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->ignoreErrors( $newstate );
} else {
*/
function wfFreeResult( $res, $dbi = DB_LAST )
{
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
$db->freeResult( $res );
return true;
* @return object|false object we requested
*/
function wfFetchObject( $res, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->fetchObject( $res, $dbi = DB_LAST );
} else {
* @return object|false row we requested
*/
function wfFetchRow( $res, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->fetchRow ( $res, $dbi = DB_LAST );
} else {
* @return integer|false number of rows
*/
function wfNumRows( $res, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->numRows( $res, $dbi = DB_LAST );
} else {
* @return integer|false number of fields
*/
function wfNumFields( $res, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->numFields( $res );
} else {
*/
function wfFieldName( $res, $n, $dbi = DB_LAST )
{
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->fieldName( $res, $n, $dbi = DB_LAST );
} else {
* @todo document function
*/
function wfInsertId( $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->insertId();
} else {
* @todo document function
*/
function wfDataSeek( $res, $row, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->dataSeek( $res, $row );
} else {
* @todo document function
*/
function wfLastErrno( $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->lastErrno();
} else {
* @todo document function
*/
function wfLastError( $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->lastError();
} else {
* @todo document function
*/
function wfAffectedRows( $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->affectedRows();
} else {
* @todo document function
*/
function wfLastDBquery( $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->lastQuery();
} else {
*/
function wfSetSQL( $table, $var, $value, $cond, $dbi = DB_MASTER )
{
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->set( $table, $var, $value, $cond );
} else {
*/
function wfGetSQL( $table, $var, $cond='', $dbi = DB_LAST )
{
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->selectField( $table, $var, $cond );
} else {
* @return Result of Database::fieldExists() or false.
*/
function wfFieldExists( $table, $field, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->fieldExists( $table, $field );
} else {
* @return Result of Database::indexExists() or false.
*/
function wfIndexExists( $table, $index, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->indexExists( $table, $index );
} else {
* @return result of Database::insert() or false.
*/
function wfInsertArray( $table, $array, $fname = 'wfInsertArray', $dbi = DB_MASTER ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->insert( $table, $array, $fname );
} else {
* @return result of Database::getArray() or false.
*/
function wfGetArray( $table, $vars, $conds, $fname = 'wfGetArray', $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->getArray( $table, $vars, $conds, $fname );
} else {
* @todo document function
*/
function wfUpdateArray( $table, $values, $conds, $fname = 'wfUpdateArray', $dbi = DB_MASTER ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
$db->update( $table, $values, $conds, $fname );
return true;
* @todo document function
*/
function wfTableName( $name, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->tableName( $name );
} else {
* @todo document function
*/
function wfStrencode( $s, $dbi = DB_LAST ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->strencode( $s );
} else {
* @todo document function
*/
function wfNextSequenceValue( $seqName, $dbi = DB_MASTER ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->nextSequenceValue( $seqName );
} else {
* @todo document function
*/
function wfUseIndexClause( $index, $dbi = DB_SLAVE ) {
- $db =& wfGetDB( $dbi );
+ $db = wfGetDB( $dbi );
if ( $db !== false ) {
return $db->useIndexClause( $index );
} else {
$fname = 'EditPage::showEditForm';
wfProfileIn( $fname );
- $sk =& $wgUser->getSkin();
+ $sk = $wgUser->getSkin();
wfRunHooks( 'EditPage::showEditForm:initial', array( &$this ) ) ;
}
function getLastDelete() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$fname = 'EditPage::getLastDelete';
$res = $dbr->select(
array( 'logging', 'user' ),
$fname = 'EditPage::mergeChangesInto';
wfProfileIn( $fname );
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
// This is the revision the editor started from
$baseRevision = Revision::loadFromTimestamp(
function doUpdate() {
# Fetch the IDs
$cond = $this->getToCondition();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( $this->mTable, $this->getFromField(), $cond, __METHOD__ );
$resWrap = new ResultWrapper( $dbr, $res );
if ( $dbr->numRows( $res ) != 0 ) {
return;
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$timestamp = $dbw->timestamp();
$done = false;
$conds[] = "$fromField <= {$this->end}";
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( $this->table, $fromField, $conds, __METHOD__ );
$update->invalidateIDs( new ResultWrapper( $dbr, $res ) );
$dbr->freeResult( $res );
if( isset( $wgBlobCache[$this->mOldId] ) ) {
$obj = $wgBlobCache[$this->mOldId];
} else {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'text', array( 'old_flags', 'old_text' ), array( 'old_id' => $this->mOldId ) );
if( !$row ) {
return false;
/** @todo document */
function getText() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'cur', array( 'cur_text' ), array( 'cur_id' => $this->mCurId ) );
if( !$row ) {
return false;
global $wgUseSharedUploads, $wgSharedUploadDBname, $wgSharedUploadDBprefix, $wgContLang;
wfProfileIn( __METHOD__ );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$this->checkDBSchema($dbr);
$row = $dbr->selectRow( 'image',
# capitalize the first letter of the filename before
# looking it up in the shared repository.
$name = $wgContLang->ucfirst($this->name);
- $dbc =& wfGetDB( DB_SLAVE, 'commons' );
+ $dbc = wfGetDB( DB_SLAVE, 'commons' );
$row = $dbc->selectRow( "`$wgSharedUploadDBname`.{$wgSharedUploadDBprefix}image",
array(
// Write to the other DB using selectDB, not database selectors
// This avoids breaking replication in MySQL
- $dbw =& wfGetDB( DB_MASTER, 'commons' );
+ $dbw = wfGetDB( DB_MASTER, 'commons' );
$dbw->selectDB( $wgSharedUploadDBname );
} else {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
}
$this->checkDBSchema($dbw);
* @public
*/
function nextHistoryLine() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$this->checkDBSchema($dbr);
function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '', $watch = false ) {
global $wgUser, $wgUseCopyrightUpload;
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$this->checkDBSchema($dbw);
wfProfileIn( __METHOD__ );
if ( $options ) {
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
} else {
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
}
$linkCache =& LinkCache::singleton();
}
# Update EXIF data in database
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$this->checkDBSchema($dbw);
$this->purgeMetadataCache();
# Update metadata in the database
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'image',
array( 'img_metadata' => $this->metadata ),
array( 'img_name' => $this->name ),
* @param $skin Skin object
*/
function useSkin( $skin ) {
- $this->mSkin =& $skin;
+ $this->mSkin = $skin;
}
/**
function getSkin() {
if( !$this->mSkin ) {
global $wgUser;
- $skin =& $wgUser->getSkin();
+ $skin = $wgUser->getSkin();
} else {
- $skin =& $this->mSkin;
+ $skin = $this->mSkin;
}
return $skin;
}
$wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'filelinks' ), wfMsg( 'imagelinks' ) ) . "\n" );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
$imagelinks = $dbr->tableName( 'imagelinks' );
static function pop() {
wfProfileIn( __METHOD__ );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
// Get a job from the slave
$row = $dbr->selectRow( 'job', '*', '', __METHOD__,
}
// Try to delete it from the master
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ );
$affected = $dbw->affectedRows();
$dbw->immediateCommit();
function insert() {
$fields = $this->insertFields();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if ( $this->removeDuplicates ) {
$res = $dbw->select( 'job', array( '1' ), $fields, __METHOD__ );
// Construct query
// This is very similar to Parser::replaceLinkHolders
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
$set = $this->constructSet( 'page', $dbr );
if ( $set === false ) {
$id = $wgMemc->get( $key = $this->getKey( $title ) );
if( ! is_integer( $id ) ) {
if ( $this->mForUpdate ) {
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
if ( !( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) ) {
$options = array( 'FOR UPDATE' );
} else {
$options = array();
}
} else {
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$options = array();
}
} else {
$threshold = $wgUser->getOption('stubthreshold') ;
if ( $threshold > 0 ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$s = $dbr->selectRow(
array( 'page' ),
array( 'page_len',
global $wgUser;
wfProfileIn( __METHOD__ );
- $sk =& $wgUser->getSkin();
+ $sk = $wgUser->getSkin();
$outText = '';
if ( count( $templates ) > 0 ) {
} else {
$this->mOptions = array( 'FOR UPDATE' );
}
- $this->mDb =& wfGetDB( DB_MASTER );
+ $this->mDb = wfGetDB( DB_MASTER );
if ( !is_object( $title ) ) {
throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
wfProfileIn( __METHOD__ );
$batchSize = 100;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'templatelinks', 'page' ),
array( 'page_namespace', 'page_title' ),
array(
global $wgUser;
$fname = 'LogPage::saveContent';
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$uid = $wgUser->getID();
$this->timestamp = $now = wfTimestampNow();
$md5_sql = pack('H32', $this->md5); # Binary packed, not hex
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->replace( 'math', array( 'math_inputhash' ),
array(
'math_inputhash' => $md5_sql,
$fname = 'MathRenderer::_recall';
$this->md5 = md5( $this->tex );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$rpage = $dbr->selectRow( 'math',
array( 'math_outputhash','math_html_conservativeness','math_html','math_mathml' ),
array( 'math_inputhash' => pack("H32", $this->md5)), # Binary packed, not hex
global $wgMaxMsgCacheEntrySize;
wfProfileIn( __METHOD__ );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$this->mCache = array();
# Load titles for all oversized pages in the MediaWiki namespace
$lb->setArray( $arr );
$lb->execute();
- $sk =& $wgUser->getSkin();
+ $sk = $wgUser->getSkin();
foreach ( $categories as $category => $unused ) {
$title = Title::makeTitleSafe( NS_CATEGORY, $category );
$text = $wgContLang->convertHtml( $title->getText() );
$groupName = User::getGroupName( $key );
$groupPage = User::getGroupPage( $key );
if( $groupPage ) {
- $skin =& $wgUser->getSkin();
+ $skin = $wgUser->getSkin();
$groups[] = '"'.$skin->makeLinkObj( $groupPage, $groupName ).'"';
} else {
$groups[] = '"'.$groupName.'"';
function getLatestId() {
if( is_null( $this->mLatestId ) ) {
$id = $this->mTitle->getArticleID();
- $db =& wfGetDB(DB_SLAVE);
+ $db = wfGetDB(DB_SLAVE);
$this->mLatestId = $db->selectField( 'page',
"page_latest",
array( 'page_id' => $id ),
function fetchRevisions($limit, $offset, $direction) {
$fname = 'PageHistory::fetchRevisions';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
if ($direction == PageHistory::DIR_PREV)
list($dirs, $oper) = array("ASC", ">=");
if ($wgUser->isAnon() || !$wgShowUpdatedMarker)
return $this->mNotificationTimestamp = false;
- $dbr =& wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_SLAVE);
$this->mNotificationTimestamp = $dbr->selectField(
'watchlist',
}
$url = wfMsg( $urlmsg, $id);
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
$la = $sk->getExternalLinkAttributes( $url, $keyword.$id );
$text = "<a href=\"{$url}\"{$la}>{$keyword} {$id}</a>";
}
$fname = 'Parser::replaceExternalLinks';
wfProfileIn( $fname );
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
$bits = preg_split( EXT_LINK_BRACKETED, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
$s = array_shift( $bits );
$i = 0;
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
while ( $i < count( $bits ) ){
$protocol = $bits[$i++];
* @private
*/
function maybeMakeExternalImage( $url ) {
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
$imagesfrom = $this->mOptions->getAllowExternalImagesFrom();
$imagesexception = !empty($imagesfrom);
$text = false;
# the % is needed to support urlencoded titles as well
if ( !$tc ) { $tc = Title::legalChars() . '#%'; }
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
#split the entire text string on occurences of [[
$a = explode( '[[', ' ' . $s );
*/
function makeKnownLinkHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
list( $inside, $trail ) = Linker::splitTrail( $trail );
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
$link = $sk->makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
return $this->armorLinks( $link ) . $trail;
}
function fetchScaryTemplateMaybeFromCache($url) {
global $wgTranscludeCacheExpiry;
- $dbr =& wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_SLAVE);
$obj = $dbr->selectRow('transcache', array('tc_time', 'tc_contents'),
array('tc_url' => $url));
if ($obj) {
if (!$text)
return wfMsg('scarytranscludefailed', $url);
- $dbw =& wfGetDB(DB_MASTER);
+ $dbw = wfGetDB(DB_MASTER);
$dbw->replace('transcache', array('tc_url'), array(
'tc_url' => $url,
'tc_time' => time(),
}
# We need this to perform operations on the HTML
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
# headline counter
$headlineCount = 0;
$pdbks = array();
$colours = array();
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
$linkCache =& LinkCache::singleton();
if ( !empty( $this->mLinkHolders['namespaces'] ) ) {
wfProfileIn( $fname.'-check' );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
$threshold = $wgUser->getOption('stubthreshold');
$alt = Sanitizer::stripAllTags( $alt );
# Linker does the rest
- $sk =& $this->mOptions->getSkin();
+ $sk = $this->mOptions->getSkin();
return $sk->makeImageLinkObj( $nt, $caption, $alt, $align, $width, $height, $framed, $thumb, $manual_thumb, $page );
}
if ( is_null( $this->mRevisionTimestamp ) ) {
wfProfileIn( __METHOD__ );
global $wgContLang;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$timestamp = $dbr->selectField( 'revision', 'rev_timestamp',
array( 'rev_id' => $this->mRevisionId ), __METHOD__ );
function getMaxIncludeSize() { return $this->mMaxIncludeSize; }
function getRemoveComments() { return $this->mRemoveComments; }
- function &getSkin() {
+ function getSkin() {
if ( !isset( $this->mSkin ) ) {
$this->mSkin = $this->mUser->getSkin();
}
global $wguname, $wgProfilePerHost;
$fname = 'Profiler::logToDB';
- $dbw = & wfGetDB(DB_MASTER);
+ $dbw = wfGetDB(DB_MASTER);
if (!is_object($dbw))
return false;
$errorState = $dbw->ignoreErrors( true );
*/
function recache( $limit, $ignoreErrors = true ) {
$fname = get_class($this) . '::recache';
- $dbw =& wfGetDB( DB_MASTER );
- $dbr =& wfGetDB( DB_SLAVE, array( $this->getName(), 'QueryPage::recache', 'vslow' ) );
+ $dbw = wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_SLAVE, array( $this->getName(), 'QueryPage::recache', 'vslow' ) );
if ( !$dbw || !$dbr ) {
return false;
}
$sname = $this->getName();
$fname = get_class($this) . '::doQuery';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$wgOut->setSyndicated( $this->isSyndicated() );
$this->feedUrl() );
$feed->outHeader();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$sql = $this->getSQL() . $this->getOrder();
$sql = $dbr->limitResult( $sql, $limit, 0 );
$res = $dbr->query( $sql, 'QueryPage::doFeed' );
* @return RecentChange
*/
public static function newFromId( $rcid ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'recentchanges', '*', array( 'rc_id' => $rcid ), __METHOD__ );
if( $res && $dbr->numRows( $res ) > 0 ) {
$row = $dbr->fetchObject( $res );
global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix;
$fname = 'RecentChange::save';
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if ( !is_array($this->mExtra) ) {
$this->mExtra = array();
}
{
$fname = 'RecentChange::markPatrolled';
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'recentchanges',
array( /* SET */
* @access public
* @static
*/
- public static function loadFromPageId( &$db, $pageid, $id = 0 ) {
+ public static function loadFromPageId( $db, $pageid, $id = 0 ) {
$conds=array('page_id=rev_page','rev_page'=>intval( $pageid ), 'page_id'=>intval( $pageid ));
if( $id ) {
$conds['rev_id']=intval($id);
* @static
*/
private static function newFromConds( $conditions ) {
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$row = Revision::loadFromConds( $db, $conditions );
if( is_null( $row ) ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$row = Revision::loadFromConds( $dbw, $conditions );
}
return $row;
* @access private
* @static
*/
- private static function loadFromConds( &$db, $conditions ) {
+ private static function loadFromConds( $db, $conditions ) {
$res = Revision::fetchFromConds( $db, $conditions );
if( $res ) {
$row = $res->fetchObject();
* @access private
* @static
*/
- private static function fetchFromConds( &$db, $conditions ) {
+ private static function fetchFromConds( $db, $conditions ) {
$res = $db->select(
array( 'page', 'revision' ),
array( 'page_namespace',
if( isset( $this->mTitle ) ) {
return $this->mTitle;
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow(
array( 'page', 'revision' ),
array( 'page_namespace', 'page_title' ),
if( !$row ) {
// Text data is immutable; check slaves first.
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'text',
array( 'old_text', 'old_flags' ),
array( 'old_id' => $this->getTextId() ),
if( !$row ) {
// Possible slave lag!
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$row = $dbw->selectRow( 'text',
array( 'old_text', 'old_flags' ),
array( 'old_id' => $this->getTextId() ),
* @param integer $id
*/
static function getTimestampFromID( $id ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$timestamp = $dbr->selectField( 'revision', 'rev_timestamp',
array( 'rev_id' => $id ), __METHOD__ );
if ( $timestamp === false ) {
# Not in slave, try master
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$timestamp = $dbw->selectField( 'revision', 'rev_timestamp',
array( 'rev_id' => $id ), __METHOD__ );
}
* @param string $text
*/
function update( $id, $title, $text ) {
- $dbw=& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->replace( 'searchindex',
array( 'si_page' ),
array(
* @param string $title
*/
function updateTitle( $id, $title ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'searchindex',
array( 'si_title' => $title ),
var $strictMatching = true;
/** @todo document */
- function SearchMySQL4( &$db ) {
- $this->db =& $db;
+ function SearchMySQL4( $db ) {
+ $this->db = $db;
}
/** @todo document */
class SearchPostgres extends SearchEngine {
- function SearchPostgres( &$db ) {
- $this->db =& $db;
+ function SearchPostgres( $db ) {
+ $this->db = $db;
}
/**
## These two functions are done automatically via triggers
function update( $pageid, $title, $text ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
## We don't want to index older revisions
$SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id = ".
"(SELECT rev_text_id FROM revision WHERE rev_page = $pageid ".
}
function update( $id, $title, $text ) {
- $dbw=& wfGetDB(DB_MASTER);
+ $dbw = wfGetDB(DB_MASTER);
$searchindex = $dbw->tableName( 'searchindex' );
$sql = "DELETE FROM $searchindex WHERE si_page={$id}";
$dbw->query($sql,"SearchTsearch2:update");
}
function updateTitle($id,$title) {
- $dbw=& wfGetDB(DB_MASTER);
- $searchindex = $dbw->tableName( 'searchindex' );
- $sql = "UPDATE $searchindex SET si_title=to_tsvector('" .
- $dbw->strencode( $title ) .
- "') WHERE si_page={$id}";
+ $dbw = wfGetDB(DB_MASTER);
+ $searchindex = $dbw->tableName( 'searchindex' );
+ $sql = "UPDATE $searchindex SET si_title=to_tsvector('" .
+ $dbw->strencode( $title ) .
+ "') WHERE si_page={$id}";
- $dbw->query( $sql, "SearchMySQL4::updateTitle" );
+ $dbw->query( $sql, "SearchMySQL4::updateTitle" );
}
}
return;
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
self::$row = $dbr->selectRow( 'site_stats', '*', false, __METHOD__ );
# This code is somewhat schema-agnostic, because I'm changing it in a minor release -- TS
static function admins() {
if ( !isset( self::$admins ) ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
self::$admins = $dbr->selectField( 'user_groups', 'COUNT(*)', array( 'ug_group' => 'sysop' ), __METHOD__ );
}
return self::$admins;
static function pagesInNs( $ns ) {
wfProfileIn( __METHOD__ );
if( !isset( self::$pageCount[$ns] ) ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$pageCount[$ns] = (int)$dbr->selectField( 'page', 'COUNT(*)', array( 'page_namespace' => $ns ), __METHOD__ );
}
wfProfileOut( __METHOD__ );
function doUpdate() {
$fname = 'SiteStatsUpdate::doUpdate';
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
# First retrieve the row just to find out which schema we're in
$row = $dbw->selectRow( 'site_stats', '*', false, $fname );
if ( isset( $row->ss_total_pages ) ) {
# Update schema if required
if ( $row->ss_total_pages == -1 && !$this->mViews ) {
- $dbr =& wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow') );
+ $dbr = wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow') );
list( $page, $user ) = $dbr->tableNamesN( 'page', 'user' );
$sql = "SELECT COUNT(page_namespace) AS total FROM $page";
* @return array of strings
* @static
*/
- static function &getSkinNames() {
+ static function getSkinNames() {
global $wgValidSkinNames;
static $skinsInitialised = false;
if ( !$skinsInitialised ) {
}
if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$watchlist = $dbr->tableName( 'watchlist' );
$sql = "SELECT COUNT(*) AS n FROM $watchlist
WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) .
}
if ($wgPageShowWatchingUsers) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$watchlist = $dbr->tableName( 'watchlist' );
$sql = "SELECT COUNT(*) AS n FROM $watchlist
WHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) .
global $wgLang, $wgContLang, $wgUser;
wfProfileIn( __METHOD__ );
- $sk =& $wgUser->getSkin();
+ $sk = $wgUser->getSkin();
$talk = $wgLang->getNsText( NS_TALK );
$input = wfElement( 'input', array(
NS_MEDIAWIKI => array(),
NS_MEDIAWIKI_TALK => array()
);
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
$sql = "SELECT page_namespace,page_title FROM $page WHERE page_namespace IN (" . NS_MEDIAWIKI . ", " . NS_MEDIAWIKI_TALK . ")";
$res = $dbr->query( $sql );
# TODO: Either make this *much* faster or cache the title index points
# in the querycache table.
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$out = "";
$where = array( 'page_namespace' => $namespace );
} else {
list( $namespace, $fromKey, $from ) = $fromList;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page',
array( 'page_namespace', 'page_title', 'page_is_redirect' ),
array(
} else {
# Get the last title from previous chunk
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res_prev = $dbr->select(
'page',
'page_title',
function getSQL() {
global $wgDBtype;
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$page = $db->tableName( 'page' );
$revision = $db->tableName( 'revision' );
#$use_index = $db->useIndexClause( 'cur_timestamp' ); # FIXME! this is gone
}
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
$sql = "SELECT 'BrokenRedirects' AS type,
function getSQL() {
$NScat = NS_CATEGORY;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$categorylinks = $dbr->tableName( 'categorylinks' );
$implicit_groupby = $dbr->implicitGroupby() ? '1' : 'cl_to';
$s= "SELECT 'Categories' as type,
function ContribsFinder( $username ) {
$this->username = $username;
$this->namespace = false;
- $this->dbr =& wfGetDB( DB_SLAVE, 'contributions' );
+ $this->dbr = wfGetDB( DB_SLAVE, 'contributions' );
}
function setNamespace( $ns ) {
* @return string an sqlquery
*/
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
return "SELECT 'Deadendpages' as type, page_namespace AS namespace, page_title as title, page_title AS value " .
"FROM $page LEFT JOIN $pagelinks ON page_id = pl_from " .
}
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$dMsgText = wfMsgForContent('disambiguationspage');
}
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $this->getSQLText( $dbr );
}
$titleA = Title::makeTitle( $result->namespace, $result->title );
if ( $result && !isset( $result->nsb ) ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$sql = $this->getSQLText( $dbr, $result->namespace, $result->title );
$res = $dbr->query( $sql, $fname );
if ( $res ) {
header( "Content-type: application/xml; charset=utf-8" );
$pages = explode( "\n", $page );
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$exporter = new WikiExporter( $db, $history );
$exporter->list_authors = $list_authors ;
$exporter->openStream();
if ( $search != '' && !$wgMiserMode ) {
$nt = Title::newFromUrl( $search );
if( $nt ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$m = $dbr->strencode( strtolower( $nt->getDBkey() ) );
$m = str_replace( "%", "\\%", $m );
$m = str_replace( "_", "\\_", $m );
}
function importOldRevision() {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
# Sneak a single revision into place
$user = User::newFromName( $this->getUser() );
* @private
*/
function importRevision( &$revision ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
return $dbw->deadlockLoop( array( &$revision, 'importOldRevision' ) );
}
function sortDescending() { return( false ); }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
$sql = "SELECT 'Listredirects' AS type, page_title AS title, page_namespace AS namespace, 0 AS value FROM $page WHERE page_is_redirect = 1";
return( $sql );
function getSQL() {
global $wgDBtype;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$user = $dbr->tableName( 'user' );
$user_groups = $dbr->tableName( 'user_groups' );
$groups = null;
if( !isset( $result->numgroups ) || $result->numgroups > 0 ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$result = $dbr->select( 'user_groups',
array( 'ug_group' ),
array( 'ug_user' => $result->user_id ),
* @param WebRequest $request For internal use use a FauxRequest object to pass arbitrary parameters.
*/
function LogReader( $request ) {
- $this->db =& wfGetDB( DB_SLAVE );
+ $this->db = wfGetDB( DB_SLAVE );
$this->setupQuery( $request );
}
*/
function LogViewer( &$reader ) {
global $wgUser;
- $this->skin =& $wgUser->getSkin();
+ $this->skin = $wgUser->getSkin();
$this->reader =& $reader;
}
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
return
}
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$image = $dbr->tableName( 'image' );
$major = $dbr->addQuotes( $this->major );
$minor = $dbr->addQuotes( $this->minor );
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' );
return
"
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$imagelinks = $dbr->tableName( 'imagelinks' );
return
"
* Note: Getting page_namespace only works if $this->isCached() is false
*/
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $pagelinks, $page ) = $dbr->tableNamesN( 'pagelinks', 'page' );
return
"SELECT 'Mostlinked' AS type,
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$categorylinks = $dbr->tableName( 'categorylinks' );
$name = $dbr->addQuotes( $this->getName() );
return
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
return
"
global $wgUser, $wgOut, $wgLang, $wgRequest, $wgGroupPermissions;
$wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$sk = $wgUser->getSkin();
$shownav = !$specialPage->including();
$hidebots = $wgRequest->getBool('hidebots',1);
function getSQL() {
global $wgUser, $wgUseRCPatrol;
$usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' );
$uwhere = $this->makeUserWhere( $dbr );
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
return
### FIXME: should complain if $fromNs != $namespace
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page',
array( 'page_namespace', 'page_title', 'page_is_redirect' ),
# interpolation and sprintf() can muck up with locale-specific decimal separator
$randstr = wfRandom();
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$use_index = $db->useIndexClause( 'page_random' );
$page = $db->tableName( 'page' );
# Same logic as RandomPage
$randstr = wfRandom();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$use_index = $dbr->useIndexClause( 'page_random' );
$page = $dbr->tableName( 'page' );
# Database connection and caching
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $recentchanges, $watchlist ) = $dbr->tableNamesN( 'recentchanges', 'watchlist' );
}
list( $limit, /* offset */ ) = wfCheckLimits( 100, 'rclimit' );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
$hideminor = ($hideminor ? 1 : 0);
wfProfileOut( $fname );
return "<!-- Broken link in search result -->\n";
}
- $sk =& $wgUser->getSkin();
+ $sk = $wgUser->getSkin();
$contextlines = $wgUser->getOption( 'contextlines', 5 );
$contextchars = $wgUser->getOption( 'contextchars', 50 );
}
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$page = $dbr->tableName( 'page' );
$name = $dbr->addQuotes( $this->getName() );
$action = $wgRequest->getVal( 'action' );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$views = SiteStats::views();
$edits = SiteStats::edits();
$res = $dbr->query( $sql, $fname );
if( $res ) {
$wgOut->addHtml( '<h2>' . wfMsgHtml( 'statistics-mostpopular' ) . '</h2>' );
- $skin =& $wgUser->getSkin();
+ $skin = $wgUser->getSkin();
$wgOut->addHtml( '<ol>' );
while( $row = $dbr->fetchObject( $res ) ) {
$link = $skin->makeKnownLinkObj( Title::makeTitleSafe( $row->page_namespace, $row->page_title ) );
}
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
$ns = NS_IMAGE;
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
$name = $dbr->addQuotes( $this->getName() );
function getSQL() {
$NScat = NS_CATEGORY;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
return "SELECT 'Unusedcategories' as type,
{$NScat} as namespace, page_title as title, page_title as value
function getSQL() {
global $wgCountCategorizedImagesAsUsed;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
if ( $wgCountCategorizedImagesAsUsed ) {
list( $page, $image, $imagelinks, $categorylinks ) = $dbr->tableNamesN( 'page', 'image', 'imagelinks', 'categorylinks' );
function sortDescending() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
$sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
page_namespace AS namespace, 0 AS value
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $page, $watchlist ) = $dbr->tableNamesN( 'page', 'watchlist' );
$mwns = NS_MEDIAWIKI;
return
global $wgUploadSizeWarning;
if ( $wgUploadSizeWarning && ( $this->mUploadSize > $wgUploadSizeWarning ) ) {
- $skin =& $wgUser->getSkin();
+ $skin = $wgUser->getSkin();
$wsize = $skin->formatSize( $wgUploadSizeWarning );
$asize = $skin->formatSize( $this->mUploadSize );
$warning .= '<li>' . wfMsgHtml( 'large-file', $wsize, $asize ) . '</li>';
$attr[] = 'type=signup';
if( $this->mReturnTo )
$attr[] = 'returnto=' . $this->mReturnTo;
- $skin =& $wgUser->getSkin();
+ $skin = $wgUser->getSkin();
return $skin->makeKnownLinkObj( $self, htmlspecialchars( $text ), implode( '&', $attr ) );
}
}
*/
function MediaWikiCredits() {
$version = self::getVersion();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$ret =
"__NOTOC__
function isSyndicated() { return false; }
function getSQL() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
$name = $dbr->addQuotes( $this->getName() );
return
function getSQL() {
global $wgWantedPagesThreshold;
$count = $wgWantedPagesThreshold - 1;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$pagelinks = $dbr->tableName( 'pagelinks' );
$page = $dbr->tableName( 'page' );
return
global $wgEnotifWatchlist;
$fname = 'wfSpecialWatchlist';
- $skin =& $wgUser->getSkin();
+ $skin = $wgUser->getSkin();
$specialTitle = SpecialPage::getTitleFor( 'Watchlist' );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->addHTML( "</p>\n<p>" . wfMsg( 'wldone' ) . "</p>\n" );
}
- $dbr =& wfGetDB( DB_SLAVE, 'watchlist' );
+ $dbr = wfGetDB( DB_SLAVE, 'watchlist' );
list( $page, $watchlist, $recentchanges ) = $dbr->tableNamesN( 'page', 'watchlist', 'recentchanges' );
$sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_user=$uid";
* @return integer
*/
function wlCountItems( &$user, $talk = true ) {
- $dbr =& wfGetDB( DB_SLAVE, 'watchlist' );
+ $dbr = wfGetDB( DB_SLAVE, 'watchlist' );
# Fetch the raw count
$res = $dbr->select( 'watchlist', 'COUNT(*) AS count', array( 'wl_user' => $user->mId ), 'wlCountItems' );
# See if we're clearing or confirming
if( $request->wasPosted() && $wgUser->matchEditToken( $request->getText( 'token' ), 'clearwatchlist' ) ) {
# Clearing, so do it and report the result
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'watchlist', array( 'wl_user' => $wgUser->mId ), 'wlHandleClear' );
$out->addWikiText( wfMsgExt( 'watchlistcleardone', array( 'parsemag', 'escape'), $wgLang->formatNum( $count ) ) );
$out->returnToMain();
function WhatLinksHerePage( &$request, $par = null ) {
global $wgUser;
$this->request =& $request;
- $this->skin =& $wgUser->getSkin();
+ $this->skin = $wgUser->getSkin();
$this->par = $par;
}
global $wgOut;
$fname = 'WhatLinksHerePage::showIndirectLinks';
- $dbr =& wfGetDB( DB_READ );
+ $dbr = wfGetDB( DB_READ );
// Some extra validation
$from = intval( $from );
wfProfileIn( $fname );
# Get a list of URLs linking to this page
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'links', 'page' ),
array( 'page_namespace', 'page_title' ),
array(
*/
public static function newFromID( $id ) {
$fname = 'Title::newFromID';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'page', array( 'page_namespace', 'page_title' ),
array( 'page_id' => $id ), $fname );
if ( $row !== false ) {
* Make an array of titles from an array of IDs
*/
function newFromIDs( $ids ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page', array( 'page_namespace', 'page_title' ),
'page_id IN (' . $dbr->makeList( $ids ) . ')', __METHOD__ );
*/
function nameOf( $id ) {
$fname = 'Title::nameOf';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$s = $dbr->selectRow( 'page', array( 'page_namespace','page_title' ), array( 'page_id' => $id ), $fname );
if ( $s === false ) { return NULL; }
return $s->iw_url;
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'interwiki',
array( 'iw_url', 'iw_local', 'iw_trans' ),
array( 'iw_prefix' => $key ), $fname );
if ( count( $titles ) == 0 ) {
return;
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if ( $timestamp == '' ) {
$timestamp = $dbw->timestamp();
}
wfProfileIn( __METHOD__ );
- $dbr =& wfGetDb( DB_SLAVE );
+ $dbr = wfGetDb( DB_SLAVE );
if ( $this->getNamespace() == NS_IMAGE ) {
$tables = array ('imagelinks', 'page_restrictions');
* @access public
*/
function loadRestrictionsFromRow( $res, $oldFashionedRestrictions = NULL ) {
- $dbr =& wfGetDb( DB_SLAVE );
+ $dbr = wfGetDb( DB_SLAVE );
$this->mRestrictions['edit'] = array();
$this->mRestrictions['move'] = array();
function loadRestrictions( $oldFashionedRestrictions = NULL ) {
if( !$this->mRestrictionsLoaded ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'page_restrictions', '*',
array ( 'pr_page' => $this->getArticleId() ), __METHOD__ );
if ( $this->getNamespace() < 0 ) {
$n = 0;
} else {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$n = $dbr->selectField( 'archive', 'COUNT(*)', array( 'ar_namespace' => $this->getNamespace(),
'ar_title' => $this->getDBkey() ), $fname );
if( $this->getNamespace() == NS_IMAGE ) {
if ($this->mLatestID !== false)
return $this->mLatestID;
- $db =& wfGetDB(DB_SLAVE);
+ $db = wfGetDB(DB_SLAVE);
return $this->mLatestID = $db->selectField( 'revision',
"max(rev_id)",
array('rev_page' => $this->getArticleID()),
return;
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$success = $dbw->update( 'page',
array( /* SET */
'page_touched' => $dbw->timestamp()
$linkCache =& LinkCache::singleton();
if ( $options ) {
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
} else {
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
}
$res = $db->select( array( 'page', $table ),
*/
function getBrokenLinksFrom( $options = '' ) {
if ( $options ) {
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
} else {
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
}
$res = $db->safeQuery(
$redirid = $this->getArticleID();
# Fixing category links (those without piped 'alternate' names) to be sorted under the new title
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$categorylinks = $dbw->tableName( 'categorylinks' );
$sql = "UPDATE $categorylinks SET cl_sortkey=" . $dbw->addQuotes( $nt->getPrefixedText() ) .
" WHERE cl_from=" . $dbw->addQuotes( $pageid ) .
$now = wfTimestampNow();
$newid = $nt->getArticleID();
$oldid = $this->getArticleID();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$linkCache =& LinkCache::singleton();
# Delete the old redirect. We don't save it to history since
$newid = $nt->getArticleID();
$oldid = $this->getArticleID();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$now = $dbw->timestamp();
$linkCache =& LinkCache::singleton();
function isValidMoveTarget( $nt ) {
$fname = 'Title::isValidMoveTarget';
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
# Is it a redirect?
$id = $nt->getArticleID();
global $wgContLang;
$titlekey = $this->getArticleId();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$categorylinks = $dbr->tableName( 'categorylinks' );
# NEW SQL
* @return integer $oldrevision|false
*/
function getPreviousRevisionID( $revision ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $dbr->selectField( 'revision', 'rev_id',
'rev_page=' . intval( $this->getArticleId() ) .
' AND rev_id<' . intval( $revision ) . ' ORDER BY rev_id DESC' );
* @return integer $oldrevision|false
*/
function getNextRevisionID( $revision ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $dbr->selectField( 'revision', 'rev_id',
'rev_page=' . intval( $this->getArticleId() ) .
' AND rev_id>' . intval( $revision ) . ' ORDER BY rev_id' );
* @return integer Number of revisions between these IDs.
*/
function countRevisionsBetween( $old, $new ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $dbr->selectField( 'revision', 'count(*)',
'rev_page = ' . intval( $this->getArticleId() ) .
' AND rev_id > ' . intval( $old ) .
* Get the last touched timestamp
*/
function getTouched() {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$touched = $dbr->selectField( 'page', 'page_touched',
array(
'page_namespace' => $this->getNamespace(),
* @static
*/
static function newFromConfirmationCode( $code ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$id = $dbr->selectField( 'user', 'user_id', array(
'user_email_token' => md5( $code ),
'user_email_token_expires > ' . $dbr->addQuotes( $dbr->timestamp() ),
* @static
*/
static function whoIs( $id ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $dbr->selectField( 'user', 'user_name', array( 'user_id' => $id ), 'User::whoIs' );
}
* @static
*/
static function whoIsReal( $id ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $dbr->selectField( 'user', 'user_real_name', array( 'user_id' => $id ), 'User::whoIsReal' );
}
# Illegal name
return null;
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$s = $dbr->selectRow( 'user', array( 'user_id' ), array( 'user_name' => $nt->getText() ), __METHOD__ );
if ( $s === false ) {
*/
static function edits( $uid ) {
wfProfileIn( __METHOD__ );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
// check if the user_editcount field has been initialized
$field = $dbr->selectField(
);
if( $field === null ) { // it has not been initialized. do so.
- $dbw =& wfGetDb( DB_MASTER );
+ $dbw = wfGetDb( DB_MASTER );
$count = $dbr->selectField(
'revision', 'count(*)',
array( 'rev_user' => $uid ),
return false;
}
- $dbr =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_MASTER );
$s = $dbr->selectRow( 'user', '*', array( 'user_id' => $this->mId ), __METHOD__ );
if ( $s !== false ) {
* @private
*/
function checkNewtalk( $field, $id ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$ok = $dbr->selectField( 'user_newtalk', $field,
array( $field => $id ), __METHOD__ );
return $ok !== false;
wfDebug( __METHOD__." already set ($field, $id), ignoring\n" );
return false;
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->insert( 'user_newtalk',
array( $field => $id ),
__METHOD__,
wfDebug( __METHOD__.": already gone ($field, $id), ignoring\n" );
return false;
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'user_newtalk',
array( $field => $id ),
__METHOD__ );
if( $this->mId ) {
$this->mTouched = self::newTouchedTimestamp();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'user',
array( 'user_touched' => $dbw->timestamp( $this->mTouched ) ),
array( 'user_id' => $this->mId ),
*/
function addGroup( $group ) {
$this->load();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if( $this->getId() ) {
$dbw->insert( 'user_groups',
array(
*/
function removeGroup( $group ) {
$this->load();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'user_groups',
array(
'ug_user' => $this->getID(),
// If the page is watched by the user (or may be watched), update the timestamp on any
// any matching rows
if ( $watched ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'watchlist',
array( /* SET */
'wl_notificationtimestamp' => NULL
}
if( $currentUser != 0 ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'watchlist',
array( /* SET */
'wl_notificationtimestamp' => NULL
$this->mTouched = self::newTouchedTimestamp();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'user',
array( /* SET */
'user_name' => $this->mName,
$s = trim( $this->getName() );
if ( 0 == strcmp( '', $s ) ) return 0;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$id = $dbr->selectField( 'user', 'user_id', array( 'user_name' => $s ), __METHOD__ );
if ( $id === false ) {
$id = 0;
$user->mOptions = $params['options'] + $user->mOptions;
unset( $params['options'] );
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' );
$fields = array(
'user_id' => $seqVal,
*/
function addToDatabase() {
$this->load();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' );
$dbw->insert( 'user',
array(
if ( isset( $res ) )
return $res;
else {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $res = $dbr->selectField( 'user', 'max(user_id)', false, 'User::getMaxID' );
}
}
$token = $this->generateToken( $this->mId . $this->mEmail . $expires );
$hash = md5( $token );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'user',
array( 'user_email_token' => $hash,
'user_email_token_expires' => $dbw->timestamp( $expires ) ),
$userCondition = false;
}
if( $userCondition ) {
- $dbr =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_MASTER );
$res = $dbr->select( 'watchlist', array( 'wl_user' ),
array(
if ( $wgShowUpdatedMarker || $wgEnotifWatchlist ) {
# mark the changed watch-listed page with a timestamp, so that the page is
# listed with an "updated since your last visit" icon in the watch list, ...
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$success = $dbw->update( 'watchlist',
array( /* SET */
'wl_notificationtimestamp' => $dbw->timestamp($timestamp)
# remember that talk namespaces are numbered as page namespace+1.
$fname = 'WatchedItem::isWatched';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'watchlist', 1, array( 'wl_user' => $this->id, 'wl_namespace' => $this->ns,
'wl_title' => $this->ti ), $fname );
$iswatched = ($dbr->numRows( $res ) > 0) ? 1 : 0;
// Use INSERT IGNORE to avoid overwriting the notification timestamp
// if there's already an entry for this page
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->insert( 'watchlist',
array(
'wl_user' => $this->id,
$fname = 'WatchedItem::removeWatch';
$success = false;
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'watchlist',
array(
'wl_user' => $this->id,
$oldtitle = $ot->getDBkey();
$newtitle = $nt->getDBkey();
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$res = $dbw->select( 'watchlist', 'wl_user',
array( 'wl_namespace' => $oldnamespace, 'wl_title' => $oldtitle ),
$fname, 'FOR UPDATE'
if( $action == 'view' && !$request->getVal( 'oldid' ) &&
$request->getVal( 'redirect' ) != 'no' ) {
- $dbr =& wfGetDB(DB_SLAVE);
+ $dbr = wfGetDB(DB_SLAVE);
$article->loadPageData($article->pageDataFromTitle($dbr, $title));
/* Follow redirects only for... redirects */
*/
function doUpdates ( &$updates ) {
wfProfileIn( 'MediaWiki::doUpdates' );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
foreach( $updates as $up ) {
$up->doUpdate();
if($linkBatch->isEmpty())
return;
- $db = & $this->getDB();
+ $db = $this->getDB();
$set = $linkBatch->constructSet('page', $db);
// Get pageIDs data from the `page` table
'page_id' => $pageids
);
- $db = & $this->getDB();
+ $db = $this->getDB();
// Get pageIDs data from the `page` table
$this->profileDBIn();
if(empty($revids))
return;
- $db = & $this->getDB();
+ $db = $this->getDB();
$pageids = array();
$remaining = array_flip($revids);
private function resolvePendingRedirects() {
if($this->mResolveRedirects) {
- $db = & $this->getDB();
+ $db = $this->getDB();
$pageFlds = $this->getPageTableFields();
// Repeat until all redirects have been resolved
private function getRedirectTargets() {
$linkBatch = new LinkBatch();
- $db = & $this->getDB();
+ $db = $this->getDB();
// find redirect targets for all redirect pages
$this->profileDBIn();
$this->mAllowedGenerators = array_merge($this->mListModuleNames, $this->mPropModuleNames);
}
- public function & getDB() {
+ public function getDB() {
if (!isset ($this->mSlaveDB)) {
$this->profileDBIn();
- $this->mSlaveDB = & wfGetDB(DB_SLAVE);
+ $this->mSlaveDB = wfGetDB(DB_SLAVE);
$this->profileDBOut();
}
return $this->mSlaveDB;
private function run($resultPageSet = null) {
wfProfileIn($this->getModuleProfileName() . '-getDB');
- $db = & $this->getDB();
+ $db = $this->getDB();
wfProfileOut($this->getModuleProfileName() . '-getDB');
wfProfileIn($this->getModuleProfileName() . '-parseParams');
if ($redirect)
$this->addWhereFld('page_is_redirect', 0);
- $db = & $this->getDB();
+ $db = $this->getDB();
if (!is_null($continue)) {
$plfrm = intval($this->contID);
if ($this->contLevel == 0) {
$limit = $type = $start = $end = $dir = $user = $title = null;
extract($this->extractRequestParams());
- $db = & $this->getDB();
+ $db = $this->getDB();
list($tbl_logging, $tbl_page, $tbl_user) = $db->tableNamesN('logging', 'page', 'user');
$data = array ();
$count = 0;
- $db = & $this->getDB();
+ $db = $this->getDB();
$res = $this->select(__METHOD__);
while ($row = $db->fetchObject($res)) {
if (++ $count > $limit) {
$count = 0;
$res = $this->select(__METHOD__);
- $db = & $this->getDB();
+ $db = $this->getDB();
while ($row = $db->fetchObject($res)) {
if (++ $count > $limit) {
extract($this->extractRequestParams());
//Get a database instance
- $db = & $this->getDB();
+ $db = $this->getDB();
if (is_null($user))
$this->dieUsage("User parameter may not be empty", 'param_user');
// Try $wgDatabase, which is used in the install and update scripts
global $wgDatabase;
if ( isset( $wgDatabase ) ) {
- $db =& $wgDatabase;
+ $db = $wgDatabase;
} else {
// No? Well, we must be outside of those scripts, so use the standard method
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
}
}
$error = $db->sourceFile( $fname );
# Obsolete, use Database::fieldExists()
function field_exists( $table, $field ) {
$fname = 'Update script: field_exists';
- $db =& wfGetDB( DB_SLAVE );
+ $db = wfGetDB( DB_SLAVE );
$res = $db->query( "DESCRIBE $table", $fname );
$found = false;
$name = $wgLanguageNames[$lang];
- $dbw =& wfGetDB( DB_WRITE );
+ $dbw = wfGetDB( DB_WRITE );
$common = "/home/wikipedia/common";
$maintenance = "$IP/maintenance";
$fname = 'attachLatest';
echo "Looking for pages with page_latest set to 0...\n";
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
$result = $dbw->select( 'page',
array( 'page_id', 'page_namespace', 'page_title' ),
array( 'page_latest' => 0 ),
$source = $args[0];
$dest = $args[1];
-$dbr =& wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'page', 'revision','user' ));
$eSource = $dbr->strencode( $source );
$eDest = $dbr->strencode( $dest );
$table = ($history == WikiExporter::CURRENT) ? 'page' : 'revision';
$field = ($history == WikiExporter::CURRENT) ? 'page_id' : 'rev_id';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$this->maxCount = $dbr->selectField( $table, "MAX($field)", '', 'BackupDumper::dump' );
$this->startTime = wfTime();
}
$this->user = User::newFromName( $user );
$this->password = $password;
- $this->dbw =& wfGetDB( DB_MASTER );
+ $this->dbw = wfGetDB( DB_MASTER );
}
function main() {
function main() {
$fname = 'checkUsernames::main';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'user',
array( 'user_id', 'user_name' ),
*/
function fixDupes( $fixthem = false) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$cur = $dbw->tableName( 'cur' );
$old = $dbw->tableName( 'old' );
$dbw->query( "LOCK TABLES $cur WRITE, $old WRITE" );
}
function checkDupes( $fixthem = false, $indexonly = false ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if( $dbw->indexExists( 'cur', 'name_title' ) &&
$dbw->indexUnique( 'cur', 'name_title' ) ) {
echo wfWikiID().": cur table has the current unique index; no duplicate entries.\n";
// This happens e.g. when a link comes from a template rather than the page itself
print "False match\n";
} else {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->immediateBegin();
if ( !$rev ) {
// Didn't find a non-spammy revision, blank the page
exit(1);
}
-$dbr =& wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_SLAVE );
if ( $options['all'] ) {
// Clean up spam on all wikis
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
print "Finding spam on " . count($wgLocalDatabases) . " wikis\n";
$found = false;
foreach ( $wgLocalDatabases as $db ) {
$this->log( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')" );
} else {
$this->log( "renaming $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')" );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'page',
array( 'page_title' => $dest ),
array( 'page_id' => $row->page_id ),
$this->log( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')" );
} else {
$this->log( "renaming $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')" );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'page',
array(
'page_namespace' => $ns,
function removeWatch( $row ) {
if( !$this->dryrun) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'watchlist', array(
'wl_user' => $row->wl_user,
'wl_namespace' => $row->wl_namespace,
/** */
require_once('commandLine.inc');
-$dbr =& wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'interwiki', array( 'iw_prefix' ), false );
$prefixes = array();
while ( $row = $dbr->fetchObject( $res ) ) {
$perfLogFilename = "convLinksPerf.txt";
#--------------------------------------------------------------------
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
list ($cur, $links, $links_temp, $links_backup) = $dbw->tableNamesN( 'cur', 'links', 'links_temp', 'links_backup' );
$res = $dbw->query( "SELECT l_from FROM $links LIMIT 1" );
exit;
}
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
for ( $linenum = 1; !feof( $file ); $linenum++ ) {
$line = trim( fgets( $file ) );
$wgUser = User::newFromName( $user );
$wgUser->addGroup( 'bot' );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'page', 'revision' ),
array( 'page_namespace', 'page_title' ),
array(
)
);
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
while ( $row = $dbr->fetchObject( $res ) ) {
if ( function_exists( 'wfWaitForSlaves' ) ) {
ini_set( 'display_errors', false );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'image',
array( 'img_name' ),
function getImageCount() {
$fname = 'DeleteImageCache::getImageCount';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
return $dbr->selectField( 'image', 'COUNT(*)', array(), $fname );
}
}
function DeleteOldRevisions( $delete = false ) {
# Data should come off the master, wrapped in a transaction
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$tbl_pag = $dbw->tableName( 'page' );
$report = isset( $options['report'] );
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
$dbw->immediateBegin();
extract( $dbw->tableNames( 'page', 'revision' ) );
<?php
require_once( 'commandLine.inc' );
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
if ( count( $args ) == 0 ) {
echo "Usage: php deleteRevision.php <revid> [<revid> ...]\n";
function doLocalImageDescriptions() {
$chunkSize = 1000;
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$cp = $this->getCheckpoint( 'local image' );
if ( $cp == 'done' ) {
$chunkSize = 1000;
$this->setupGlobals();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$cp = $this->getCheckpoint( 'category' );
if ( $cp == 'done' ) {
}
$this->setupGlobals();
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$i = 0;
for ( $chunkStart = $start; $chunkStart <= $end; $chunkStart += $chunkSize ) {
function getMaxPageID() {
if ( $this->maxPageID === false ) {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$this->maxPageID = $dbr->selectField( 'page', 'max(page_id)', false, __METHOD__ );
}
return $this->maxPageID;
if ( !empty( $options['e'] ) ) {
$end = $options['e'];
} else {
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$end = $dbr->selectField( 'page', 'max(page_id)', false );
}
$wgHTMLDump->doSharedImageDescriptions();
} else {
print "Creating static HTML dump in directory $dest. \n";
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$server = $dbr->getProperty( 'mServer' );
print "Using database {$server}\n";
require_once 'commandLine.inc';
-$dbr =& wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_SLAVE );
$result = $dbr->select( array( 'pagelinks', 'page' ),
array(
'page_id',
/** */
function dumpReplayLog( $start ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$recentchanges = $dbw->tableName( 'recentchanges' );
$result =& $dbw->safeQuery( "SELECT * FROM $recentchanges WHERE rc_timestamp >= "
. $dbw->timestamp( $start ) . ' ORDER BY rc_timestamp');
case RC_EDIT:
case RC_NEW:
# Edit
- $dbr =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_MASTER );
$out = " <edit>\n";
$out .= " <title>" . xmlsafe( $title->getPrefixedText() ) . "</title>\n";
$out .= " </edit>\n";
break;
case RC_LOG:
- $dbr =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_MASTER );
$s = $dbr->selectRow( 'logging',
array( 'log_type', 'log_action', 'log_timestamp', 'log_user',
'log_namespace', 'log_title', 'log_comment' ),
if ( isset( $args[0] ) ) {
desyncFixPage( $args[0] );
} else {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$maxPage = $dbw->selectField( 'page', 'MAX(page_id)', false, 'fixDesync.php' );
$corrupt = findPageLatestCorruption();
foreach ( $corrupt as $id => $dummy ) {
function findPageLatestCorruption() {
$desync = array();
$n = 0;
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$masterIDs = array();
$res = $dbw->select( 'page', array( 'page_id', 'page_latest' ), array( 'page_id<6054123' ), __METHOD__ );
print "Number of pages: " . $dbw->numRows( $res ) . "\n";
global $slaveIndexes;
foreach ( $slaveIndexes as $i ) {
- $db =& wfGetDB( $i );
+ $db = wfGetDB( $i );
$res = $db->select( 'page', array( 'page_id', 'page_latest' ), array( 'page_id<6054123' ), __METHOD__ );
while ( $row = $db->fetchObject( $res ) ) {
if ( isset( $masterIDs[$row->page_id] ) && $masterIDs[$row->page_id] != $row->page_latest ) {
$fname = 'desyncFixPage';
# Check for a corrupted page_latest
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$realLatest = $dbw->selectField( 'page', 'page_latest', array( 'page_id' => $pageID ),
$fname, 'FOR UPDATE' );
#list( $masterFile, $masterPos ) = $dbw->getMasterPos();
$found = false;
foreach ( $slaveIndexes as $i ) {
- $db =& wfGetDB( $i );
+ $db = wfGetDB( $i );
/*
if ( !$db->masterPosWait( $masterFile, $masterPos, 10 ) ) {
echo "Slave is too lagged, aborting\n";
}
} else {
foreach ( $slaveIndexes as $i ) {
- $db =& wfGetDB( $i );
+ $db = wfGetDB( $i );
$db->insert( 'revision', get_object_vars( $row ), $fname, 'IGNORE' );
}
}
$dbw->insert( 'text', get_object_vars( $row ), $fname, 'IGNORE' );
} else {
foreach ( $slaveIndexes as $i ) {
- $db =& wfGetDB( $i );
+ $db = wfGetDB( $i );
$db->insert( 'text', get_object_vars( $row ), $fname, 'IGNORE' );
}
}
#$dbw->update( 'page', array( 'page_latest' => $realLatest ), array( 'page_id' => $pageID ), $fname );
} else {
foreach ( $slaveIndexes as $i ) {
- $db =& wfGetDB( $i );
+ $db = wfGetDB( $i );
$db->update( 'page', array( 'page_latest' => $realLatest ), array( 'page_id' => $pageID ), $fname );
}
}
$grace = 60; // maximum normal clock offset
# Find bounding revision IDs
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
$revisionTable = $dbw->tableName( 'revision' );
$res = $dbw->query( "SELECT MIN(rev_id) as minrev, MAX(rev_id) as maxrev FROM $revisionTable " .
"WHERE rev_timestamp BETWEEN '{$start}' AND '{$end}'", $fname );
$fname = 'fixUserRegistration.php';
-$dbr =& wfGetDB( DB_SLAVE );
-$dbw =& wfGetDB( DB_MASTER );
+$dbr = wfGetDB( DB_SLAVE );
+$dbw = wfGetDB( DB_MASTER );
// Get user IDs which need fixing
$res = $dbr->select( 'user', 'user_id', 'user_registration IS NULL', $fname );
$this->compress = $compress;
$this->stderr = fopen( 'php://stderr', 'wt' );
- $this->dbr =& wfGetDB( DB_SLAVE );
+ $this->dbr = wfGetDB( DB_SLAVE );
$this->generateNamespaces();
$this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() );
$this->findex = fopen( "{$this->fspath}sitemap-index-" . wfWikiID() . ".xml", 'wb' );
function LogImporter( $type ) {
$this->type = $type;
- $this->db =& wfGetDB( DB_MASTER );
+ $this->db = wfGetDB( DB_MASTER );
$this->actions = $this->setupActions();
}
exit;
}
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
for ( $linenum = 1; !feof( $file ); $linenum++ ) {
$line = fgets( $file );
$suffix = isset( $options['suffix'] ) ? $options['suffix'] : '';
$prefix = isset( $options['prefix'] ) ? $options['prefix'] : '';
$key = isset( $options['key'] ) ? intval( $options['key'] ) : 0;
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
$duper = new NamespaceConflictChecker( $dbw );
if( $prefix ) {
function NukeNS($ns_no, $delete) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$tbl_pag = $dbw->tableName( 'page' );
function NukePage( $name, $delete = false ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$tbl_pag = $dbw->tableName( 'page' );
function DeleteRevisions( $ids ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$tbl_rev = $dbw->tableName( 'revision' );
# ------
function checkOrphans( $fix ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$page = $dbw->tableName( 'page' );
$revision = $dbw->tableName( 'revision' );
* but valid revisions do exist)
*/
function checkWidows( $fix ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$page = $dbw->tableName( 'page' );
$revision = $dbw->tableName( 'revision' );
function checkSeparation( $fix ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$page = $dbw->tableName( 'page' );
$revision = $dbw->tableName( 'revision' );
$text = $dbw->tableName( 'text' );
$data[$section] .= $line;
}
}
- print "\n";
+ if ( $this->showProgress ) {
+ print "\n";
+ }
return $ok;
}
*/
function setupGlobals($opts = '') {
# Save the prefixed / quoted table names for later use when we make the temporaries.
- $db =& wfGetDB( DB_READ );
+ $db = wfGetDB( DB_READ );
$this->oldTableNames = array();
foreach( $this->listTables() as $table ) {
$this->oldTableNames[$table] = $db->tableName( $table );
if (!$setupDB && $wgDBprefix === 'parsertest_') {
# oh teh horror
$GLOBALS['wgLoadBalancer'] = LoadBalancer::newFromParams( $GLOBALS['wgDBservers'] );
- $db =& wfGetDB( DB_MASTER );
+ $db = wfGetDB( DB_MASTER );
$tables = $this->listTables();
$differences = $this->compareResult( $before, $after );
if( $differences ) {
$count = count($differences);
- printf( "%4d %s\n", $count, $label );
+ printf( "\n%4d %s\n", $count, $label );
foreach ($differences as $differing_test_name) {
print " * $differing_test_name\n";
}
function PurgeRedundantText( $delete = false ) {
# Data should come off the master, wrapped in a transaction
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->begin();
$tbl_arc = $dbw->tableName( 'archive' );
* @return integer Number of entries changed, or that would be changed
*/
function reassignEdits( &$from, &$to, $rc = false, $report = false ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->immediateBegin();
$fname = 'reassignEdits';
} else {
$sql .= ",\n";
}
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$sql .= "(" . $dbr->makeList( $entry ) . ")";
return $sql;
}
function rebuildRecentChangesTablePass1()
{
$fname = 'rebuildRecentChangesTablePass1';
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
extract( $dbw->tableNames( 'recentchanges', 'cur', 'old' ) );
$dbw->delete( 'recentchanges', '*' );
function rebuildRecentChangesTablePass2()
{
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
list ($recentchanges, $revision) = $dbw->tableNamesN( 'recentchanges', 'revision' );
print( "Updating links...\n" );
require_once( "commandLine.inc" );
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
// Load the current value from the master
$count = $dbw->selectField( 'site_stats', 'ss_images' );
global $wgUser, $wgParser, $wgUseImageResize, $wgUseTidy;
$fname = 'refreshLinks';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$start = intval( $start );
# Don't generate TeX PNGs (lack of a sensible current directory causes errors anyway)
global $wgTitle, $wgParser;
$wgTitle = Title::newFromID( $id );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$linkCache =& LinkCache::singleton();
$linkCache->clear();
wfWaitForSlaves( $maxLag );
- $dbw =& wfGetDB( DB_WRITE );
+ $dbw = wfGetDB( DB_WRITE );
$linksTables = array(
'pagelinks' => 'pl_from',
* @return bool
*/
function isInactiveAccount( $id, $master = false ) {
- $dbo =& wfGetDB( $master ? DB_MASTER : DB_SLAVE );
+ $dbo = wfGetDB( $master ? DB_MASTER : DB_SLAVE );
$fname = 'isInactiveAccount';
$checks = array( 'revision' => 'rev', 'archive' => 'ar', 'logging' => 'log',
'image' => 'img', 'oldimage' => 'oi' );
# Do an initial scan for inactive accounts and report the result
echo( "Checking for unused user accounts...\n" );
$del = array();
-$dbr =& wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'user', array( 'user_id', 'user_name' ), '', $fname );
while( $row = $dbr->fetchObject( $res ) ) {
# Check the account, but ignore it if it's the primary administrator
# If required, go back and delete each marked account
if( $count > 0 && isset( $options['delete'] ) ) {
echo( "\nDeleting inactive accounts..." );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'user', array( 'user_id' => $del ), $fname );
echo( "done.\n" );
# Update the site_stats.ss_users field
$wgTitle = Title::newFromText( 'RunJobs.php' );
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
$n = 0;
while ( $dbw->selectField( 'job', 'count(*)', '', 'runJobs.php' ) ) {
while ( false != ($job = Job::pop()) ) {
// Trigger errors on inappropriate use of $wgTitle
$wgTitle = new FakeTitle;
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
$count = $dbw->selectField( 'job', 'count(*)', '', 'runJobs.php' );
print $count."\n";
);
// Get cached stats from slave database
-$dbr =& wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_SLAVE );
$fname = 'showStats';
$stats = $dbr->selectRow( 'site_stats', '*', '' );
function check( $fix = false, $xml = '' ) {
$fname = 'checkStorage';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
if ( $fix ) {
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
print "Checking, will fix errors if possible...\n";
} else {
print "Checking...\n";
return;
}
- $dbr =& wfGetDB( DB_SLAVE );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_SLAVE );
+ $dbw = wfGetDB( DB_MASTER );
$dbr->ping();
$dbw->ping();
}
// Find text row again
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$oldId = $dbr->selectField( 'revision', 'rev_text_id', array( 'rev_id' => $id ), $fname );
if ( !$oldId ) {
echo "Missing revision row for rev_id $id\n";
$flags = Revision::compressRevisionText( $text );
// Update the text row
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'text',
array( 'old_flags' => $flags, 'old_text' => $text ),
array( 'old_id' => $oldId ),
$chunksize = 50;
print "Starting from old_id $start...\n";
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
do {
$res = $dbw->select( 'text', array( 'old_id','old_flags','old_namespace','old_title','old_text' ),
"old_id>=$start", $fname, array( 'ORDER BY' => 'old_id', 'LIMIT' => $chunksize, 'FOR UPDATE' ) );
#print "Already compressed row {$row->old_id}\n";
return false;
}
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$flags = $row->old_flags ? "{$row->old_flags},gzip" : "gzip";
$compress = gzdeflate( $row->old_text );
$fname = 'compressWithConcat';
$loadStyle = LS_CHUNKED;
- $dbr =& wfGetDB( DB_SLAVE );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_SLAVE );
+ $dbw = wfGetDB( DB_MASTER );
# Set up external storage
if ( $extdb != '' ) {
<?php
require_once( 'commandLine.inc' );
-$dbr =& wfGetDB( DB_SLAVE );
+$dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'old', array( 'old_flags', 'old_text' ), array( 'old_id' => $args[0] ) );
$obj = unserialize( $row->old_text );
var_dump( $obj );
}
-?>
+?>
\ No newline at end of file
}
$cluster = $args[0];
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
if ( isset( $options['e'] ) ) {
$maxID = $options['e'];
function moveToExternal( $cluster, $maxID, $minID = 1 ) {
$fname = 'moveToExternal';
- $dbw =& wfGetDB( DB_MASTER );
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbw = wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_SLAVE );
$count = $maxID - $minID + 1;
$blockSize = 1000;
function resolveStubs() {
$fname = 'resolveStubs';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$maxID = $dbr->selectField( 'text', 'MAX(old_id)', false, $fname );
$blockSize = 10000;
$numBlocks = intval( $maxID / $blockSize ) + 1;
$stub = unserialize( $stubText );
$flags = explode( ',', $flags );
- $dbr =& wfGetDB( DB_SLAVE );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_SLAVE );
+ $dbw = wfGetDB( DB_MASTER );
if ( strtolower( get_class( $stub ) ) !== 'historyblobstub' ) {
print "Error found object of class " . get_class( $stub ) . ", expecting historyblobstub\n";
function ArticleCounter() {
global $wgContentNamespaces;
$this->namespaces = $wgContentNamespaces;
- $this->dbr =& wfGetDB( DB_SLAVE );
+ $this->dbr = wfGetDB( DB_SLAVE );
}
/**
echo( "found {$result}.\n" );
if( isset( $options['update'] ) && $options['update'] ) {
echo( "Updating site statistics table... " );
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$dbw->update( 'site_stats', array( 'ss_good_articles' => $result ), array( 'ss_row_id' => 1 ), __METHOD__ );
echo( "done.\n" );
} else {
$wgQuiet = $quiet;
$wgDisableSearchUpdate = false;
- $dbw =& wfGetDB( DB_MASTER );
+ $dbw = wfGetDB( DB_MASTER );
$recentchanges = $dbw->tableName( 'recentchanges' );
output( "Updating searchindex between $start and $end\n" );
}
$wgOut->disable();
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
foreach ( $wgQueryPages as $page ) {
@list( $class, $special, $limit ) = $page;
# Wait for the slave to catch up
/*
- $slaveDB =& wfGetDB( DB_SLAVE, array('QueryPage::recache', 'vslow' ) );
+ $slaveDB = wfGetDB( DB_SLAVE, array('QueryPage::recache', 'vslow' ) );
while( $slaveDB->getLag() > 600 ) {
print "Slave lagged, waiting...\n";
sleep(30);
$wgTitle = Title::newFromText( 'Dupe user entry cleanup script' );
$fix = isset( $options['fix'] );
-$dbw =& wfGetDB( DB_MASTER );
+$dbw = wfGetDB( DB_MASTER );
$duper = new UserDupes( $dbw );
$retval = $duper->checkDupes( $fix );
if ( $nt->getNamespace() == NS_CATEGORY ) {
# Determine if the category has any articles in it
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
$hasMembers = $dbr->selectField( 'categorylinks', '1',
array( 'cl_to' => $nt->getDBkey() ), __METHOD__ );
if ( $hasMembers ) {
global $wgPageShowWatchingUsers;
if ( !$wgPageShowWatchingUsers ) return '';
- $dbr =& wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_SLAVE );
extract( $dbr->tableNames( 'watchlist' ) );
$sql = "SELECT COUNT(*) AS n FROM $watchlist
WHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) .
|| !isset($_REQUEST['article']))
XMLerror("Required field not specified");
-$dbw =& wfGetDB(DB_MASTER);
+$dbw = wfGetDB(DB_MASTER);
$tbtitle = $_POST['title'];
$tbex = $_POST['excerpt'];