r23767 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23766‎ | r23767 | r23768 >
Date:03:55, 6 July 2007
Author:robchurch
Status:old
Tags:
Comment:
Document and clean up wfQueriesMustScale(); less verbose comments inside the function, more function documentation, please -- and don't use an if statement when it's not needed
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2258,24 +2258,25 @@
22592259 return RepoGroup::singleton()->getLocalRepo()->newFile( $title );
22602260 }
22612261
 2262+/**
 2263+ * Should low-performance queries be disabled?
 2264+ *
 2265+ * @return bool
 2266+ */
22622267 function wfQueriesMustScale() {
22632268 global $wgMiserMode;
2264 - // If $wgMiserMode is true, all queries must be efficient
 2269+ // Unconditional performance requirement
22652270 if( $wgMiserMode )
22662271 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
22702273 $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' ),
22732277 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;
22802281 }
22812282
22822283 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r23912Merged revisions 23662-23909 via svnmerge from...david18:11, 9 July 2007

Status & tagging log