r51040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51039‎ | r51040 | r51041 >
Date:01:47, 27 May 2009
Author:aaron
Status:ok
Tags:
Comment:
Added $wgCheckUserForceSummary and removed some code duplication from r50638
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser.php (modified) (history)
  • /trunk/extensions/CheckUser/CheckUser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/CheckUser_body.php
@@ -92,6 +92,8 @@
9393 if( $wgRequest->wasPosted() ) {
9494 if( $wgRequest->getVal('action') === 'block' ) {
9595 $this->doMassUserBlock( $users, $blockreason, $tag, $talkTag );
 96+ } else if( !$this->checkReason($reason) ) {
 97+ $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
9698 } else if( $checktype=='subuserips' ) {
9799 $this->doUserIPsRequest( $name, $reason, $period );
98100 } else if( $xff && $checktype=='subipedits' ) {
@@ -288,6 +290,11 @@
289291 }
290292 return wfMsgExt('checkuser-nomatch','parse');
291293 }
 294+
 295+ protected function checkReason( $reason ) {
 296+ global $wgCheckUserForceSummary;
 297+ return ( !$wgCheckUserForceSummary || strlen($reason) );
 298+ }
292299
293300 /**
294301 * @param string $ip
@@ -318,12 +325,7 @@
319326 $wgOut->addHTML( $s );
320327 return;
321328 }
322 -
323 - # Demand that a reason be given
324 - if( !$reason ) {
325 - $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
326 - return;
327 - }
 329+
328330 # Record check...
329331 if( !$this->addLogEntry( 'userips', 'user', $user, $reason, $user_id ) ) {
330332 $wgOut->addHTML( '<p>'.wfMsgHtml('checkuser-log-fail').'</p>' );
@@ -445,11 +447,6 @@
446448 if( $xfor ) {
447449 $logType .= '-xff';
448450 }
449 - # Demand that a reason be given
450 - if( !$reason ) {
451 - $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
452 - return;
453 - }
454451 # Record check...
455452 if( !$this->addLogEntry( $logType, 'ip', $ip, $reason ) ) {
456453 $wgOut->addWikiMsg( 'checkuser-log-fail' );
@@ -594,11 +591,6 @@
595592 return;
596593 }
597594
598 - # Demand that a reason be given
599 - if( !$reason ) {
600 - $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
601 - return;
602 - }
603595 # Record check...
604596 if( !$this->addLogEntry( 'useredits', 'user', $user, $reason, $user_id ) ) {
605597 $wgOut->addHTML( '<p>'.wfMsgHtml('checkuser-log-fail').'</p>' );
@@ -717,11 +709,6 @@
718710 if( $xfor ) {
719711 $logType .= '-xff';
720712 }
721 - # Demand that a reason be given
722 - if( !$reason ) {
723 - $wgOut->addWikiText( wfMsgExt('checkuser-noreason',array('parsemag')) );
724 - return;
725 - }
726713 # Log the check...
727714 if( !$this->addLogEntry( $logType, 'ip', $ip, $reason ) ) {
728715 $wgOut->addHTML( '<p>'.wfMsgHtml('checkuser-log-fail').'</p>' );
Index: trunk/extensions/CheckUser/CheckUser.php
@@ -33,6 +33,8 @@
3434 # Mass block limits
3535 $wgCheckUserMaxBlocks = 200;
3636
 37+$wgCheckUserForceSummary = false;
 38+
3739 $wgCheckUserStyleVersion = 4;
3840
3941 # Recent changes data hook

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r50638bug 18613 Make filling in the "reason" field for CheckUser checks compulsoryaaron18:04, 15 May 2009

Status & tagging log