r109067 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109066‎ | r109067 | r109068 >
Date:21:54, 16 January 2012
Author:ialex
Status:ok
Tags:core 
Comment:
* Use WikiPage instead of Article to call updateRevisionOn()
* Also lock 'user' table, needed in Revision::newFromId()
Modified paths:
  • /trunk/phase3/maintenance/orphans.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/orphans.php
@@ -53,10 +53,11 @@
5454 * @param $db DatabaseBase object
5555 * @param $extraTable String The name of any extra tables to lock (eg: text)
5656 */
57 - private function lockTables( &$db, $extraTable = null ) {
 57+ private function lockTables( $db, $extraTable = array() ) {
5858 $tbls = array( 'page', 'revision', 'redirect' );
59 - if ( $extraTable )
60 - $tbls[] = $extraTable;
 59+ if ( $extraTable ) {
 60+ $tbls = array_merge( $tbls, $extraTable );
 61+ }
6162 $db->lockTables( array(), $tbls, __METHOD__, false );
6263 }
6364
@@ -167,7 +168,7 @@
168169 $revision = $dbw->tableName( 'revision' );
169170
170171 if ( $fix ) {
171 - $dbw->lockTables( $dbw, 'text', __METHOD__ );
 172+ $this->lockTables( $dbw, array( 'user', 'text' ) );
172173 }
173174
174175 $this->output( "\nChecking for pages whose page_latest links are incorrect... (this may take a while on a large wiki)\n" );
@@ -206,7 +207,7 @@
207208 $this->output( "... updating to revision $maxId\n" );
208209 $maxRev = Revision::newFromId( $maxId );
209210 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
210 - $article = new Article( $title );
 211+ $article = WikiPage::factory( $title );
211212 $article->updateRevisionOn( $dbw, $maxRev );
212213 }
213214 }

Status & tagging log