r65940 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65939‎ | r65940 | r65941 >
Date:05:21, 5 May 2010
Author:mah
Status:deferred
Tags:
Comment:
Avoid the white page of death if the user was stupid and didn't read the README. This way, they'll get a DB error.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/NewMessagesController.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/NewMessagesController.php
@@ -397,17 +397,20 @@
398398
399399 $res = $dbr->select( 'user_message_state', '1', $cond, __METHOD__, $options );
400400
401 - $count = $res->numRows();
 401+ if( $res ) {
 402+ $count = $res->numRows();
402403
403 - if ( $count >= 500 ) {
404 - $count = $dbr->estimateRowCount( 'user_message_state', '*', $cond,
 404+ if ( $count >= 500 ) {
 405+ $count = $dbr->estimateRowCount( 'user_message_state', '*', $cond,
405406 __METHOD__ );
406 - }
 407+ }
407408
408 - $wgMemc->set( wfMemcKey( 'lqt-new-messages-count', $user->getId() ),
 409+ $wgMemc->set( wfMemcKey( 'lqt-new-messages-count', $user->getId() ),
409410 $count, 86400 );
410411
411 - return $count;
 412+ return $count;
 413+ }
 414+ return 0;
412415 }
413416
414417 static function recacheMessageCount( $uid ) {

Status & tagging log