Index: trunk/phase3/maintenance/updateRestrictions.php |
— | — | @@ -37,18 +37,19 @@ |
38 | 38 | $encodedExpiry = 'infinity'; |
39 | 39 | while ( $blockEnd <= $end ) { |
40 | 40 | echo "...doing page_id from $blockStart to $blockEnd\n"; |
41 | | - $cond = "page_id BETWEEN $blockStart AND $blockEnd AND page_restrictions !='' AND page_restrictions !='edit=:move='"; |
| 41 | + $cond = "page_id BETWEEN $blockStart AND $blockEnd AND page_restrictions !=''"; |
42 | 42 | $res = $db->select( 'page', array('page_id', 'page_restrictions'), $cond, __FUNCTION__ ); |
43 | 43 | $batch = array(); |
44 | 44 | while ( $row = $db->fetchObject( $res ) ) { |
45 | 45 | $oldRestrictions = array(); |
46 | 46 | foreach( explode( ':', trim( $row->page_restrictions ) ) as $restrict ) { |
47 | 47 | $temp = explode( '=', trim( $restrict ) ); |
48 | | - if(count($temp) == 1) { |
| 48 | + // Make sure we are not settings restrictions to "" |
| 49 | + if( count($temp) == 1 && $temp[0] ) { |
49 | 50 | // old old format should be treated as edit/move restriction |
50 | 51 | $oldRestrictions["edit"] = trim( $temp[0] ); |
51 | 52 | $oldRestrictions["move"] = trim( $temp[0] ); |
52 | | - } else { |
| 53 | + } else if( $temp[1] ) { |
53 | 54 | $oldRestrictions[$temp[0]] = trim( $temp[1] ); |
54 | 55 | } |
55 | 56 | } |
— | — | @@ -77,6 +78,10 @@ |
78 | 79 | $blockEnd += BATCH_SIZE - 1; |
79 | 80 | wfWaitForSlaves( 5 ); |
80 | 81 | } |
| 82 | + echo "...removing dead rows from page_restrictions\n"; |
| 83 | + // Kill any broken rows from previous imports |
| 84 | + $db->delete( 'page_restrictions', array( 'pr_level' => '' ) ); |
| 85 | + echo "...Done!\n"; |
81 | 86 | } |
82 | 87 | |
83 | 88 | |