Index: trunk/phase3/maintenance/fixSlaveDesync.php |
— | — | @@ -28,11 +28,11 @@ |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function execute() { |
32 | | - global $slaveIndexes, $wgDBservers; |
33 | | - $slaveIndexes = array(); |
| 32 | + global $wgDBservers; |
| 33 | + $this->slaveIndexes = array(); |
34 | 34 | for ( $i = 1; $i < count( $wgDBservers ); $i++ ) { |
35 | 35 | if ( wfGetLB()->isNonZeroLoad( $i ) ) { |
36 | | - $slaveIndexes[] = $i; |
| 36 | + $this->slaveIndexes[] = $i; |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
— | — | @@ -67,8 +67,7 @@ |
68 | 68 | } |
69 | 69 | $this->output( "\n" ); |
70 | 70 | |
71 | | - global $slaveIndexes; |
72 | | - foreach ( $slaveIndexes as $i ) { |
| 71 | + foreach ( $this->slaveIndexes as $i ) { |
73 | 72 | $db = wfGetDB( $i ); |
74 | 73 | $res = $db->select( 'page', array( 'page_id', 'page_latest' ), array( 'page_id<6054123' ), __METHOD__ ); |
75 | 74 | foreach ( $res as $row ) { |
— | — | @@ -87,8 +86,6 @@ |
88 | 87 | * @param $pageID int The page_id to fix |
89 | 88 | */ |
90 | 89 | private function desyncFixPage( $pageID ) { |
91 | | - global $slaveIndexes; |
92 | | - |
93 | 90 | # Check for a corrupted page_latest |
94 | 91 | $dbw = wfGetDB( DB_MASTER ); |
95 | 92 | $dbw->begin(); |
— | — | @@ -96,7 +93,7 @@ |
97 | 94 | __METHOD__, 'FOR UPDATE' ); |
98 | 95 | # list( $masterFile, $masterPos ) = $dbw->getMasterPos(); |
99 | 96 | $found = false; |
100 | | - foreach ( $slaveIndexes as $i ) { |
| 97 | + foreach ( $this->slaveIndexes as $i ) { |
101 | 98 | $db = wfGetDB( $i ); |
102 | 99 | /* |
103 | 100 | if ( !$db->masterPosWait( $masterFile, $masterPos, 10 ) ) { |
— | — | @@ -170,7 +167,7 @@ |
171 | 168 | $dbw->insert( 'revision', get_object_vars( $row ), __METHOD__, 'IGNORE' ); |
172 | 169 | } |
173 | 170 | } else { |
174 | | - foreach ( $slaveIndexes as $i ) { |
| 171 | + foreach ( $this->slaveIndexes as $i ) { |
175 | 172 | $db = wfGetDB( $i ); |
176 | 173 | $db->insert( 'revision', get_object_vars( $row ), __METHOD__, 'IGNORE' ); |
177 | 174 | } |
— | — | @@ -181,7 +178,7 @@ |
182 | 179 | if ( $toMaster ) { |
183 | 180 | $dbw->insert( 'text', get_object_vars( $row ), __METHOD__, 'IGNORE' ); |
184 | 181 | } else { |
185 | | - foreach ( $slaveIndexes as $i ) { |
| 182 | + foreach ( $this->slaveIndexes as $i ) { |
186 | 183 | $db = wfGetDB( $i ); |
187 | 184 | $db->insert( 'text', get_object_vars( $row ), __METHOD__, 'IGNORE' ); |
188 | 185 | } |
— | — | @@ -195,7 +192,7 @@ |
196 | 193 | if ( $toMaster ) { |
197 | 194 | # $dbw->update( 'page', array( 'page_latest' => $realLatest ), array( 'page_id' => $pageID ), __METHOD__ ); |
198 | 195 | } else { |
199 | | - foreach ( $slaveIndexes as $i ) { |
| 196 | + foreach ( $this->slaveIndexes as $i ) { |
200 | 197 | $db = wfGetDB( $i ); |
201 | 198 | $db->update( 'page', array( 'page_latest' => $realLatest ), array( 'page_id' => $pageID ), __METHOD__ ); |
202 | 199 | } |