Index: trunk/extensions/FlaggedRevs/FlaggedPageConfig.php |
— | — | @@ -185,8 +185,10 @@ |
186 | 186 | */ |
187 | 187 | public static function purgeExpiredConfigurations() { |
188 | 188 | if ( wfReadOnly() ) return; |
189 | | - |
190 | | - $dbw = wfGetDB( DB_MASTER ); |
| 189 | + # Get a separate master session for this transaction (deadlock avoidance) |
| 190 | + $lb = wfGetLBFactory()->newMainLB(); |
| 191 | + $dbw = $lb->getConnection( DB_MASTER ); |
| 192 | + # Find pages with expired configs... |
191 | 193 | $config = self::getDefaultVisibilitySettings(); // config is to be reset |
192 | 194 | $encCutoff = $dbw->addQuotes( $dbw->timestamp() ); |
193 | 195 | $ret = $dbw->select( |
— | — | @@ -196,6 +198,7 @@ |
197 | 199 | __METHOD__ |
198 | 200 | // array( 'FOR UPDATE' ) |
199 | 201 | ); |
| 202 | + # Figured out to do with each page... |
200 | 203 | $pagesClearConfig = array(); |
201 | 204 | $pagesClearTracking = $titlesClearTracking = array(); |
202 | 205 | foreach ( $ret as $row ) { |
— | — | @@ -232,5 +235,8 @@ |
233 | 236 | FlaggedRevs::HTMLCacheUpdates( $title ); // purge pages that use this page |
234 | 237 | } |
235 | 238 | } |
| 239 | + # Commit this transaction and close session |
| 240 | + $lb->commitMasterChanges(); |
| 241 | + $lb->closeAll(); |
236 | 242 | } |
237 | 243 | } |