Assignment in loop conditions suck
[lhc/web/wiklou.git] / maintenance / convertLinks.php
index 27239fa..f13681b 100644 (file)
@@ -18,6 +18,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
@@ -39,7 +40,7 @@ This gives a huge speed improvement for very large links tables which are MyISAM
        }
 
        public function getDbType() {
-               return self::DB_ADMIN;
+               return Maintenance::DB_ADMIN;
        }
 
        public function execute() {
@@ -53,7 +54,7 @@ This gives a huge speed improvement for very large links tables which are MyISAM
 
                global $wgContLang;
        
-               $tuplesAdded = $numBadLinks = $curRowsRead = 0; # counters etc
+               $numBadLinks = $curRowsRead = 0; # counters etc
                $totalTuplesInserted = 0; # total tuples INSERTed into links_temp
 
                $reportCurReadProgress = true; # whether or not to give progress reports while reading IDs from cur table
@@ -112,7 +113,7 @@ This gives a huge speed improvement for very large links tables which are MyISAM
                        $res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" );
                        $ids = array();
 
-                       while ( $row = $dbw->fetchObject( $res ) ) {
+                       foreach ( $res as $row ) {
                                $title = $row->cur_title;
                                if ( $row->cur_namespace ) {
                                        $title = $wgContLang->getNsText( $row->cur_namespace ) . ":$title";
@@ -153,7 +154,7 @@ This gives a huge speed improvement for very large links tables which are MyISAM
                                }
        
                                $tuplesAdded = 0; # no tuples added to INSERT yet
-                               while ( $row = $dbw->fetchObject( $res ) ) {
+                               foreach ( $res as $row ) {
                                        $fromTitle = $row->l_from;
                                        if ( array_key_exists( $fromTitle, $ids ) ) { # valid title
                                                $from = $ids[$fromTitle];