r61076 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61075‎ | r61076 | r61077 >
Date:03:58, 15 January 2010
Author:aaron
Status:ok
Tags:
Comment:
Various cleanups
Modified paths:
  • /trunk/extensions/FlaggedRevs/maintenance/updateLinks.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/updateLinks.inc
@@ -7,7 +7,9 @@
88
99 $db = wfGetDB( DB_MASTER );
1010
11 - $start = $start ? $start : $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ );
 11+ if( $start === null ) {
 12+ $start = $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ );
 13+ }
1214 $end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ );
1315 if( is_null( $start ) || is_null( $end ) ){
1416 echo "...revision table seems to be empty.\n";
@@ -63,7 +65,11 @@
6466 $sha1 = $row->fr_img_sha1;
6567 $file = $row->fr_img_name;
6668 }
67 - if( $file && ($file != $row->fr_img_name || $time != $row->fr_img_timestamp || $sha1 != $row->fr_img_sha1) ) {
 69+ if( $file &&
 70+ ($file != $row->fr_img_name
 71+ || $time != $row->fr_img_timestamp
 72+ || $sha1 != $row->fr_img_sha1) )
 73+ {
6874 $changed++;
6975 } else if ( $quality != $row->fr_quality ) {
7076 $changed++;
@@ -137,6 +143,7 @@
138144 }
139145 $count++;
140146 }
 147+ $db->freeResult( $res );
141148 # Remove manual config settings that simply restate the site defaults
142149 $db->delete( 'flaggedpage_config',
143150 array( "fpc_page_id BETWEEN $blockStart AND $blockEnd",
@@ -162,7 +169,9 @@
163170
164171 $db = wfGetDB( DB_MASTER );
165172
166 - $start = $start ? $start : $db->selectField( 'flaggedtemplates', 'MIN(ft_rev_id)', false, __FUNCTION__ );
 173+ if( $start === null ) {
 174+ $start = $db->selectField( 'flaggedtemplates', 'MIN(ft_rev_id)', false, __FUNCTION__ );
 175+ }
167176 $end = $db->selectField( 'flaggedtemplates', 'MAX(ft_rev_id)', false, __FUNCTION__ );
168177 if( is_null( $start ) || is_null( $end ) ){
169178 echo "...flaggedtemplates table seems to be empty.\n";
@@ -182,7 +191,9 @@
183192 foreach( $res as $row ) {
184193 $revision = Revision::newFromId( $row->ft_rev_id );
185194 # Replaces new fields into flaggedpages
186 - $frev = $revision ? FlaggedRevision::newFromTitle( $revision->getTitle(), $row->ft_rev_id ) : null;
 195+ $frev = $revision
 196+ ? FlaggedRevision::newFromTitle( $revision->getTitle(), $row->ft_rev_id )
 197+ : null;
187198 # Somethings broke? Delete the row...
188199 if( !$frev ) {
189200 $db->begin();
@@ -195,6 +206,7 @@
196207 }
197208 $count++;
198209 }
 210+ $db->freeResult( $res );
199211 $blockStart += $BATCH_SIZE;
200212 $blockEnd += $BATCH_SIZE;
201213 wfWaitForSlaves( 5 );
@@ -209,7 +221,9 @@
210222
211223 $db = wfGetDB( DB_MASTER );
212224
213 - $start = $start ? $start : $db->selectField( 'flaggedimages', 'MIN(fi_rev_id)', false, __FUNCTION__ );
 225+ if( $start === null ) {
 226+ $start = $db->selectField( 'flaggedimages', 'MIN(fi_rev_id)', false, __FUNCTION__ );
 227+ }
214228 $end = $db->selectField( 'flaggedimages', 'MAX(fi_rev_id)', false, __FUNCTION__ );
215229 if( is_null( $start ) || is_null( $end ) ){
216230 echo "...flaggedimages table seems to be empty.\n";
@@ -229,7 +243,9 @@
230244 foreach( $res as $row ) {
231245 $revision = Revision::newFromId( $row->fi_rev_id );
232246 # Replaces new fields into flaggedpages
233 - $frev = $revision ? FlaggedRevision::newFromTitle( $revision->getTitle(), $row->fi_rev_id ) : null;
 247+ $frev = $revision
 248+ ? FlaggedRevision::newFromTitle( $revision->getTitle(), $row->fi_rev_id )
 249+ : null;
234250 # Somethings broke? Delete the row...
235251 if( !$frev ) {
236252 $db->begin();
@@ -242,6 +258,7 @@
243259 }
244260 $count++;
245261 }
 262+ $db->freeResult( $res );
246263 $blockStart += $BATCH_SIZE;
247264 $blockEnd += $BATCH_SIZE;
248265 wfWaitForSlaves( 5 );

Status & tagging log