Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2294,4 +2294,25 @@ |
2295 | 2295 | return RepoGroup::singleton()->getLocalRepo()->newFile( $title ); |
2296 | 2296 | } |
2297 | 2297 | |
| 2298 | +function wfQueriesMustScale() { |
| 2299 | + global $wgMiserMode; |
| 2300 | + // If $wgMiserMode is true, it is either large or just cheap, other way the |
| 2301 | + // affect is the same... |
| 2302 | + if( $wgMiserMode ) |
| 2303 | + return true; |
| 2304 | + // Try to roughly guess how large this wiki is. |
| 2305 | + // Useful for figuring out if a query that doesn't scale should be avoided |
| 2306 | + // or if job queue should be used |
| 2307 | + $dbr = wfGetDB( DB_SLAVE ); |
| 2308 | + $stats = $dbr->selectRow('site_stats', |
| 2309 | + array('ss_total_pages AS pages','ss_total_edits as edits','ss_users AS users'), |
| 2310 | + array(), |
| 2311 | + __METHOD__); |
| 2312 | + if( $stats->pages > 100000 && $stats->edits > 1000000 && $stats->users > 10000 ) { |
| 2313 | + return true; |
| 2314 | + } else { |
| 2315 | + return false; |
| 2316 | + } |
| 2317 | +} |
| 2318 | + |
2298 | 2319 | ?> |