r23165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23164‎ | r23165 | r23166 >
Date:15:29, 21 June 2007
Author:aaron
Status:old
Tags:
Comment:
*Add wfQueriesMustScale(), a quick dirt way to see whether we can get away with inefficient queries or if the job queue is best. Will likely need tweaking.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2294,4 +2294,25 @@
22952295 return RepoGroup::singleton()->getLocalRepo()->newFile( $title );
22962296 }
22972297
 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+
22982319 ?>

Follow-up revisions

RevisionCommit summaryAuthorDate
r23203Merged revisions 23120-23202 via svnmerge from...david09:07, 22 June 2007

Status & tagging log