Merge "Put skin classes in the Autoloader"
[lhc/web/wiklou.git] / maintenance / orphans.php
index 46b9b27..faaadd3 100644 (file)
@@ -50,13 +50,14 @@ class Orphans extends Maintenance {
 
        /**
         * Lock the appropriate tables for the script
-        * @param $db Database object
+        * @param $db DatabaseBase object
         * @param $extraTable String The name of any extra tables to lock (eg: text)
         */
-       private function lockTables( &$db, $extraTable = null ) {
+       private function lockTables( $db, $extraTable = array() ) {
                $tbls = array( 'page', 'revision', 'redirect' );
-               if ( $extraTable )
-                       $tbls[] = $extraTable;
+               if ( $extraTable ) {
+                       $tbls = array_merge( $tbls, $extraTable );
+               }
                $db->lockTables( array(), $tbls, __METHOD__, false );
        }
 
@@ -167,7 +168,7 @@ class Orphans extends Maintenance {
                $revision = $dbw->tableName( 'revision' );
 
                if ( $fix ) {
-                       $dbw->lockTables( $dbw, 'text', __METHOD__ );
+                       $this->lockTables( $dbw, array( 'user', 'text' ) );
                }
 
                $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 @@ class Orphans extends Maintenance {
                                                $this->output( "... updating to revision $maxId\n" );
                                                $maxRev = Revision::newFromId( $maxId );
                                                $title = Title::makeTitle( $row->page_namespace, $row->page_title );
-                                               $article = new Article( $title );
+                                               $article = WikiPage::factory( $title );
                                                $article->updateRevisionOn( $dbw, $maxRev );
                                        }
                                }
@@ -231,4 +232,4 @@ class Orphans extends Maintenance {
 }
 
 $maintClass = "Orphans";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );