Fix numerous undefined variables
authorSam Reed <reedy@users.mediawiki.org>
Fri, 1 Jul 2011 01:42:48 +0000 (01:42 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Fri, 1 Jul 2011 01:42:48 +0000 (01:42 +0000)
maintenance/deleteOldRevisions.php
maintenance/fixSlaveDesync.php
maintenance/language/StatOutputs.php
maintenance/nukePage.php
maintenance/purgeOldText.inc
maintenance/storage/checkStorage.php

index ba76e9e..2cb347f 100644 (file)
@@ -60,6 +60,7 @@ class DeleteOldRevisions extends Maintenance {
                # Get "active" revisions from the page table
                $this->output( "Searching for active revisions..." );
                $res = $dbw->query( "SELECT page_latest FROM $tbl_pag{$pageIdClause}" );
+               $cur = array();
                foreach ( $res as $row ) {
                        $cur[] = $row->page_latest;
                }
index fe89294..3c6888a 100644 (file)
@@ -124,7 +124,7 @@ class FixSlaveDesync extends Maintenance {
                        $masterIDs[] = $row->rev_id;
                }
 
-               $res = $db->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), __METHOD__ );
+               $res = $dbw->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), __METHOD__ );
                $slaveIDs = array();
                foreach ( $res as $row ) {
                        $slaveIDs[] = $row->rev_id;
@@ -133,7 +133,7 @@ class FixSlaveDesync extends Maintenance {
                        $missingIDs = array_diff( $slaveIDs, $masterIDs );
                        if ( count( $missingIDs ) ) {
                                $this->output( "Found " . count( $missingIDs ) . " lost in master, copying from slave... " );
-                               $dbFrom = $db;
+                               $dbFrom = $dbw;
                                $found = true;
                                $toMaster = true;
                        } else {
index d994e38..c6d0364 100644 (file)
@@ -53,6 +53,7 @@ class wikiStatsOutput extends statsOutput {
                echo "For additional information on specific languages (the message names, the actual problems, etc.), run <code>php maintenance/language/checkLanguage.php --lang=foo</code>.\n\n";
                echo 'English (en) is excluded because it is the default localization';
                if( is_array( $wgDummyLanguageCodes ) ) {
+                       $dummyCodes = array();
                        foreach( $wgDummyLanguageCodes as $dummyCode ) {
                                $dummyCodes[] = $wgContLang->getLanguageName( $dummyCode ) . ' (' . $dummyCode . ')';
                        }
index 4a073a5..c818e73 100644 (file)
@@ -56,6 +56,7 @@ class NukePage extends Maintenance {
                        # Get corresponding revisions
                        $this->output( "Searching for revisions..." );
                        $res = $dbw->query( "SELECT rev_id FROM $tbl_rev WHERE rev_page = $id" );
+                       $revs = array();
                        foreach ( $res as $row ) {
                                $revs[] = $row->rev_id;
                        }
index 743b3fc..45a7ae2 100644 (file)
@@ -44,6 +44,7 @@ function PurgeRedundantText( $delete = false ) {
        # Get "active" text records from the archive table
        echo( "Searching for active text records in archive table..." );
        $res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" );
+       $cur = array();
        foreach ( $res as $row ) {
                $cur[] = $row->ar_text_id;
        }
index 284859e..c372b9c 100644 (file)
@@ -130,6 +130,7 @@ class CheckStorage {
                                        // It's safe to just erase the old_flags field
                                        if ( $fix ) {
                                                $this->error( 'fixed', "Warning: old_flags set to 0", $id );
+                                               $dbw = wfGetDB( DB_MASTER );
                                                $dbw->ping();
                                                $dbw->update( 'text', array( 'old_flags' => '' ),
                                                        array( 'old_id' => $id ), $fname );