r35125 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35124‎ | r35125 | r35126 >
Date:01:29, 21 May 2008
Author:aaron
Status:old
Tags:
Comment:
Clean up more fucked up garbage
Modified paths:
  • /trunk/extensions/FlaggedRevs/maintenance/reviewAllPages.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateLinks.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/reviewAllPages.php
@@ -17,7 +17,7 @@
1818 exit(0);
1919 }
2020
21 -error_reporting( E_ALL & (~E_NOTICE) );
 21+error_reporting( E_ALL );
2222
2323 $db = wfGetDB( DB_MASTER );
2424 $user = User::newFromId( intval($args[0]) );
Index: trunk/extensions/FlaggedRevs/maintenance/updateLinks.inc
@@ -1,10 +1,12 @@
22 <?php
33
4 -define( 'BATCH_SIZE',500 );
5 -
64 function update_flaggedrevs() {
75 echo "Populating and correcting flaggedrevs columns\n";
 6+
 7+ $BATCH_SIZE = 500;
 8+
89 $db = wfGetDB( DB_MASTER );
 10+
911 $start = $db->selectField( 'flaggedrevs', 'MIN(fr_rev_id)', false, __FUNCTION__ );
1012 $end = $db->selectField( 'flaggedrevs', 'MAX(fr_rev_id)', false, __FUNCTION__ );
1113 if( is_null( $start ) || is_null( $end ) ){
@@ -12,9 +14,9 @@
1315 return;
1416 }
1517 # Do remaining chunk
16 - $end += BATCH_SIZE - 1;
 18+ $end += $BATCH_SIZE - 1;
1719 $blockStart = $start;
18 - $blockEnd = $start + BATCH_SIZE - 1;
 20+ $blockEnd = $start + $BATCH_SIZE - 1;
1921 $count = 0;
2022 $changed = 0;
2123 while( $blockEnd <= $end ) {
@@ -41,8 +43,8 @@
4244 array( 'fi_rev_id' => $row->fr_rev_id,
4345 'fi_name' => $row->page_title ),
4446 __METHOD__ );
45 - $time = $row ? $row->fi_img_timestamp : null;
46 - $sha1 = $row ? $row->fi_img_sha1 : null;
 47+ $time = $row ? $row->fr_img_timestamp : null;
 48+ $sha1 = $row ? $row->fr_img_sha1 : null;
4749 $file = $row ? $row->page_title : null;
4850 }
4951 if( $file && ($file != $row->fr_img_name || $time != $row->fr_img_timestamp || $sha1 != $row->fr_img_sha1) ) {
@@ -61,8 +63,8 @@
6264 $count++;
6365 }
6466 $db->freeResult( $res );
65 - $blockStart += BATCH_SIZE - 1;
66 - $blockEnd += BATCH_SIZE - 1;
 67+ $blockStart += $BATCH_SIZE - 1;
 68+ $blockEnd += $BATCH_SIZE - 1;
6769 wfWaitForSlaves( 5 );
6870 }
6971 echo "fr_quality and fr_img_* columns update complete ... {$count} rows [{$changed} changed]\n";
@@ -70,7 +72,11 @@
7173
7274 function update_flaggedpages() {
7375 echo "Populating and correcting flaggedpages columns\n";
 76+
 77+ $BATCH_SIZE = 500;
 78+
7479 $db = wfGetDB( DB_MASTER );
 80+
7581 $start = $db->selectField( 'page', 'MIN(page_id)', false, __FUNCTION__ );
7682 $end = $db->selectField( 'page', 'MAX(page_id)', false, __FUNCTION__ );
7783 if( is_null( $start ) || is_null( $end ) ){
@@ -78,9 +84,9 @@
7985 return;
8086 }
8187 # Do remaining chunk
82 - $end += BATCH_SIZE - 1;
 88+ $end += $BATCH_SIZE - 1;
8389 $blockStart = $start;
84 - $blockEnd = $start + BATCH_SIZE - 1;
 90+ $blockEnd = $start + $BATCH_SIZE - 1;
8591 $count = 0;
8692 $deleted = 0;
8793 while( $blockEnd <= $end ) {
@@ -99,15 +105,15 @@
100106 # Somethings broke? Delete the row...
101107 } else {
102108 $db->delete( 'flaggedpages',
103 - array( 'fp_page_id' => $row->fp_page_id ),
 109+ array( 'fp_page_id' => $row->page_id ),
104110 __FUNCTION__ );
105111 if( $db->affectedRows() > 0 )
106112 $deleted++;
107113 }
108114 $count++;
109115 }
110 - $blockStart += BATCH_SIZE - 1;
111 - $blockEnd += BATCH_SIZE - 1;
 116+ $blockStart += $BATCH_SIZE - 1;
 117+ $blockEnd += $BATCH_SIZE - 1;
112118 wfWaitForSlaves( 5 );
113119 }
114120 echo "flaggedpage columns update complete ... {$count} rows [{$deleted} deleted]\n";

Status & tagging log