Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2258,24 +2258,25 @@ |
2259 | 2259 | return RepoGroup::singleton()->getLocalRepo()->newFile( $title ); |
2260 | 2260 | } |
2261 | 2261 | |
| 2262 | +/** |
| 2263 | + * Should low-performance queries be disabled? |
| 2264 | + * |
| 2265 | + * @return bool |
| 2266 | + */ |
2262 | 2267 | function wfQueriesMustScale() { |
2263 | 2268 | global $wgMiserMode; |
2264 | | - // If $wgMiserMode is true, all queries must be efficient |
| 2269 | + // Unconditional performance requirement |
2265 | 2270 | if( $wgMiserMode ) |
2266 | 2271 | return true; |
2267 | | - // Try to roughly guess how large this wiki is. |
2268 | | - // Useful for figuring out if a query that doesn't scale should be avoided |
2269 | | - // or if job queue should be used |
| 2272 | + // Make a rough estimate |
2270 | 2273 | $dbr = wfGetDB( DB_SLAVE ); |
2271 | | - $stats = $dbr->selectRow('site_stats', |
2272 | | - array('ss_total_pages AS pages','ss_total_edits as edits','ss_users AS users'), |
| 2274 | + $stats = $dbr->selectRow( |
| 2275 | + 'site_stats', |
| 2276 | + array( 'ss_total_pages AS pages', 'ss_total_edits AS edits', 'ss_users AS users' ), |
2273 | 2277 | array(), |
2274 | | - __METHOD__); |
2275 | | - if( $stats->pages > 100000 && $stats->edits > 1000000 && $stats->users > 10000 ) { |
2276 | | - return true; |
2277 | | - } else { |
2278 | | - return false; |
2279 | | - } |
| 2278 | + __METHOD__ |
| 2279 | + ); |
| 2280 | + return $stats->pages > 100000 && $stats->edits > 1000000 && $stats->users > 10000; |
2280 | 2281 | } |
2281 | 2282 | |
2282 | 2283 | /** |