r70686 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70685‎ | r70686 | r70687 >
Date:12:27, 8 August 2010
Author:demon
Status:ok (Comments)
Tags:
Comment:
Big commit: kill almost every freeResult() call as useless
Modified paths:
  • /trunk/phase3/config/Installer.php (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/LinksUpdate.php (modified) (history)
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/SquidUpdate.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/WatchedItem.php (modified) (history)
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMysql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDisambiguations.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialDoubleRedirects.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialExport.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialNewimages.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWatchlist.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialWhatlinkshere.php (modified) (history)
  • /trunk/phase3/maintenance/FiveUpgrade.inc (modified) (history)
  • /trunk/phase3/maintenance/attachLatest.php (modified) (history)
  • /trunk/phase3/maintenance/deleteOrphanedRevisions.php (modified) (history)
  • /trunk/phase3/maintenance/dumpSisterSites.php (modified) (history)
  • /trunk/phase3/maintenance/dumpUploads.php (modified) (history)
  • /trunk/phase3/maintenance/fixSlaveDesync.php (modified) (history)
  • /trunk/phase3/maintenance/fixTimestamps.php (modified) (history)
  • /trunk/phase3/maintenance/initEditCount.php (modified) (history)
  • /trunk/phase3/maintenance/namespaceDupes.php (modified) (history)
  • /trunk/phase3/maintenance/orphans.php (modified) (history)
  • /trunk/phase3/maintenance/rebuildImages.php (modified) (history)
  • /trunk/phase3/maintenance/rebuildrecentchanges.php (modified) (history)
  • /trunk/phase3/maintenance/rebuildtextindex.php (modified) (history)
  • /trunk/phase3/maintenance/storage/compressOld.inc (modified) (history)
  • /trunk/phase3/maintenance/storage/moveToExternal.php (modified) (history)
  • /trunk/phase3/maintenance/storage/resolveStubs.php (modified) (history)
  • /trunk/phase3/maintenance/updateArticleCount.php (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)
  • /trunk/phase3/maintenance/userDupes.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/config/Installer.php
@@ -1256,7 +1256,6 @@
12571257 break;
12581258 }
12591259 }
1260 - $wgDatabase->freeResult( $res );
12611260 if ( !$found && $conf->DBengine != 'MyISAM' ) {
12621261 echo "<li><strong>Warning:</strong> " . htmlspecialchars( $conf->DBengine ) .
12631262 " storage engine not available, " .
Index: trunk/phase3/includes/Title.php
@@ -2804,7 +2804,6 @@
28052805 }
28062806 }
28072807 }
2808 - $db->freeResult( $res );
28092808 return $retVal;
28102809 }
28112810
@@ -3553,7 +3552,6 @@
35543553 foreach ( $res as $row )
35553554 // $data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$row->cl_to);
35563555 $data[$wgContLang->getNSText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText();
3557 - $dbr->freeResult( $res );
35583556 } else {
35593557 $data = array();
35603558 }
Index: trunk/phase3/includes/specials/SpecialWatchlist.php
@@ -386,7 +386,6 @@
387387 }
388388 $s .= $list->endRecentChangesList();
389389
390 - $dbr->freeResult( $res );
391390 $wgOut->addHTML( $s );
392391 }
393392
@@ -478,7 +477,6 @@
479478 array( 'wl_user' => $user->mId ), 'wlCountItems' );
480479 $row = $dbr->fetchObject( $res );
481480 $count = $row->count;
482 - $dbr->freeResult( $res );
483481
484482 # Halve to remove talk pages if needed
485483 if( !$talk )
Index: trunk/phase3/includes/specials/SpecialDoubleRedirects.php
@@ -85,7 +85,6 @@
8686 $res = $dbr->query( $sql, $fname );
8787 if ( $res ) {
8888 $result = $dbr->fetchObject( $res );
89 - $dbr->freeResult( $res );
9089 }
9190 }
9291 if ( !$result ) {
Index: trunk/phase3/includes/specials/SpecialNewimages.php
@@ -67,7 +67,6 @@
6868 } else {
6969 $ts = false;
7070 }
71 - $dbr->freeResult( $res );
7271 $sql = '';
7372
7473 # If we were clever, we'd use this to cache.
@@ -125,7 +124,6 @@
126125 array_push( $images, $s );
127126 }
128127 }
129 - $dbr->freeResult( $res );
130128
131129 $gallery = new ImageGallery();
132130 $firstTimestamp = null;
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -241,7 +241,6 @@
242242 $talkFlags[$s->page_title] = true;
243243 }
244244 }
245 - $dbr->freeResult( $res );
246245
247246 wfProfileOut( __METHOD__ . '-db' );
248247
Index: trunk/phase3/includes/specials/SpecialDisambiguations.php
@@ -67,8 +67,6 @@
6868 while ( $row = $dbr->fetchObject( $res ) ) {
6969 $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ));
7070 }
71 -
72 - $dbr->freeResult( $res );
7371 }
7472
7573 $set = $linkBatch->constructSet( 'lb.tl', $dbr );
Index: trunk/phase3/includes/specials/SpecialFileDuplicateSearch.php
@@ -100,7 +100,6 @@
101101 if( $row !== false ) {
102102 $hash = $row[0];
103103 }
104 - $dbr->freeResult( $res );
105104 }
106105
107106 # Create the input form
Index: trunk/phase3/includes/specials/SpecialWhatlinkshere.php
@@ -189,8 +189,6 @@
190190 $row->is_image = 0;
191191 $rows[$row->page_id] = $row;
192192 }
193 - $dbr->freeResult( $plRes );
194 -
195193 }
196194 if( !$hidetrans ) {
197195 while ( $row = $dbr->fetchObject( $tlRes ) ) {
@@ -198,7 +196,6 @@
199197 $row->is_image = 0;
200198 $rows[$row->page_id] = $row;
201199 }
202 - $dbr->freeResult( $tlRes );
203200 }
204201 if( !$hideimages ) {
205202 while ( $row = $dbr->fetchObject( $ilRes ) ) {
@@ -206,7 +203,6 @@
207204 $row->is_image = 1;
208205 $rows[$row->page_id] = $row;
209206 }
210 - $dbr->freeResult( $ilRes );
211207 }
212208
213209 // Sort by key and then change the keys to 0-based indices
Index: trunk/phase3/includes/specials/SpecialExport.php
@@ -319,9 +319,6 @@
320320
321321 $pages[] = $n;
322322 }
323 -
324 - $dbr->freeResult($res);
325 -
326323 return $pages;
327324 }
328325
@@ -349,9 +346,6 @@
350347
351348 $pages[] = $n;
352349 }
353 -
354 - $dbr->freeResult( $res );
355 -
356350 return $pages;
357351 }
358352
Index: trunk/phase3/includes/SquidUpdate.php
@@ -46,7 +46,6 @@
4747 $blurlArr[] = $tobj->getInternalURL();
4848 }
4949 }
50 - $dbr->freeResult ( $res ) ;
5150
5251 wfProfileOut( __METHOD__ );
5352 return new SquidUpdate( $blurlArr );
Index: trunk/phase3/includes/QueryPage.php
@@ -264,13 +264,9 @@
265265 if ( count( $vals ) ) {
266266 if ( !$dbw->insert( 'querycache', $vals, __METHOD__ ) ) {
267267 // Set result to false to indicate error
268 - $dbr->freeResult( $res );
269268 $res = false;
270269 }
271270 }
272 - if ( $res ) {
273 - $dbr->freeResult( $res );
274 - }
275271 if ( $ignoreErrors ) {
276272 $dbw->ignoreErrors( $ignoreW );
277273 $dbr->ignoreErrors( $ignoreR );
@@ -492,7 +488,6 @@
493489 $item = $this->feedResult( $obj );
494490 if( $item ) $feed->outItem( $item );
495491 }
496 - $dbr->freeResult( $res );
497492
498493 $feed->outFooter();
499494 return true;
Index: trunk/phase3/includes/Article.php
@@ -2788,8 +2788,6 @@
27892789 $onlyAuthor = false;
27902790 }
27912791
2792 - $dbw->freeResult( $res );
2793 -
27942792 // Generate the summary with a '$1' placeholder
27952793 if ( $blank ) {
27962794 // The current revision is blank and the one before is also
@@ -4311,8 +4309,6 @@
43124310 }
43134311 }
43144312
4315 - $dbr->freeResult( $res );
4316 -
43174313 return $result;
43184314 }
43194315
@@ -4343,8 +4339,6 @@
43444340 }
43454341 }
43464342
4347 - $dbr->freeResult( $res );
4348 -
43494343 return $result;
43504344 }
43514345
Index: trunk/phase3/includes/RecentChange.php
@@ -73,7 +73,6 @@
7474 $res = $dbr->select( 'recentchanges', '*', array( 'rc_id' => $rcid ), __METHOD__ );
7575 if( $res && $dbr->numRows( $res ) > 0 ) {
7676 $row = $dbr->fetchObject( $res );
77 - $dbr->freeResult( $res );
7877 return self::newFromRow( $row );
7978 } else {
8079 return null;
Index: trunk/phase3/includes/WatchedItem.php
@@ -150,7 +150,6 @@
151151 'wl_title' => $newtitle
152152 );
153153 }
154 - $dbw->freeResult( $res );
155154
156155 if( empty( $values ) ) {
157156 // Nothing to do
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -1005,7 +1005,6 @@
10061006 $res = $this->query( "VALUES NEXTVAL FOR $safeseq" );
10071007 $row = $this->fetchRow( $res );
10081008 $this->mInsertId = $row[0];
1009 - $this->freeResult( $res );
10101009 return $this->mInsertId;
10111010 */
10121011 return null;
@@ -1604,7 +1603,6 @@
16051604 $res = $this->query($sql);
16061605 $row = $this->fetchObject($res);
16071606 $size = $row->size;
1608 - $this->freeResult( $res );
16091607 return $size;
16101608 }
16111609
Index: trunk/phase3/includes/db/Database.php
@@ -786,7 +786,6 @@
787787 }
788788 $row = $this->fetchRow( $res );
789789 if ( $row !== false ) {
790 - $this->freeResult( $res );
791790 return reset( $row );
792791 } else {
793792 return false;
@@ -947,13 +946,10 @@
948947 if ( $res === false )
949948 return false;
950949 if ( !$this->numRows($res) ) {
951 - $this->freeResult($res);
952950 return false;
953951 }
954952 $obj = $this->fetchObject( $res );
955 - $this->freeResult( $res );
956953 return $obj;
957 -
958954 }
959955
960956 /**
@@ -976,7 +972,6 @@
977973 $row = $this->fetchRow( $res );
978974 $rows = ( isset( $row['rowcount'] ) ) ? $row['rowcount'] : 0;
979975 }
980 - $this->freeResult( $res );
981976 return $rows;
982977 }
983978
@@ -1056,7 +1051,6 @@
10571052 $result[] = $row;
10581053 }
10591054 }
1060 - $this->freeResult($res);
10611055
10621056 return empty($result) ? false : $result;
10631057 }
@@ -1069,12 +1063,7 @@
10701064 $old = $this->ignoreErrors( true );
10711065 $res = $this->query( "SELECT 1 FROM $table LIMIT 1" );
10721066 $this->ignoreErrors( $old );
1073 - if( $res ) {
1074 - $this->freeResult( $res );
1075 - return true;
1076 - } else {
1077 - return false;
1078 - }
 1067+ return (bool)$res;
10791068 }
10801069
10811070 /**
@@ -1658,7 +1647,6 @@
16591648 $sql = "SHOW COLUMNS FROM $table LIKE \"$field\";";
16601649 $res = $this->query( $sql, 'Database::textFieldSize' );
16611650 $row = $this->fetchObject( $res );
1662 - $this->freeResult( $res );
16631651
16641652 $m = array();
16651653 if ( preg_match( '/\((.*)\)/', $row->Type, $m ) ) {
@@ -1926,7 +1914,6 @@
19271915 $sql = "SELECT MASTER_POS_WAIT($encFile, $encPos, $timeout)";
19281916 $res = $this->doQuery( $sql );
19291917 if ( $res && $row = $this->fetchRow( $res ) ) {
1930 - $this->freeResult( $res );
19311918 wfProfileOut( $fname );
19321919 return $row[0];
19331920 } else {
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -327,7 +327,6 @@
328328 if ( $res ) {
329329 $row = $this->fetchRow( $res );
330330 if ( isset( $row['EstimateRows'] ) ) $rows = $row['EstimateRows'];
331 - $this->freeResult( $res );
332331 }
333332 return $rows;
334333 }
@@ -666,7 +665,6 @@
667666 $row = $this->fetchRow( $res );
668667 $size = -1;
669668 if ( strtolower( $row['DATA_TYPE'] ) != 'text' ) $size = $row['CHARACTER_MAXIMUM_LENGTH'];
670 - $this->freeResult( $res );
671669 return $size;
672670 }
673671
Index: trunk/phase3/includes/db/DatabaseMysql.php
@@ -256,7 +256,6 @@
257257 if ( $res === false )
258258 return false;
259259 if ( !$this->numRows( $res ) ) {
260 - $this->freeResult($res);
261260 return 0;
262261 }
263262
@@ -264,8 +263,6 @@
265264 while( $plan = $this->fetchObject( $res ) ) {
266265 $rows *= $plan->rows > 0 ? $plan->rows : 1; // avoid resetting to zero
267266 }
268 -
269 - $this->freeResult($res);
270267 return $rows;
271268 }
272269
@@ -382,7 +379,6 @@
383380 $lockName = $this->addQuotes( $lockName );
384381 $result = $this->query( "SELECT GET_LOCK($lockName, $timeout) AS lockstatus", $method );
385382 $row = $this->fetchObject( $result );
386 - $this->freeResult( $result );
387383
388384 if( $row->lockstatus == 1 ) {
389385 return true;
Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -654,7 +654,6 @@
655655 $res = $this->query( "SELECT $seqName.nextval FROM dual" );
656656 $row = $this->fetchRow( $res );
657657 $this->mInsertId = $row[0];
658 - $this->freeResult( $res );
659658 return $this->mInsertId;
660659 }
661660
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -726,7 +726,6 @@
727727 if( preg_match( '/rows=(\d+)/', $row[0], $count ) ) {
728728 $rows = $count[1];
729729 }
730 - $this->freeResult($res);
731730 }
732731 return $rows;
733732 }
@@ -993,7 +992,6 @@
994993 $res = $this->query( "SELECT nextval('$safeseq')" );
995994 $row = $this->fetchRow( $res );
996995 $this->mInsertId = $row[0];
997 - $this->freeResult( $res );
998996 return $this->mInsertId;
999997 }
1000998
@@ -1005,7 +1003,6 @@
10061004 $res = $this->query( "SELECT currval('$safeseq')" );
10071005 $row = $this->fetchRow( $res );
10081006 $currval = $row[0];
1009 - $this->freeResult( $res );
10101007 return $currval;
10111008 }
10121009
@@ -1098,7 +1095,6 @@
10991096 } else {
11001097 $size=$row->size;
11011098 }
1102 - $this->freeResult( $res );
11031099 return $size;
11041100 }
11051101
@@ -1188,8 +1184,6 @@
11891185 . "AND c.relkind IN ('" . implode("','", $types) . "')";
11901186 $res = $this->query( $SQL );
11911187 $count = $res ? $res->numRows() : 0;
1192 - if ($res)
1193 - $this->freeResult( $res );
11941188 return $count ? true : false;
11951189 }
11961190
@@ -1221,7 +1215,6 @@
12221216 if (!$res)
12231217 return null;
12241218 $rows = $res->numRows();
1225 - $this->freeResult( $res );
12261219 return $rows;
12271220 }
12281221
@@ -1245,7 +1238,6 @@
12461239 if (!$res)
12471240 return null;
12481241 $rows = $res->numRows();
1249 - $this->freeResult($res);
12501242 return $rows;
12511243 }
12521244
@@ -1263,8 +1255,6 @@
12641256 } else {
12651257 $owner = false;
12661258 }
1267 - if ($res)
1268 - $this->freeResult($res);
12691259 return $owner;
12701260 }
12711261
Index: trunk/phase3/includes/filerepo/File.php
@@ -893,7 +893,6 @@
894894 }
895895 }
896896 }
897 - $db->freeResult( $res );
898897 wfProfileOut( __METHOD__ );
899898 return $retVal;
900899 }
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -697,12 +697,10 @@
698698 $fname
699699 );
700700 if ( 0 == $dbr->numRows( $this->historyRes ) ) {
701 - $dbr->freeResult( $this->historyRes );
702701 $this->historyRes = null;
703702 return false;
704703 }
705704 } elseif ( $this->historyLine == 1 ) {
706 - $dbr->freeResult( $this->historyRes );
707705 $this->historyRes = $dbr->select( 'oldimage', '*',
708706 array( 'oi_name' => $this->title->getDBkey() ),
709707 $fname,
@@ -720,7 +718,6 @@
721719 public function resetHistory() {
722720 $this->historyLine = 0;
723721 if ( !is_null( $this->historyRes ) ) {
724 - $this->repo->getSlaveDB()->freeResult( $this->historyRes );
725722 $this->historyRes = null;
726723 }
727724 }
@@ -1827,7 +1824,6 @@
18281825 "{$archiveBase}/{$this->newHash}{$timestamp}!{$this->newName}"
18291826 );
18301827 }
1831 - $this->db->freeResult( $result );
18321828 }
18331829
18341830 /**
Index: trunk/phase3/includes/LinksUpdate.php
@@ -640,7 +640,6 @@
641641 }
642642 $arr[$row->pl_namespace][$row->pl_title] = 1;
643643 }
644 - $this->mDb->freeResult( $res );
645644 return $arr;
646645 }
647646
@@ -658,7 +657,6 @@
659658 }
660659 $arr[$row->tl_namespace][$row->tl_title] = 1;
661660 }
662 - $this->mDb->freeResult( $res );
663661 return $arr;
664662 }
665663
@@ -673,7 +671,6 @@
674672 while ( $row = $this->mDb->fetchObject( $res ) ) {
675673 $arr[$row->il_to] = 1;
676674 }
677 - $this->mDb->freeResult( $res );
678675 return $arr;
679676 }
680677
@@ -688,7 +685,6 @@
689686 while ( $row = $this->mDb->fetchObject( $res ) ) {
690687 $arr[$row->el_to] = 1;
691688 }
692 - $this->mDb->freeResult( $res );
693689 return $arr;
694690 }
695691
@@ -703,7 +699,6 @@
704700 while ( $row = $this->mDb->fetchObject( $res ) ) {
705701 $arr[$row->cl_to] = $row->cl_sortkey;
706702 }
707 - $this->mDb->freeResult( $res );
708703 return $arr;
709704 }
710705
@@ -736,7 +731,6 @@
737732 }
738733 $arr[$row->iwl_prefix][$row->iwl_title] = 1;
739734 }
740 - $this->mDb->freeResult( $res );
741735 return $arr;
742736 }
743737
@@ -751,7 +745,6 @@
752746 while ( $row = $this->mDb->fetchObject( $res ) ) {
753747 $arr[$row->pp_propname] = $row->pp_value;
754748 }
755 - $this->mDb->freeResult( $res );
756749 return $arr;
757750 }
758751
Index: trunk/phase3/maintenance/updaters.inc
@@ -327,7 +327,6 @@
328328 $tableName = $wgDatabase->tableName( $table );
329329 $res = $wgDatabase->query( "SELECT $field FROM $tableName LIMIT 0" );
330330 $flags = explode( ' ', mysql_field_flags( $res->result, 0 ) );
331 - $wgDatabase->freeResult( $res );
332331
333332 if ( in_array( 'binary', $flags ) ) {
334333 wfOut( "...$table table has correct $field encoding.\n" );
@@ -550,7 +549,6 @@
551550 $tablename = $wgDatabase->tableName( $table );
552551 $result = $wgDatabase->query( "SHOW COLUMNS FROM $tablename LIKE '$field'" );
553552 $info = $wgDatabase->fetchObject( $result );
554 - $wgDatabase->freeResult( $result );
555553
556554 if ( substr( $info->Type, 0, 3 ) == 'int' ) {
557555 wfOut( "...$field is already a full int ($info->Type).\n" );
@@ -698,7 +696,6 @@
699697 $fname );
700698 }
701699 }
702 - $wgDatabase->freeResult( $result );
703700 wfOut( "ok\n" );
704701 }
705702
@@ -793,7 +790,6 @@
794791 );
795792
796793 }
797 - $wgDatabase->freeResult( $res );
798794 } else {
799795 // Fast update
800796 $wgDatabase->insertSelect( 'templatelinks', 'pagelinks',
@@ -1241,14 +1237,12 @@
12421238 return null;
12431239 }
12441240 if ( !( $r = $wgDatabase->fetchRow( $res ) ) ) {
1245 - $wgDatabase->freeResult( $res );
12461241 return null;
12471242 }
12481243
12491244 $indkey = $r[0];
12501245 $relid = intval( $r[1] );
12511246 $indkeys = explode( " ", $indkey );
1252 - $wgDatabase->freeResult( $res );
12531247
12541248 $colnames = array();
12551249 foreach ( $indkeys as $rid ) {
@@ -1263,11 +1257,9 @@
12641258 return null;
12651259 }
12661260 if ( !( $row2 = $wgDatabase->fetchRow( $r2 ) ) ) {
1267 - $wgDatabase->freeResult( $r2 );
12681261 return null;
12691262 }
12701263 $colnames[] = $row2[0];
1271 - $wgDatabase->freeResult( $r2 );
12721264 }
12731265
12741266 return $colnames;
@@ -1316,7 +1308,6 @@
13171309 return null;
13181310 }
13191311 $d = $row[0];
1320 - $wgDatabase->freeResult( $r );
13211312 return $d;
13221313 }
13231314
Index: trunk/phase3/maintenance/deleteOrphanedRevisions.php
@@ -51,7 +51,6 @@
5252 $revisions = array();
5353 foreach ( $res as $row )
5454 $revisions[] = $row->rev_id;
55 - $dbw->freeResult( $res );
5655 $count = count( $revisions );
5756 $this->output( "found {$count}.\n" );
5857
Index: trunk/phase3/maintenance/fixTimestamps.php
@@ -89,7 +89,6 @@
9090 $badRevs[] = $row->rev_id;
9191 }
9292 }
93 - $dbw->freeResult( $res );
9493
9594 $numBadRevs = count( $badRevs );
9695 if ( $numBadRevs > $numGoodRevs ) {
Index: trunk/phase3/maintenance/rebuildImages.php
@@ -112,7 +112,6 @@
113113 }
114114 }
115115 $this->log( "Finished $table... $this->updated of $this->processed rows updated" );
116 - $this->dbr->freeResult( $result );
117116 }
118117
119118 function buildImage() {
Index: trunk/phase3/maintenance/rebuildrecentchanges.php
@@ -129,7 +129,6 @@
130130 $lastSize = 'NULL';
131131 $new = 1; // probably true
132132 }
133 - $dbw->freeResult( $res2 );
134133 }
135134 if ( $lastCurId == 0 ) {
136135 $this->output( "Uhhh, something wrong? No curid\n" );
@@ -147,7 +146,6 @@
148147 $lastSize = $size;
149148 }
150149 }
151 - $dbw->freeResult( $res );
152150 }
153151
154152 /**
@@ -272,8 +270,6 @@
273271 $dbw->query( $sql2 );
274272 }
275273 }
276 -
277 - $dbw->freeResult( $res );
278274 }
279275
280276 /**
Index: trunk/phase3/maintenance/attachLatest.php
@@ -69,7 +69,6 @@
7070 }
7171 $n++;
7272 }
73 - $dbw->freeResult( $result );
7473 $this->output( "Done! Processed $n pages.\n" );
7574 if ( !$this->hasOption( 'fix' ) ) {
7675 $this->output( "This was a dry run; rerun with --fix to update page_latest.\n" );
Index: trunk/phase3/maintenance/initEditCount.php
@@ -80,7 +80,6 @@
8181 __METHOD__ );
8282 ++$migrated;
8383 }
84 - $dbr->freeResult( $result );
8584
8685 $delta = microtime( true ) - $start;
8786 $rate = ( $delta == 0.0 ) ? 0.0 : $migrated / $delta;
Index: trunk/phase3/maintenance/FiveUpgrade.inc
@@ -336,7 +336,6 @@
337337 $this->addChunk( $add );
338338 }
339339 $this->lastChunk( $add );
340 - $this->dbr->freeResult( $result );
341340
342341 $this->log( "Done converting $name." );
343342 $this->cleanupSwaps[] = $name;
@@ -444,7 +443,6 @@
445444 $this->addChunk( $add, $row->cur_id );
446445 }
447446 $this->lastChunk( $add );
448 - $this->dbr->freeResult( $result );
449447
450448 /**
451449 * Copy revision metadata from old into revision.
@@ -477,7 +475,6 @@
478476 $this->addChunk( $add );
479477 }
480478 $this->lastChunk( $add );
481 - $this->dbr->freeResult( $result );
482479
483480
484481 /**
@@ -510,7 +507,6 @@
511508 $this->addChunk( $add );
512509 }
513510 $this->lastChunk( $add );
514 - $this->dbr->freeResult( $result );
515511
516512 $this->log( "...done with cur/old -> page/revision." );
517513 }
@@ -902,7 +898,6 @@
903899 $this->addChunk( $add );
904900 }
905901 $this->lastChunk( $add );
906 - $this->dbr->freeResult( $result );
907902
908903 $this->log( 'Done converting watchlist.' );
909904 $this->cleanupSwaps[] = 'watchlist';
Index: trunk/phase3/maintenance/rebuildtextindex.php
@@ -87,7 +87,6 @@
8888 $u = new SearchUpdate( $s->page_id, $s->page_title, $revtext );
8989 $u->doUpdate();
9090 }
91 - $this->db->freeResult( $res );
9291 $n += self::RTI_CHUNK_SIZE;
9392 }
9493 }
Index: trunk/phase3/maintenance/updateArticleCount.php
@@ -92,7 +92,6 @@
9393 $dbr = wfGetDB( DB_SLAVE );
9494 $res = $dbr->query( $this->makeSql( $dbr ), __METHOD__ );
9595 $row = $dbr->fetchObject( $res );
96 - $dbr->freeResult( $res );
9796 return $row ? $row->pagecount : false;
9897 }
9998 }
Index: trunk/phase3/maintenance/userDupes.inc
@@ -193,8 +193,6 @@
194194 while ( $row = $this->db->fetchObject( $result ) ) {
195195 $list[] = $row->user_name;
196196 }
197 - $this->db->freeResult( $result );
198 -
199197 return $list;
200198 }
201199
@@ -246,7 +244,6 @@
247245 }
248246 wfOut( "\n" );
249247 }
250 - $this->db->freeResult( $result );
251248 }
252249
253250 /**
Index: trunk/phase3/maintenance/dumpSisterSites.php
@@ -48,7 +48,6 @@
4949 $text = $title->getPrefixedText();
5050 $this->output( "$url $text\n" );
5151 }
52 - $dbr->freeResult( $result );
5352 }
5453 }
5554
Index: trunk/phase3/maintenance/dumpUploads.php
@@ -82,7 +82,6 @@
8383 foreach ( $result as $row ) {
8484 $this->outputItem( $row->il_to, $shared );
8585 }
86 - $dbr->freeResult( $result );
8786 }
8887
8988 /**
@@ -100,7 +99,6 @@
101100 foreach ( $result as $row ) {
102101 $this->outputItem( $row->img_name, $shared );
103102 }
104 - $dbr->freeResult( $result );
105103 }
106104
107105 function outputItem( $name, $shared ) {
Index: trunk/phase3/maintenance/namespaceDupes.php
@@ -142,7 +142,6 @@
143143 foreach ( $result as $row ) {
144144 $prefixes[] = $row->iw_prefix;
145145 }
146 - $this->db->freeResult( $result );
147146 return $prefixes;
148147 }
149148
@@ -214,8 +213,6 @@
215214 foreach ( $result as $row ) {
216215 $set[] = $row;
217216 }
218 - $this->db->freeResult( $result );
219 -
220217 return $set;
221218 }
222219
Index: trunk/phase3/maintenance/storage/compressOld.inc
@@ -23,7 +23,6 @@
2424 compressPage( $row, $extdb );
2525 $last = $row->old_id;
2626 }
27 - $dbw->freeResult( $res );
2827 $start = $last + 1; # Deletion may leave long empty stretches
2928 print "$start...\n";
3029 } while( true );
Index: trunk/phase3/maintenance/storage/moveToExternal.php
@@ -111,7 +111,6 @@
112112 array( 'old_id' => $id ), $fname );
113113 $numMoved++;
114114 }
115 - $dbr->freeResult( $res );
116115 }
117116 }
118117
Index: trunk/phase3/maintenance/storage/resolveStubs.php
@@ -40,10 +40,7 @@
4141 $fname );
4242 while ( $row = $dbr->fetchObject( $res ) ) {
4343 resolveStub( $row->old_id, $row->old_text, $row->old_flags );
44 - }
45 - $dbr->freeResult( $res );
46 -
47 -
 44+ }
4845 }
4946 print "100%\n";
5047 }
Index: trunk/phase3/maintenance/fixSlaveDesync.php
@@ -66,7 +66,6 @@
6767 }
6868 }
6969 $this->output( "\n" );
70 - $dbw->freeResult( $res );
7170
7271 global $slaveIndexes;
7372 foreach ( $slaveIndexes as $i ) {
@@ -78,7 +77,6 @@
7978 $this->output( $row->page_id . "\t" );
8079 }
8180 }
82 - $db->freeResult( $res );
8381 }
8482 $this->output( "\n" );
8583 return $desync;
@@ -128,14 +126,12 @@
129127 foreach ( $res as $row ) {
130128 $masterIDs[] = $row->rev_id;
131129 }
132 - $dbw->freeResult( $res );
133130
134131 $res = $db->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), __METHOD__ );
135132 $slaveIDs = array();
136133 foreach ( $res as $row ) {
137134 $slaveIDs[] = $row->rev_id;
138135 }
139 - $db->freeResult( $res );
140136 if ( count( $masterIDs ) < count( $slaveIDs ) ) {
141137 $missingIDs = array_diff( $slaveIDs, $masterIDs );
142138 if ( count( $missingIDs ) ) {
Index: trunk/phase3/maintenance/orphans.php
@@ -184,7 +184,6 @@
185185 WHERE rev_page=$row->page_id
186186 " );
187187 $row2 = $dbw->fetchObject( $result2 );
188 - $dbw->freeResult( $result2 );
189188 if ( $row2 ) {
190189 if ( $row->rev_timestamp != $row2->max_timestamp ) {
191190 if ( $found == 0 ) {

Comments

#Comment by Reedy (talk | contribs)   20:29, 9 August 2010

bug 24712 ? ;)

#Comment by 😂 (talk | contribs)   20:30, 9 August 2010

Didn't know it existed.

#Comment by Reedy (talk | contribs)   20:54, 9 August 2010

14 usages in phase3 left...

Status & tagging log