r91428 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91427‎ | r91428 | r91429 >
Date:22:00, 4 July 2011
Author:reedy
Status:ok
Tags:
Comment:
Followup r89617

Check if result object is set and usable before trying to get a count from it

So we hopefully don't get a fatal as described in CR
Modified paths:
  • /trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php
@@ -37,11 +37,11 @@
3838
3939 $detailsid = $wgRequest->getIntOrNull( 'details' );
4040 $hideid = $wgRequest->getIntOrNull( 'hide' );
41 -
 41+
4242 if ( $parameter ) {
4343 $detailsid = $parameter;
4444 }
45 -
 45+
4646 if ( $detailsid ) {
4747 $this->showDetails( $detailsid );
4848 } elseif ( $hideid ) {
@@ -161,10 +161,10 @@
162162 array( 'afl_id' => $logid ),
163163 __METHOD__
164164 );
165 -
 165+
166166 $logPage = new LogPage( 'suppress' );
167167 $action = $fields['hidden'] ? 'hide-afl' : 'unhide-afl';
168 -
 168+
169169 $logPage->addEntry( $action, $this->getTitle( $logid ), $fields['reason'] );
170170
171171 $wgOut->redirect( SpecialPage::getTitleFor( 'AbuseLog' )->getFullURL() );
@@ -202,8 +202,8 @@
203203 }
204204
205205 $pager = new AbuseLogPager( $this, $conds );
206 -
207 - if( $pager->getResult()->numRows() !== 0 ) {
 206+ $result = $pager->getResult();
 207+ if( $result && $result->numRows() !== 0 ) {
208208 $wgOut->addHTML( $pager->getNavigationBar() .
209209 Xml::tags( 'ul', null, $pager->getBody() ) .
210210 $pager->getNavigationBar() );
@@ -461,7 +461,7 @@
462462
463463 return $li ? Xml::tags( 'li', null, $description ) : $description;
464464 }
465 -
 465+
466466 public static function getNotDeletedCond( $db ) {
467467 $deletedZeroCond = $db->makeList(
468468 array( 'afl_deleted' => 0 ), LIST_AND );
@@ -469,14 +469,23 @@
470470 array( 'afl_deleted' => null ), LIST_AND );
471471 $notDeletedCond = $db->makeList(
472472 array( $deletedZeroCond, $deletedNullCond ), LIST_OR );
473 -
 473+
474474 return $notDeletedCond;
475475 }
476476 }
477477
478478 class AbuseLogPager extends ReverseChronologicalPager {
479 - public $mForm, $mConds;
480479
 480+ /**
 481+ * @var HtmlForm
 482+ */
 483+ public $mForm;
 484+
 485+ /**
 486+ * @var array
 487+ */
 488+ public $mConds;
 489+
481490 function __construct( $form, $conds = array(), $details = false ) {
482491 $this->mForm = $form;
483492 $this->mConds = $conds;

Follow-up revisions

RevisionCommit summaryAuthorDate
r91431Followup r89617, r91428 call $pager->doQuery explicitally so we get a set res...reedy00:09, 5 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89617* (bug 28695) If there are no results for an abuse filter log, can you put "N...reedy23:46, 6 June 2011

Status & tagging log