r114396 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114395‎ | r114396 | r114397 >
Date:19:41, 21 March 2012
Author:catrope
Status:ok
Tags:
Comment:
Revert r111217 (unreviewed rev in AbuseFilter) and its dependencies r113585, r113587, r113588, r113589.

All of these revisions are tagged with 'gerritmigration' and will be resubmitted into Gerrit after the Gerrit switchover. See also http://lists.wikimedia.org/pipermail/wikitech-l/2012-March/059124.html
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.hooks.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.i18n.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.parser.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilter.php (modified) (history)
  • /trunk/extensions/AbuseFilter/AbuseFilterVariableHolder.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterView.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewDiff.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewRevert.php (modified) (history)
  • /trunk/extensions/AbuseFilter/api/ApiQueryAbuseLog.php (modified) (history)
  • /trunk/extensions/AbuseFilter/db_patches/patch-afl_action_id.sql (deleted) (history)
  • /trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php
@@ -111,10 +111,6 @@
112112 $this->getOutput()->addHTML( $output );
113113 }
114114
115 - /**
116 - * @param $id
117 - * @return mixed
118 - */
119115 function showHideForm( $id ) {
120116 if ( !$this->getUser()->isAllowed( 'abusefilter-hide-log' ) ) {
121117 $this->getOutput()->addWikiMsg( 'abusefilter-log-hide-forbidden' );
@@ -161,10 +157,6 @@
162158 $form->show();
163159 }
164160
165 - /**
166 - * @param $fields
167 - * @return bool
168 - */
169161 function saveHideForm( $fields ) {
170162 $logid = $this->getRequest()->getVal( 'hide' );
171163
@@ -231,10 +223,6 @@
232224 }
233225 }
234226
235 - /**
236 - * @param $id
237 - * @return mixed
238 - */
239227 function showDetails( $id ) {
240228 $out = $this->getOutput();
241229
@@ -264,7 +252,7 @@
265253 return;
266254 }
267255
268 - if ( $this->isHidden( $row ) && !self::canSeeHidden() ) {
 256+ if ( $row->afl_deleted && !self::canSeeHidden() ) {
269257 $out->addWikiMsg( 'abusefilter-log-details-hidden' );
270258 return;
271259 }
@@ -345,8 +333,6 @@
346334 }
347335
348336 /**
349 - * @param $filter_id null
350 - * @param $filter_hidden null
351337 * @return bool
352338 */
353339 static function canSeeDetails( $filter_id = null, $filter_hidden = null ) {
@@ -380,49 +366,25 @@
381367 return $wgUser->isAllowed( 'abusefilter-hidden-log' );
382368 }
383369
384 - /**
385 - * @param $row
386 - * @param $li bool
387 - * @return String
388 - */
389370 function formatRow( $row, $li = true ) {
390371 $user = $this->getUser();
 372+ $sk = $this->getSkin();
391373 $lang = $this->getLanguage();
392374
393375 $actionLinks = array();
394376
395377 $title = Title::makeTitle( $row->afl_namespace, $row->afl_title );
396378
397 - $diffLink = false;
398 -
399 - if ( self::isHidden($row) && ! $this->canSeeHidden() ) {
400 - return '';
401 - }
402 -
403379 if ( !$row->afl_wiki ) {
404 - $pageLink = Linker::link( $title );
405 - if ( $row->afl_rev_id ) {
406 - $diffLink = Linker::link( $title,
407 - wfMessage('abusefilter-log-diff')->parse(), array(),
408 - array( 'diff' => 'prev', 'oldid' => $row->afl_rev_id ) );
409 - }
 380+ $pageLink = $sk->link( $title );
410381 } else {
411382 $pageLink = WikiMap::makeForeignLink( $row->afl_wiki, $row->afl_title );
412 -
413 - if ( $row->afl_rev_id ) {
414 - $diffUrl = WikiMap::getForeignURL( $row->afl_wiki, $row->afl_title );
415 - $diffUrl = wfAppendQuery( $diffUrl,
416 - array( 'diff' => 'prev', 'oldid' => $row->afl_rev_id ) );
417 -
418 - $diffLink = Linker::makeExternalLink( $diffUrl,
419 - wfMessage('abusefilter-log-diff')->parse() );
420 - }
421383 }
422384
423385 if ( !$row->afl_wiki ) {
424386 // Local user
425 - $userLink = Linker::userLink( $row->afl_user, $row->afl_user_text ) .
426 - Linker::userToolLinks( $row->afl_user, $row->afl_user_text );
 387+ $userLink = $sk->userLink( $row->afl_user, $row->afl_user_text ) .
 388+ $sk->userToolLinks( $row->afl_user, $row->afl_user_text );
427389 } else {
428390 $userLink = WikiMap::foreignUserLink( $row->afl_wiki, $row->afl_user_text );
429391 $userLink .= ' (' . WikiMap::getWikiName( $row->afl_wiki ) . ')';
@@ -458,11 +420,11 @@
459421
460422 if ( self::canSeeDetails( $row->afl_filter, $filter_hidden ) ) {
461423 $examineTitle = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/log/' . $row->afl_id );
462 - $detailsLink = Linker::makeKnownLinkObj(
 424+ $detailsLink = $sk->makeKnownLinkObj(
463425 $this->getTitle($row->afl_id),
464426 wfMsg( 'abusefilter-log-detailslink' )
465427 );
466 - $examineLink = Linker::link(
 428+ $examineLink = $sk->link(
467429 $examineTitle,
468430 wfMsgExt( 'abusefilter-changeslist-examine', 'parseinline' ),
469431 array()
@@ -471,11 +433,8 @@
472434 $actionLinks[] = $detailsLink;
473435 $actionLinks[] = $examineLink;
474436
475 - if ($diffLink)
476 - $actionLinks[] = $diffLink;
477 -
478437 if ( $user->isAllowed( 'abusefilter-hide-log' ) ) {
479 - $hideLink = Linker::link(
 438+ $hideLink = $sk->link(
480439 $this->getTitle(),
481440 wfMsg( 'abusefilter-log-hidelink' ),
482441 array(),
@@ -492,11 +451,11 @@
493452 'Special:AbuseFilter/' . $globalIndex );
494453
495454 $linkText = wfMessage( 'abusefilter-log-detailedentry-global' )->numParams( $globalIndex )->escaped();
496 - $filterLink = Linker::makeExternalLink( $globalURL, $linkText );
 455+ $filterLink = $sk->makeExternalLink( $globalURL, $linkText );
497456 } else {
498457 $title = SpecialPage::getTitleFor( 'AbuseFilter', $row->afl_filter );
499458 $linkText = wfMessage( 'abusefilter-log-detailedentry-local' )->numParams( $row->afl_filter )->escaped();
500 - $filterLink = Linker::link( $title, $linkText );
 459+ $filterLink = $sk->link( $title, $linkText );
501460 }
502461 $description = wfMsgExt( 'abusefilter-log-detailedentry-meta',
503462 array( 'parseinline', 'replaceafter' ),
@@ -519,19 +478,16 @@
520479 $timestamp,
521480 $userLink,
522481 $row->afl_action,
523 - Linker::link( $title ),
 482+ $sk->link( $title ),
524483 $actions_taken,
525484 $parsed_comments
526485 )
527486 );
528487 }
529488
530 - if ( $this->isHidden($row) === true ) {
 489+ if ( $row->afl_deleted ) {
531490 $description .= ' '.
532491 wfMsgExt( 'abusefilter-log-hidden', 'parseinline' );
533 - } elseif ( $this->isHidden($row) === 'implicit' ) {
534 - $description .= ' '.
535 - wfMsgExt( 'abusefilter-log-hidden-implicit', 'parseinline' );
536492 }
537493
538494 return $li ? Xml::tags( 'li', null, $description ) : $description;
@@ -551,25 +507,6 @@
552508
553509 return $notDeletedCond;
554510 }
555 -
556 - /**
557 - * Given a log entry row, decides whether or not it can be viewed by the public.
558 - *
559 - * @param $row object The abuse_filter_log row object.
560 - *
561 - * @return Mixed true if the item is explicitly hidden, false if it is not.
562 - * The string 'implicit' if it is hidden because the corresponding revision is hidden.
563 - */
564 - public static function isHidden( $row ) {
565 - if ( $row->afl_rev_id ) {
566 - $revision = Revision::newFromId( $row->afl_rev_id );
567 - if ( $revision && $revision->getVisibility() != 0 ) {
568 - return 'implicit';
569 - }
570 - }
571 -
572 - return (bool)$row->afl_deleted;
573 - }
574511 }
575512
576513 class AbuseLogPager extends ReverseChronologicalPager {
@@ -584,11 +521,6 @@
585522 */
586523 public $mConds;
587524
588 - /**
589 - * @param $form
590 - * @param array $conds
591 - * @param bool $details
592 - */
593525 function __construct( $form, $conds = array(), $details = false ) {
594526 $this->mForm = $form;
595527 $this->mConds = $conds;
Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php
@@ -74,20 +74,11 @@
7575 var $type;
7676 var $data;
7777
78 - /**
79 - * @param string $type
80 - * @param null $val
81 - */
8278 public function __construct( $type = self::DNull, $val = null ) {
8379 $this->type = $type;
8480 $this->data = $val;
8581 }
8682
87 - /**
88 - * @param $var
89 - * @return AFPData
90 - * @throws AFPException
91 - */
9283 public static function newFromPHPVar( $var ) {
9384 if ( is_string( $var ) ) {
9485 return new AFPData( self::DString, $var );
@@ -112,18 +103,10 @@
113104 }
114105 }
115106
116 - /**
117 - * @return AFPData
118 - */
119107 public function dup() {
120108 return new AFPData( $this->type, $this->data );
121109 }
122110
123 - /**
124 - * @param $orig AFPData
125 - * @param $target
126 - * @return AFPData
127 - */
128111 public static function castTypes( $orig, $target ) {
129112 if ( $orig->type == $target ) {
130113 return $orig->dup();
@@ -137,7 +120,7 @@
138121 return new AFPData( self::DBool, (bool)count( $orig->data ) );
139122 }
140123 if ( $target == self::DFloat ) {
141 - return new AFPData( self::DFloat, floatval( count( $orig->data ) ) );
 124+ return new AFPData( self::DFloat, doubleval( count( $orig->data ) ) );
142125 }
143126 if ( $target == self::DInt ) {
144127 return new AFPData( self::DInt, intval( count( $orig->data ) ) );
@@ -155,7 +138,7 @@
156139 return new AFPData( self::DBool, (bool)$orig->data );
157140 }
158141 if ( $target == self::DFloat ) {
159 - return new AFPData( self::DFloat, floatval( $orig->data ) );
 142+ return new AFPData( self::DFloat, doubleval( $orig->data ) );
160143 }
161144 if ( $target == self::DInt ) {
162145 return new AFPData( self::DInt, intval( $orig->data ) );
@@ -168,28 +151,14 @@
169152 }
170153 }
171154
172 - /**
173 - * @param $value AFPData
174 - * @return AFPData
175 - */
176155 public static function boolInvert( $value ) {
177156 return new AFPData( self::DBool, !$value->toBool() );
178157 }
179158
180 - /**
181 - * @param $base AFPData
182 - * @param $exponent AFPData
183 - * @return AFPData
184 - */
185159 public static function pow( $base, $exponent ) {
186160 return new AFPData( self::DFloat, pow( $base->toFloat(), $exponent->toFloat() ) );
187161 }
188162
189 - /**
190 - * @param $a AFPData
191 - * @param $b AFPData
192 - * @return AFPData
193 - */
194163 public static function keywordIn( $a, $b ) {
195164 $a = $a->toString();
196165 $b = $b->toString();
@@ -201,11 +170,6 @@
202171 return new AFPData( self::DBool, in_string( $a, $b ) );
203172 }
204173
205 - /**
206 - * @param $a AFPData
207 - * @param $b AFPData
208 - * @return AFPData
209 - */
210174 public static function keywordContains( $a, $b ) {
211175 $a = $a->toString();
212176 $b = $b->toString();
@@ -217,11 +181,6 @@
218182 return new AFPData( self::DBool, in_string( $b, $a ) );
219183 }
220184
221 - /**
222 - * @param $value
223 - * @param $list
224 - * @return bool
225 - */
226185 public static function listContains( $value, $list ) {
227186 // Should use built-in PHP function somehow
228187 foreach ( $list->data as $item ) {
@@ -232,21 +191,11 @@
233192 return false;
234193 }
235194
236 - /**
237 - * @param $d1 AFPData
238 - * @param $d2 AFPData
239 - * @return bool
240 - */
241195 public static function equals( $d1, $d2 ) {
242196 return $d1->type != self::DList && $d2->type != self::DList &&
243197 $d1->toString() === $d2->toString();
244198 }
245199
246 - /**
247 - * @param $str AFPData
248 - * @param $pattern AFPData
249 - * @return AFPData
250 - */
251200 public static function keywordLike( $str, $pattern ) {
252201 $str = $str->toString();
253202 $pattern = $pattern->toString();
@@ -256,14 +205,6 @@
257206 return new AFPData( self::DBool, (bool)$result );
258207 }
259208
260 - /**
261 - * @param $str AFPData
262 - * @param $regex AFPData
263 - * @param $pos
264 - * @param $insensitive bool
265 - * @return AFPData
266 - * @throws Exception
267 - */
268209 public static function keywordRegex( $str, $regex, $pos, $insensitive = false ) {
269210 $str = $str->toString();
270211 $pattern = $regex->toString();
@@ -287,20 +228,10 @@
288229 return new AFPData( self::DBool, (bool)$result );
289230 }
290231
291 - /**
292 - * @param $str
293 - * @param $regex
294 - * @param $pos
295 - * @return AFPData
296 - */
297232 public static function keywordRegexInsensitive( $str, $regex, $pos ) {
298233 return self::keywordRegex( $str, $regex, $pos, true );
299234 }
300235
301 - /**
302 - * @param $data AFPData
303 - * @return AFPData
304 - */
305236 public static function unaryMinus( $data ) {
306237 if ( $data->type == self::DInt ) {
307238 return new AFPData( $data->type, - $data->toInt() );
@@ -309,13 +240,6 @@
310241 }
311242 }
312243
313 - /**
314 - * @param $a AFPData
315 - * @param $b AFPData
316 - * @param $op string
317 - * @return AFPData
318 - * @throws AFPException
319 - */
320244 public static function boolOp( $a, $b, $op ) {
321245 $a = $a->toBool();
322246 $b = $b->toBool();
@@ -331,13 +255,6 @@
332256 throw new AFPException( "Invalid boolean operation: {$op}" ); // Should never happen.
333257 }
334258
335 - /**
336 - * @param $a AFPData
337 - * @param $b AFPData
338 - * @param $op string
339 - * @return AFPData
340 - * @throws AFPException
341 - */
342259 public static function compareOp( $a, $b, $op ) {
343260 if ( $op == '==' || $op == '=' ) {
344261 return new AFPData( self::DBool, self::equals( $a, $b ) );
@@ -368,15 +285,6 @@
369286 throw new AFPException( "Invalid comparison operation: {$op}" ); // Should never happen
370287 }
371288
372 - /**
373 - * @param $a AFPData
374 - * @param $b AFPData
375 - * @param $op string
376 - * @param $pos
377 - * @return AFPData
378 - * @throws AFPUserVisibleException
379 - * @throws AFPException
380 - */
381289 public static function mulRel( $a, $b, $op, $pos ) {
382290 // Figure out the type.
383291 if ( $a->type == self::DFloat || $b->type == self::DFloat ||
@@ -407,17 +315,12 @@
408316 if ( $type == self::DInt ) {
409317 $data = intval( $data );
410318 } else {
411 - $data = floatval( $data );
 319+ $data = doubleval( $data );
412320 }
413321
414322 return new AFPData( $type, $data );
415323 }
416324
417 - /**
418 - * @param $a AFPData
419 - * @param $b AFPData
420 - * @return AFPData
421 - */
422325 public static function sum( $a, $b ) {
423326 if ( $a->type == self::DString || $b->type == self::DString ) {
424327 return new AFPData( self::DString, $a->toString() . $b->toString() );
@@ -428,11 +331,6 @@
429332 }
430333 }
431334
432 - /**
433 - * @param $a AFPData
434 - * @param $b AFPData
435 - * @return AFPData
436 - */
437335 public static function sub( $a, $b ) {
438336 return new AFPData( self::DFloat, $a->toFloat() - $b->toFloat() );
439337 }
@@ -440,40 +338,6 @@
441339 /** Convert shorteners */
442340
443341 /**
444 - * @throws MWException
445 - * @return mixed
446 - */
447 - public function toNative() {
448 - switch( $this->type ) {
449 - case self::DBool:
450 - return $this->toBool();
451 - break;
452 - case self::DString:
453 - return $this->toString();
454 - break;
455 - case self::DFloat:
456 - return $this->toFloat();
457 - break;
458 - case self::DInt:
459 - return $this->toInt();
460 - break;
461 - case self::DList:
462 - $input = $this->toList();
463 - $output = array();
464 - foreach( $input as $item ) {
465 - $output[] = $item->toNative();
466 - }
467 - return $output;
468 - break;
469 - case self::DNull:
470 - return null;
471 - break;
472 - default:
473 - throw new MWException( "Unknown type" );
474 - }
475 - }
476 -
477 - /**
478342 * @return bool
479343 */
480344 public function toBool() {
@@ -537,15 +401,6 @@
538402 $this->pos = $pos;
539403 }
540404
541 - /**
542 - * @param $errno
543 - * @param $errstr
544 - * @param $errfile
545 - * @param $errline
546 - * @param $context
547 - * @return bool
548 - * @throws AFPUserVisibleException
549 - */
550405 function handleError( $errno, $errstr, $errfile, $errline, $context ) {
551406 if ( error_reporting() == 0 ) {
552407 return true;
@@ -567,13 +422,8 @@
568423 }
569424
570425 class AbuseFilterParser {
571 - var $mParams, $mCode, $mTokens, $mPos, $mCur, $mShortCircuit, $mAllowShort, $mLen;
 426+ var $mParams, $mVars, $mCode, $mTokens, $mPos, $mCur, $mShortCircuit, $mAllowShort;
572427
573 - /**
574 - * @var AbuseFilterVariableHolder
575 - */
576 - var $mVars;
577 -
578428 // length,lcase,ccnorm,rmdoubles,specialratio,rmspecials,norm,count
579429 static $mFunctions = array(
580430 'lcase' => 'funcLc',
@@ -646,10 +496,6 @@
647497 $this->mAllowShort = true;
648498 }
649499
650 - /**
651 - * @param $filter
652 - * @return array|bool
653 - */
654500 public function checkSyntax( $filter ) {
655501 try {
656502 $origAS = $this->mAllowShort;
@@ -663,18 +509,11 @@
664510 return true;
665511 }
666512
667 - /**
668 - * @param $name
669 - * @param $value
670 - */
671513 public function setVar( $name, $value ) {
672514 $name = strtolower( $name );
673515 $this->mVars->setVar( $name, $value );
674516 }
675517
676 - /**
677 - * @param $vars
678 - */
679518 public function setVars( $vars ) {
680519 if ( is_array( $vars ) ) {
681520 foreach ( $vars as $name => $var ) {
@@ -685,9 +524,6 @@
686525 }
687526 }
688527
689 - /**
690 - * @return AFPToken
691 - */
692528 protected function move( ) {
693529 wfProfileIn( __METHOD__ );
694530 list( $val, $type, $code, $offset ) =
@@ -699,28 +535,17 @@
700536 return $this->mCur = $token;
701537 }
702538
703 - /**
704 - * getState() function allows parser state to be rollbacked to several tokens back
705 - * @return AFPParserState
706 - */
 539+ // getState() and setState() function allows parser state to be rollbacked to several tokens back
707540 protected function getState() {
708541 return new AFPParserState( $this->mCur, $this->mPos );
709542 }
710543
711 - /**
712 - * setState() function allows parser state to be rollbacked to several tokens back
713 - * @param AFPParserState $state
714 - */
715544 protected function setState( AFPParserState $state ) {
716545 $this->mCur = $state->token;
717546 $this->mPos = $state->pos;
718547 self::$lastHandledToken = $state->lastInput;
719548 }
720549
721 - /**
722 - * @return mixed
723 - * @throws AFPUserVisibleException
724 - */
725550 protected function skipOverBraces() {
726551 if ( !( $this->mCur->type == AFPToken::TBrace && $this->mCur->value == '(' ) || !$this->mShortCircuit ) {
727552 return;
@@ -743,26 +568,14 @@
744569 throw new AFPUserVisibleException( 'expectednotfound', $this->mCur->pos, array( ')' ) );
745570 }
746571
747 - /**
748 - * @param $code
749 - * @return bool
750 - */
751572 public function parse( $code ) {
752573 return $this->intEval( $code )->toBool();
753574 }
754575
755 - /**
756 - * @param $filter
757 - * @return string
758 - */
759576 public function evaluateExpression( $filter ) {
760577 return $this->intEval( $filter )->toString();
761578 }
762579
763 - /**
764 - * @param $code
765 - * @return AFPData
766 - */
767580 function intEval( $code ) {
768581 // Setup, resetting
769582 $this->mCode = $code;
@@ -775,11 +588,6 @@
776589 return $result;
777590 }
778591
779 - /**
780 - * @param $a
781 - * @param $b
782 - * @return int
783 - */
784592 static function lengthCompare( $a, $b ) {
785593 if ( strlen( $a ) == strlen( $b ) ) {
786594 return 0;
@@ -794,7 +602,6 @@
795603 * Handles unexpected characters after the expression
796604 *
797605 * @param $result
798 - * @throws AFPUserVisibleException
799606 */
800607 protected function doLevelEntry( &$result ) {
801608 $this->doLevelSemicolon( $result );
@@ -821,8 +628,6 @@
822629 * Handles multiple expressions
823630 *
824631 * @param $result
825 - * @throws AFPUserVisibleException
826 - * @return
827632 */
828633 protected function doLevelSet( &$result ) {
829634 if ( $this->mCur->type == AFPToken::TID ) {
@@ -886,10 +691,6 @@
887692 $this->doLevelConditions( $result );
888693 }
889694
890 - /**
891 - * @param $result
892 - * @throws AFPUserVisibleException
893 - */
894695 protected function doLevelConditions( &$result ) {
895696 if ( $this->mCur->type == AFPToken::TKeyword && $this->mCur->value == 'if' ) {
896697 $this->move();
@@ -1004,9 +805,6 @@
1005806 }
1006807 }
1007808
1008 - /**
1009 - * @param $result AFPData
1010 - */
1011809 protected function doLevelBoolOps( &$result ) {
1012810 $this->doLevelCompares( $result );
1013811 $ops = array( '&', '|', '^' );
@@ -1045,9 +843,6 @@
1046844 }
1047845 }
1048846
1049 - /**
1050 - * @param $result
1051 - */
1052847 protected function doLevelCompares( &$result ) {
1053848 AbuseFilter::triggerLimiter();
1054849 $this->doLevelSumRels( $result );
@@ -1063,9 +858,6 @@
1064859 }
1065860 }
1066861
1067 - /**
1068 - * @param $result
1069 - */
1070862 protected function doLevelSumRels( &$result ) {
1071863 $this->doLevelMulRels( $result );
1072864 wfProfileIn( __METHOD__ );
@@ -1085,9 +877,6 @@
1086878 wfProfileOut( __METHOD__ );
1087879 }
1088880
1089 - /**
1090 - * @param $result
1091 - */
1092881 protected function doLevelMulRels( &$result ) {
1093882 $this->doLevelPow( $result );
1094883 wfProfileIn( __METHOD__ );
@@ -1102,9 +891,6 @@
1103892 wfProfileOut( __METHOD__ );
1104893 }
1105894
1106 - /**
1107 - * @param $result
1108 - */
1109895 protected function doLevelPow( &$result ) {
1110896 $this->doLevelBoolInvert( $result );
1111897 wfProfileIn( __METHOD__ );
@@ -1117,9 +903,6 @@
1118904 wfProfileOut( __METHOD__ );
1119905 }
1120906
1121 - /**
1122 - * @param $result
1123 - */
1124907 protected function doLevelBoolInvert( &$result ) {
1125908 if ( $this->mCur->type == AFPToken::TOp && $this->mCur->value == '!' ) {
1126909 $this->move();
@@ -1132,9 +915,6 @@
1133916 }
1134917 }
1135918
1136 - /**
1137 - * @param $result
1138 - */
1139919 protected function doLevelSpecialWords( &$result ) {
1140920 $this->doLevelUnarys( $result );
1141921 $keyword = strtolower( $this->mCur->value );
@@ -1166,9 +946,6 @@
1167947 }
1168948 }
1169949
1170 - /**
1171 - * @param $result
1172 - */
1173950 protected function doLevelUnarys( &$result ) {
1174951 $op = $this->mCur->value;
1175952 if ( $this->mCur->type == AFPToken::TOp && ( $op == "+" || $op == "-" ) ) {
@@ -1184,10 +961,6 @@
1185962 }
1186963 }
1187964
1188 - /**
1189 - * @param $result
1190 - * @throws AFPUserVisibleException
1191 - */
1192965 protected function doLevelListElements( &$result ) {
1193966 $this->doLevelBraces( $result );
1194967 while ( $this->mCur->type == AFPToken::TSquareBracket && $this->mCur->value == '[' ) {
@@ -1211,10 +984,6 @@
1212985 }
1213986 }
1214987
1215 - /**
1216 - * @param $result
1217 - * @throws AFPUserVisibleException
1218 - */
1219988 protected function doLevelBraces( &$result ) {
1220989 if ( $this->mCur->type == AFPToken::TBrace && $this->mCur->value == '(' ) {
1221990 if ( $this->mShortCircuit ) {
@@ -1234,10 +1003,6 @@
12351004 }
12361005 }
12371006
1238 - /**
1239 - * @param $result
1240 - * @throws AFPUserVisibleException
1241 - */
12421007 protected function doLevelFunction( &$result ) {
12431008 if ( $this->mCur->type == AFPToken::TID && isset( self::$mFunctions[$this->mCur->value] ) ) {
12441009 wfProfileIn( __METHOD__ );
@@ -1306,11 +1071,6 @@
13071072 }
13081073 }
13091074
1310 - /**
1311 - * @param $result
1312 - * @throws AFPUserVisibleException
1313 - * @return AFPData
1314 - */
13151075 protected function doLevelAtom( &$result ) {
13161076 wfProfileIn( __METHOD__ );
13171077 $tok = $this->mCur->value;
@@ -1393,11 +1153,6 @@
13941154
13951155 /* End of levels */
13961156
1397 - /**
1398 - * @param $var
1399 - * @return AFPData
1400 - * @throws AFPUserVisibleException
1401 - */
14021157 protected function getVarValue( $var ) {
14031158 wfProfileIn( __METHOD__ );
14041159 $var = strtolower( $var );
@@ -1418,11 +1173,6 @@
14191174 }
14201175 }
14211176
1422 - /**
1423 - * @param $name
1424 - * @param $value
1425 - * @throws AFPUserVisibleException
1426 - */
14271177 protected function setUserVariable( $name, $value ) {
14281178 $builderValues = AbuseFilter::getBuilderValues();
14291179 if ( array_key_exists( $name, $builderValues['vars'] ) ) {
@@ -1431,13 +1181,6 @@
14321182 $this->mVars->setVar( $name, $value );
14331183 }
14341184
1435 - /**
1436 - * @param $code
1437 - * @param $offset
1438 - * @return array
1439 - * @throws AFPException
1440 - * @throws AFPUserVisibleException
1441 - */
14421185 static function nextToken( $code, $offset ) {
14431186 $tok = '';
14441187
@@ -1618,7 +1361,7 @@
16191362
16201363 return array(
16211364 $float
1622 - ? floatval( $num )
 1365+ ? doubleval( $num )
16231366 : intval( $num ),
16241367 $float
16251368 ? AFPToken::TFloat
@@ -1650,12 +1393,6 @@
16511394 }
16521395
16531396 // Built-in functions
1654 -
1655 - /**
1656 - * @param $args
1657 - * @return AFPData
1658 - * @throws AFPUserVisibleException
1659 - */
16601397 protected function funcLc( $args ) {
16611398 global $wgContLang;
16621399 if ( count( $args ) < 1 ) {
@@ -1669,11 +1406,6 @@
16701407 return new AFPData( AFPData::DString, $wgContLang->lc( $s ) );
16711408 }
16721409
1673 - /**
1674 - * @param $args
1675 - * @return AFPData
1676 - * @throws AFPUserVisibleException
1677 - */
16781410 protected function funcLen( $args ) {
16791411 if ( count( $args ) < 1 ) {
16801412 throw new AFPUserVisibleException(
@@ -1686,11 +1418,6 @@
16871419 return new AFPData( AFPData::DInt, mb_strlen( $s, 'utf-8' ) );
16881420 }
16891421
1690 - /**
1691 - * @param $args
1692 - * @return AFPData
1693 - * @throws AFPUserVisibleException
1694 - */
16951422 protected function funcSimpleNorm( $args ) {
16961423 if ( count( $args ) < 1 ) {
16971424 throw new AFPUserVisibleException(
@@ -1706,11 +1433,6 @@
17071434 return new AFPData( AFPData::DString, $s );
17081435 }
17091436
1710 - /**
1711 - * @param $args
1712 - * @return AFPData
1713 - * @throws AFPUserVisibleException
1714 - */
17151437 protected function funcSpecialRatio( $args ) {
17161438 if ( count( $args ) < 1 ) {
17171439 throw new AFPUserVisibleException(
@@ -1732,11 +1454,6 @@
17331455 return new AFPData( AFPData::DFloat, $val );
17341456 }
17351457
1736 - /**
1737 - * @param $args
1738 - * @return AFPData
1739 - * @throws AFPUserVisibleException
1740 - */
17411458 protected function funcCount( $args ) {
17421459 if ( count( $args ) < 1 ) {
17431460 throw new AFPUserVisibleException(
@@ -1767,12 +1484,6 @@
17681485 return new AFPData( AFPData::DInt, $count );
17691486 }
17701487
1771 - /**
1772 - * @param $args
1773 - * @return AFPData
1774 - * @throws AFPUserVisibleException
1775 - * @throws Exception
1776 - */
17771488 protected function funcRCount( $args ) {
17781489 if ( count( $args ) < 1 ) {
17791490 throw new AFPUserVisibleException(
@@ -1808,11 +1519,6 @@
18091520 return new AFPData( AFPData::DInt, $count );
18101521 }
18111522
1812 - /**
1813 - * @param $args
1814 - * @return AFPData
1815 - * @throws AFPUserVisibleException
1816 - */
18171523 protected function funcIPInRange( $args ) {
18181524 if ( count( $args ) < 2 ) {
18191525 throw new AFPUserVisibleException(
@@ -1830,11 +1536,6 @@
18311537 return new AFPData( AFPData::DBool, $result );
18321538 }
18331539
1834 - /**
1835 - * @param $args
1836 - * @return AFPData
1837 - * @throws AFPUserVisibleException
1838 - */
18391540 protected function funcCCNorm( $args ) {
18401541 if ( count( $args ) < 1 ) {
18411542 throw new AFPUserVisibleException(
@@ -1851,11 +1552,6 @@
18521553 return new AFPData( AFPData::DString, $s );
18531554 }
18541555
1855 - /**
1856 - * @param $args array
1857 - * @return AFPData
1858 - * @throws AFPUserVisibleException
1859 - */
18601556 protected function funcContainsAny( $args ) {
18611557 if ( count( $args ) < 2 ) {
18621558 throw new AFPUserVisibleException(
@@ -1892,10 +1588,6 @@
18931589 return new AFPData( AFPData::DBool, $ok );
18941590 }
18951591
1896 - /**
1897 - * @param $s
1898 - * @return mixed
1899 - */
19001592 protected function ccnorm( $s ) {
19011593 static $equivset = null;
19021594 static $replacementArray = null;
@@ -1909,35 +1601,20 @@
19101602 return $replacementArray->replace( $s );
19111603 }
19121604
1913 - /**
1914 - * @param $s string
1915 - * @return array|string
1916 - */
19171605 protected function rmspecials( $s ) {
1918 - return preg_replace( '/[^\p{L}\p{N}]/u', '', $s );
 1606+ $s = preg_replace( '/[^\p{L}\p{N}]/u', '', $s );
 1607+
 1608+ return $s;
19191609 }
19201610
1921 - /**
1922 - * @param $s string
1923 - * @return array|string
1924 - */
19251611 protected function rmdoubles( $s ) {
19261612 return preg_replace( '/(.)\1+/us', '\1', $s );
19271613 }
19281614
1929 - /**
1930 - * @param $s string
1931 - * @return array|string
1932 - */
19331615 protected function rmwhitespace( $s ) {
19341616 return preg_replace( '/\s+/u', '', $s );
19351617 }
19361618
1937 - /**
1938 - * @param $args array
1939 - * @return AFPData
1940 - * @throws AFPUserVisibleException
1941 - */
19421619 protected function funcRMSpecials( $args ) {
19431620 if ( count( $args ) < 1 ) {
19441621 throw new AFPUserVisibleException(
@@ -1953,11 +1630,6 @@
19541631 return new AFPData( AFPData::DString, $s );
19551632 }
19561633
1957 - /**
1958 - * @param $args array
1959 - * @return AFPData
1960 - * @throws AFPUserVisibleException
1961 - */
19621634 protected function funcRMWhitespace( $args ) {
19631635 if ( count( $args ) < 1 ) {
19641636 throw new AFPUserVisibleException(
@@ -1973,11 +1645,6 @@
19741646 return new AFPData( AFPData::DString, $s );
19751647 }
19761648
1977 - /**
1978 - * @param $args array
1979 - * @return AFPData
1980 - * @throws AFPUserVisibleException
1981 - */
19821649 protected function funcRMDoubles( $args ) {
19831650 if ( count( $args ) < 1 ) {
19841651 throw new AFPUserVisibleException(
@@ -1993,11 +1660,6 @@
19941661 return new AFPData( AFPData::DString, $s );
19951662 }
19961663
1997 - /**
1998 - * @param $args array
1999 - * @return AFPData
2000 - * @throws AFPUserVisibleException
2001 - */
20021664 protected function funcNorm( $args ) {
20031665 if ( count( $args ) < 1 ) {
20041666 throw new AFPUserVisibleException(
@@ -2016,11 +1678,6 @@
20171679 return new AFPData( AFPData::DString, $s );
20181680 }
20191681
2020 - /**
2021 - * @param $args array
2022 - * @return AFPData
2023 - * @throws AFPUserVisibleException
2024 - */
20251682 protected function funcSubstr( $args ) {
20261683 if ( count( $args ) < 2 ) {
20271684 throw new AFPUserVisibleException(
@@ -2044,11 +1701,6 @@
20451702 return new AFPData( AFPData::DString, $result );
20461703 }
20471704
2048 - /**
2049 - * @param $args array
2050 - * @return AFPData
2051 - * @throws AFPUserVisibleException
2052 - */
20531705 protected function funcStrPos( $args ) {
20541706 if ( count( $args ) < 2 ) {
20551707 throw new AFPUserVisibleException(
@@ -2075,11 +1727,6 @@
20761728 return new AFPData( AFPData::DInt, $result );
20771729 }
20781730
2079 - /**
2080 - * @param $args array
2081 - * @return AFPData
2082 - * @throws AFPUserVisibleException
2083 - */
20841731 protected function funcStrReplace( $args ) {
20851732 if ( count( $args ) < 3 ) {
20861733 throw new AFPUserVisibleException(
@@ -2096,11 +1743,6 @@
20971744 return new AFPData( AFPData::DString, str_replace( $search, $replace, $subject ) );
20981745 }
20991746
2100 - /**
2101 - * @param $args array
2102 - * @return AFPData
2103 - * @throws AFPUserVisibleException
2104 - */
21051747 protected function funcStrRegexEscape( $args ) {
21061748 if ( count( $args ) < 1 ) {
21071749 throw new AFPUserVisibleException( 'notenoughargs', $this->mCur->pos,
@@ -2113,11 +1755,6 @@
21141756 return new AFPData( AFPData::DString, preg_quote( $string ) );
21151757 }
21161758
2117 - /**
2118 - * @param $args array
2119 - * @return mixed
2120 - * @throws AFPUserVisibleException
2121 - */
21221759 protected function funcSetVar( $args ) {
21231760 if ( count( $args ) < 2 ) {
21241761 throw new AFPUserVisibleException(
@@ -2135,11 +1772,6 @@
21361773 return $value;
21371774 }
21381775
2139 - /**
2140 - * @param $args array
2141 - * @return AFPData
2142 - * @throws AFPUserVisibleException
2143 - */
21441776 protected function castString( $args ) {
21451777 if ( count( $args ) < 1 ) {
21461778 throw new AFPUserVisibleException( 'noparams', $this->mCur->pos, array( __METHOD__ ) );
@@ -2149,11 +1781,6 @@
21501782 return AFPData::castTypes( $val, AFPData::DString );
21511783 }
21521784
2153 - /**
2154 - * @param $args array
2155 - * @return AFPData
2156 - * @throws AFPUserVisibleException
2157 - */
21581785 protected function castInt( $args ) {
21591786 if ( count( $args ) < 1 ) {
21601787 throw new AFPUserVisibleException( 'noparams', $this->mCur->pos, array( __METHOD__ ) );
@@ -2163,11 +1790,6 @@
21641791 return AFPData::castTypes( $val, AFPData::DInt );
21651792 }
21661793
2167 - /**
2168 - * @param $args array
2169 - * @return AFPData
2170 - * @throws AFPUserVisibleException
2171 - */
21721794 protected function castFloat( $args ) {
21731795 if ( count( $args ) < 1 ) {
21741796 throw new AFPUserVisibleException( 'noparams', $this->mCur->pos, array( __METHOD__ ) );
@@ -2177,11 +1799,6 @@
21781800 return AFPData::castTypes( $val, AFPData::DFloat );
21791801 }
21801802
2181 - /**
2182 - * @param $args array
2183 - * @return AFPData
2184 - * @throws AFPUserVisibleException
2185 - */
21861803 protected function castBool( $args ) {
21871804 if ( count( $args ) < 1 ) {
21881805 throw new AFPUserVisibleException( 'noparams', $this->mCur->pos, array( __METHOD__ ) );
Index: trunk/extensions/AbuseFilter/AbuseFilter.php
@@ -78,7 +78,6 @@
7979 $wgHooks['ContributionsToolLinks'][] = 'AbuseFilterHooks::onContributionsToolLinks';
8080 $wgHooks['UploadVerification'][] = 'AbuseFilterHooks::onUploadVerification';
8181 $wgHooks['MakeGlobalVariablesScript'][] = 'AbuseFilterHooks::onMakeGlobalVariablesScript';
82 -$wgHooks['ArticleSaveComplete'][] = 'AbuseFilterHooks::onArticleSaveComplete';
8382
8483 $wgAvailableRights[] = 'abusefilter-modify';
8584 $wgAvailableRights[] = 'abusefilter-log-detail';
Index: trunk/extensions/AbuseFilter/db_patches/patch-afl_action_id.sql
@@ -1,10 +0,0 @@
2 -ALTER TABLE /*_*/abuse_filter_log
3 - ADD COLUMN afl_rev_id int unsigned;
4 -ALTER TABLE /*_*/abuse_filter_log
5 - ADD KEY (afl_rev_id);
6 -
7 -ALTER TABLE /*_*/abuse_filter_log
8 - ADD COLUMN afl_log_id int unsigned;
9 -ALTER TABLE /*_*/abuse_filter_log
10 - ADD KEY (afl_log_id);
\ No newline at end of file
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewDiff.php
@@ -94,7 +94,7 @@
9595 'history/' . $this->mFilter . '/item/' . $other['meta']['history_id'] );
9696 global $wgOut;
9797 $wgOut->redirect( $t->getFullURL() );
98 - return null;
 98+ return;
9999 }
100100
101101 } elseif ( $spec == 'next' && !in_array( $otherSpec, $dependentSpecs ) ) {
@@ -117,7 +117,7 @@
118118 'history/' . $this->mFilter . '/item/' . $other['meta']['history_id'] );
119119 global $wgOut;
120120 $wgOut->redirect( $t->getFullURL() );
121 - return null;
 121+ return;
122122 }
123123 }
124124
@@ -148,11 +148,6 @@
149149 );
150150 }
151151
152 - /**
153 - * @param $timestamp
154 - * @param $history_id
155 - * @return string
156 - */
157152 function formatVersionLink( $timestamp, $history_id ) {
158153 $filter = $this->mFilter;
159154 $text = $this->getLanguage()->timeanddate( $timestamp, true );
@@ -163,9 +158,6 @@
164159 return $link;
165160 }
166161
167 - /**
168 - * @return string
169 - */
170162 function formatDiff() {
171163 $oldVersion = $this->mOldVersion;
172164 $newVersion = $this->mNewVersion;
@@ -257,10 +249,6 @@
258250 return $html;
259251 }
260252
261 - /**
262 - * @param $actions
263 - * @return array
264 - */
265253 function stringifyActions( $actions ) {
266254 $lines = array();
267255
@@ -276,10 +264,6 @@
277265 return $lines;
278266 }
279267
280 - /**
281 - * @param $msg
282 - * @return String
283 - */
284268 function getHeaderRow( $msg ) {
285269 $html = wfMsgExt( $msg, 'parseinline' );
286270 $html = Xml::tags( 'th', array( 'colspan' => 3 ), $html );
@@ -288,13 +272,6 @@
289273 return $html;
290274 }
291275
292 - /**
293 - * @param $msg
294 - * @param $old
295 - * @param $new
296 - * @param string $format
297 - * @return string
298 - */
299276 function getSimpleRow( $msg, $old, $new, $format = 'wikitext' ) {
300277 $row = '';
301278
@@ -323,12 +300,6 @@
324301 return Xml::tags( 'tr', null, $row ) . "\n";
325302 }
326303
327 - /**
328 - * @param $msg
329 - * @param $old
330 - * @param $new
331 - * @return string
332 - */
333304 function getMultiLineRow( $msg, $old, $new ) {
334305 if ( !is_array( $old ) ) {
335306 $old = explode( "\n", preg_replace( "/\\\r\\\n?/", "\n", $old ) );
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterView.php
@@ -53,12 +53,6 @@
5454 }
5555
5656 class AbuseFilterChangesList extends OldChangesList {
57 -
58 - /**
59 - * @param $s
60 - * @param $rc
61 - * @param $classes array
62 - */
6357 public function insertExtra( &$s, &$rc, &$classes ) {
6458 $examineParams = empty( $rc->examineParams ) ? array() : $rc->examineParams;
6559
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php
@@ -118,6 +118,7 @@
119119 }
120120
121121 function formatValue( $name, $value ) {
 122+ $sk = $this->getSkin();
122123 $lang = $this->getLanguage();
123124
124125 $row = $this->mCurrentRow;
@@ -129,12 +130,12 @@
130131 case 'afh_timestamp':
131132 $title = SpecialPage::getTitleFor( 'AbuseFilter',
132133 'history/' . $row->afh_filter . '/item/' . $row->afh_id );
133 - $formatted = Linker::link( $title, $lang->timeanddate( $row->afh_timestamp, true ) );
 134+ $formatted = $sk->link( $title, $lang->timeanddate( $row->afh_timestamp, true ) );
134135 break;
135136 case 'afh_user_text':
136137 $formatted =
137 - Linker::userLink( $row->afh_user, $row->afh_user_text ) . ' ' .
138 - Linker::userToolLinks( $row->afh_user, $row->afh_user_text );
 138+ $sk->userLink( $row->afh_user, $row->afh_user_text ) . ' ' .
 139+ $sk->userToolLinks( $row->afh_user, $row->afh_user_text );
139140 break;
140141 case 'afh_public_comments':
141142 $formatted = $this->getOutput()->parse( $value );
@@ -157,12 +158,12 @@
158159 break;
159160 case 'afh_filter':
160161 $title = $this->mPage->getTitle( strval( $value ) );
161 - $formatted = Linker::link( $title, $value );
 162+ $formatted = $sk->link( $title, $value );
162163 break;
163164 case 'afh_id':
164165 $title = $this->mPage->getTitle(
165166 'history/' . $row->afh_filter . "/diff/prev/$value" );
166 - $formatted = Linker::link( $title, wfMsgExt( 'abusefilter-history-diff', 'parseinline' ) );
 167+ $formatted = $sk->link( $title, wfMsgExt( 'abusefilter-history-diff', 'parseinline' ) );
167168 break;
168169 default:
169170 $formatted = "Unable to format $name";
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
@@ -240,12 +240,6 @@
241241 }
242242 }
243243
244 - /**
245 - * @param $error
246 - * @param $filter
247 - * @param $history_id null
248 - * @return bool|String
249 - */
250244 function buildFilterEditor( $error, $filter, $history_id = null ) {
251245 if ( $filter === null ) {
252246 return false;
@@ -255,13 +249,14 @@
256250 $out = $this->getOutput();
257251 $lang = $this->getLanguage();
258252 $user = $this->getUser();
 253+ $sk = $this->getSkin();
259254
260255 // Load from request OR database.
261256 list( $row, $actions ) = $this->loadRequest( $filter, $history_id );
262257
263258 if ( !$row ) {
264259 $out->addWikiMsg( 'abusefilter-edit-badfilter' );
265 - $out->addHTML( Linker::link( $this->getTitle(), wfMsg( 'abusefilter-return' ) ) );
 260+ $out->addHTML( $sk->link( $this->getTitle(), wfMsg( 'abusefilter-return' ) ) );
266261 return;
267262 }
268263
@@ -306,7 +301,7 @@
307302 $count_display = wfMsgExt( 'abusefilter-hitcount', array( 'parseinline' ),
308303 $lang->formatNum( $count )
309304 );
310 - $hitCount = Linker::makeKnownLinkObj(
 305+ $hitCount = $sk->makeKnownLinkObj(
311306 SpecialPage::getTitleFor( 'AbuseLog' ),
312307 $count_display,
313308 'wpSearchFilter=' . $row->af_id
@@ -392,7 +387,7 @@
393388 if ( $filter != 'new' && $user->isAllowed( 'abusefilter-revert' ) ) {
394389 $tools .= Xml::tags(
395390 'p', null,
396 - Linker::link(
 391+ $sk->link(
397392 $this->getTitle( 'revert/' . $filter ),
398393 wfMsg( 'abusefilter-edit-revert' )
399394 )
@@ -403,15 +398,15 @@
404399 // Test link
405400 $tools .= Xml::tags(
406401 'p', null,
407 - Linker::link(
 402+ $sk->link(
408403 $this->getTitle( "test/$filter" ),
409404 wfMsgExt( 'abusefilter-edit-test-link', 'parseinline' )
410405 )
411406 );
412407 // Last modification details
413408 $userLink =
414 - Linker::userLink( $row->af_user, $row->af_user_text ) .
415 - Linker::userToolLinks( $row->af_user, $row->af_user_text );
 409+ $sk->userLink( $row->af_user, $row->af_user_text ) .
 410+ $sk->userToolLinks( $row->af_user, $row->af_user_text );
416411 $userName = $row->af_user_text;
417412 $fields['abusefilter-edit-lastmod'] =
418413 wfMsgExt(
@@ -426,7 +421,7 @@
427422 );
428423 $history_display = wfMsgExt( 'abusefilter-edit-viewhistory', array( 'parseinline' ) );
429424 $fields['abusefilter-edit-history'] =
430 - Linker::makeKnownLinkObj( $this->getTitle( 'history/' . $filter ), $history_display );
 425+ $sk->makeKnownLinkObj( $this->getTitle( 'history/' . $filter ), $history_display );
431426 }
432427
433428 // Add export
@@ -468,11 +463,6 @@
469464 return $output;
470465 }
471466
472 - /**
473 - * @param $row
474 - * @param $actions
475 - * @return string
476 - */
477467 function buildConsequenceEditor( $row, $actions ) {
478468 global $wgAbuseFilterAvailableActions;
479469
@@ -491,12 +481,6 @@
492482 return $output;
493483 }
494484
495 - /**
496 - * @param $action
497 - * @param $set
498 - * @param $parameters
499 - * @return string
500 - */
501485 function buildConsequenceSelector( $action, $set, $parameters ) {
502486 global $wgAbuseFilterAvailableActions;
503487
@@ -657,10 +641,6 @@
658642 }
659643 }
660644
661 - /**
662 - * @param $warnMsg
663 - * @return string
664 - */
665645 function getExistingSelector( $warnMsg ) {
666646 $existingSelector = new XmlSelect(
667647 'wpFilterWarnMessage',
@@ -698,10 +678,6 @@
699679 return $existingSelector->getHTML();
700680 }
701681
702 - /**
703 - * @param $id
704 - * @return array|null
705 - */
706682 function loadFilterData( $id ) {
707683 if ( $id == 'new' ) {
708684 $obj = new stdClass;
@@ -761,11 +737,6 @@
762738 return array( $row, $actions );
763739 }
764740
765 - /**
766 - * @param $filter
767 - * @param null $history_id
768 - * @return array|null
769 - */
770741 function loadRequest( $filter, $history_id = null ) {
771742 static $row = null;
772743 static $actions = null;
@@ -866,10 +837,6 @@
867838 return array( $row, $actions );
868839 }
869840
870 - /**
871 - * @param $id
872 - * @return array
873 - */
874841 function loadHistoryItem( $id ) {
875842 $dbr = wfGetDB( DB_SLAVE );
876843
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewRevert.php
@@ -9,6 +9,7 @@
1010
1111 $user = $this->getUser();
1212 $out = $this->getOutput();
 13+ $sk = $this->getSkin();
1314
1415 if ( !$user->isAllowed( 'abusefilter-revert' ) ) {
1516 throw new PermissionsError( 'abusefilter-revert' );
@@ -66,11 +67,11 @@
6768 array( 'parseinline', 'replaceafter' ),
6869 array(
6970 $lang->timeanddate( $result['timestamp'], true ),
70 - Linker::userLink( $result['userid'], $result['user'] ),
 71+ $sk->userLink( $result['userid'], $result['user'] ),
7172 $result['action'],
72 - Linker::link( $result['title'] ),
 73+ $sk->link( $result['title'] ),
7374 $lang->commaList( $displayActions ),
74 - Linker::link(
 75+ $sk->link(
7576 SpecialPage::getTitleFor( 'AbuseLog' ),
7677 wfMsgNoTrans( 'abusefilter-log-detailslink' ),
7778 array(),
@@ -89,7 +90,7 @@
9091 Html::hidden( 'title', $this->getTitle( "revert/$filter" )->getPrefixedText() ) .
9192 Html::hidden( 'wpPeriodStart', $this->origPeriodStart ) .
9293 Html::hidden( 'wpPeriodEnd', $this->origPeriodEnd ) .
93 - Xml::inputLabel(
 94+ Html::inputLabel(
9495 wfMsg( 'abusefilter-revert-reasonfield' ),
9596 'wpReason', 'wpReason', 45
9697 ) .
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -120,10 +120,6 @@
121121 );
122122 public static $editboxName = null;
123123
124 - /**
125 - * @param $context IContextSource
126 - * @param $pageType
127 - */
128124 public static function addNavigationLinks( IContextSource $context, $pageType ) {
129125 $linkDefs = array(
130126 'home' => 'Special:AbuseFilter',
@@ -163,7 +159,7 @@
164160 if ( $name == $pageType ) {
165161 $links[] = Xml::tags( 'strong', null, $msg );
166162 } else {
167 - $links[] = Linker::link( $title, $msg );
 163+ $links[] = $context->getSkin()->link( $title, $msg );
168164 }
169165 }
170166
@@ -196,9 +192,6 @@
197193 return $vars;
198194 }
199195
200 - /**
201 - * @return array
202 - */
203196 public static function getBuilderValues() {
204197 static $realValues = null;
205198
@@ -212,10 +205,6 @@
213206 return $realValues;
214207 }
215208
216 - /**
217 - * @param $filter
218 - * @return bool
219 - */
220209 public static function filterHidden( $filter ) {
221210 $globalIndex = self::decodeGlobalName( $filter );
222211 if ( $globalIndex ) {
@@ -237,10 +226,6 @@
238227 return $hidden ? true : false;
239228 }
240229
241 - /**
242 - * @param $val int
243 - * @throws MWException
244 - */
245230 public static function triggerLimiter( $val = 1 ) {
246231 self::$condCount += $val;
247232
@@ -257,8 +242,9 @@
258243 }
259244
260245 /**
261 - * @param $title Title
262 - * @param $prefix
 246+ * @static
 247+ * @param $title Title
 248+ * @param $prefix
263249 * @return AbuseFilterVariableHolder
264250 */
265251 public static function generateTitleVars( $title, $prefix ) {
@@ -294,10 +280,6 @@
295281 return $vars;
296282 }
297283
298 - /**
299 - * @param $filter
300 - * @return mixed
301 - */
302284 public static function checkSyntax( $filter ) {
303285 global $wgAbuseFilterParserClass;
304286
@@ -306,11 +288,6 @@
307289 return $parser->checkSyntax( $filter );
308290 }
309291
310 - /**
311 - * @param $expr
312 - * @param array $vars
313 - * @return string
314 - */
315292 public static function evaluateExpression( $expr, $vars = array() ) {
316293 global $wgAbuseFilterParserClass;
317294
@@ -325,20 +302,8 @@
326303 return $parser->evaluateExpression( $expr );
327304 }
328305
329 - /**
330 - * @param $conds
331 - * @param $vars
332 - * @param $ignoreError bool
333 - * @param $keepVars string
334 - * @return bool
335 - * @throws Exception
336 - */
337 - public static function checkConditions(
338 - $conds,
339 - $vars,
340 - $ignoreError = true,
341 - $keepVars = 'resetvars'
342 - ) {
 306+ public static function checkConditions( $conds, $vars, $ignoreError = true,
 307+ $keepVars = 'resetvars' ) {
343308 global $wgAbuseFilterParserClass;
344309
345310 static $parser;
@@ -423,14 +388,6 @@
424389 return $filter_matched;
425390 }
426391
427 - /**
428 - * @static
429 - * @param $row
430 - * @param $vars
431 - * @param $profile bool
432 - * @param $prefix string
433 - * @return bool
434 - */
435392 public static function checkFilter( $row, $vars, $profile = false, $prefix = '' ) {
436393 $filterID = $prefix . $row->af_id;
437394
@@ -444,12 +401,8 @@
445402
446403 // Check conditions...
447404 $pattern = trim( $row->af_pattern );
448 - if ( self::checkConditions(
449 - $pattern,
450 - $vars,
451 - true /* ignore errors */,
452 - 'keepvars'
453 - ) ) {
 405+ if ( self::checkConditions( $pattern, $vars, true /* ignore errors */,
 406+ 'keepvars' ) ) {
454407 // Record match.
455408 $result = true;
456409 } else {
@@ -470,9 +423,6 @@
471424 return $result;
472425 }
473426
474 - /**
475 - * @param $filter
476 - */
477427 public static function resetFilterProfile( $filter ) {
478428 global $wgMemc;
479429 $countKey = wfMemcKey( 'abusefilter', 'profile', $filter, 'count' );
@@ -482,11 +432,6 @@
483433 $wgMemc->delete( $totalKey );
484434 }
485435
486 - /**
487 - * @param $filter
488 - * @param $time
489 - * @param $conds
490 - */
491436 public static function recordProfilingResult( $filter, $time, $conds ) {
492437 global $wgMemc;
493438
@@ -509,10 +454,6 @@
510455 }
511456 }
512457
513 - /**
514 - * @param $filter
515 - * @return array
516 - */
517458 public static function getFilterProfile( $filter ) {
518459 global $wgMemc;
519460
@@ -542,7 +483,7 @@
543484 *
544485 * @param $filter string
545486 *
546 - * @return string|bool
 487+ * @return string|false
547488 */
548489 public static function decodeGlobalName( $filter ) {
549490 if ( strpos( $filter, 'global-' ) == 0 ) {
@@ -552,10 +493,6 @@
553494 return false;
554495 }
555496
556 - /**
557 - * @param $filters array
558 - * @return array
559 - */
560497 public static function getConsequencesForFilters( $filters ) {
561498 $globalFilters = array();
562499 $localFilters = array();
@@ -591,12 +528,6 @@
592529 return $consequences;
593530 }
594531
595 - /**
596 - * @param $dbr DatabaseBase
597 - * @param $filters array
598 - * @param $prefix string
599 - * @return array
600 - */
601532 public static function loadConsequencesFromDB( $dbr, $filters, $prefix = '' ) {
602533 $actionsByFilter = array();
603534 foreach ( $filters as $filter ) {
@@ -731,11 +662,6 @@
732663 return array( $actionsTaken, implode( "\n", $messages ) );
733664 }
734665
735 - /**
736 - * @param $vars AbuseFilterVariableHolder
737 - * @param $title
738 - * @return bool
739 - */
740666 public static function filterAction( $vars, $title ) {
741667 global $wgUser, $wgTitle;
742668
@@ -756,10 +682,8 @@
757683
758684 $filter_matched = self::checkAllFilters( $vars );
759685
760 - $matched_filters = array_keys( array_filter( $filter_matched ) );
761 -
762686 // Short-cut any remaining code if no filters were hit.
763 - if ( count( $matched_filters ) == 0 ) {
 687+ if ( count( array_filter( $filter_matched ) ) == 0 ) {
764688 wfProfileOut( __METHOD__ );
765689 return true;
766690 }
@@ -767,7 +691,7 @@
768692 wfProfileIn( __METHOD__ . '-block' );
769693
770694 list( $actions_taken, $error_msg ) = self::executeFilterActions(
771 - $matched_filters, $title, $vars );
 695+ array_keys( array_filter( $filter_matched ) ), $title, $vars );
772696
773697 $action = $vars->getVar( 'ACTION' )->toString();
774698
@@ -797,13 +721,6 @@
798722 return $error_msg;
799723 }
800724
801 - /**
802 - * @param $actions_taken
803 - * @param $log_template
804 - * @param $action
805 - * @param $vars AbuseFilterVariableHolder
806 - * @return mixed
807 - */
808725 public static function addLogEntries( $actions_taken, $log_template, $action, $vars ) {
809726 wfProfileIn( __METHOD__ );
810727 $dbw = wfGetDB( DB_MASTER );
@@ -866,11 +783,7 @@
867784 // Increment trigger counter
868785 $wgMemc->incr( self::filterMatchesKey() );
869786
870 - $local_log_ids = array();
871 - foreach( $log_rows as $row ) {
872 - $dbw->insert( 'abuse_filter_log', $row, __METHOD__ );
873 - $local_log_ids[] = $dbw->insertId();
874 - }
 787+ $dbw->insert( 'abuse_filter_log', $log_rows, __METHOD__ );
875788
876789 if ( count( $logged_local_filters ) ) {
877790 // Update hit-counter.
@@ -881,8 +794,6 @@
882795 );
883796 }
884797
885 - $global_log_ids = array();
886 -
887798 // Global stuff
888799 if ( count( $logged_global_filters ) ) {
889800 $vars->computeDBVars();
@@ -895,9 +806,7 @@
896807 global $wgAbuseFilterCentralDB;
897808 $fdb = wfGetDB( DB_MASTER, array(), $wgAbuseFilterCentralDB );
898809
899 - foreach( $central_log_rows as $row ) {
900 - $fdb->insert( 'abuse_filter_log', $row, __METHOD__ );
901 - }
 810+ $fdb->insert( 'abuse_filter_log', $central_log_rows, __METHOD__ );
902811
903812 $fdb->update( 'abuse_filter',
904813 array( 'af_hit_count=af_hit_count+1' ),
@@ -906,9 +815,6 @@
907816 );
908817 }
909818
910 - $vars->setVar( 'global_log_ids', $global_log_ids );
911 - $vars->setVar( 'local_log_ids', $local_log_ids );
912 -
913819 // Check for emergency disabling.
914820 $total = $wgMemc->get( AbuseFilter::filterUsedKey() );
915821 self::checkEmergencyDisable( $logged_local_filters, $total );
@@ -990,7 +896,7 @@
991897 *
992898 * @param $stored_dump
993899 *
994 - * @return object|AbuseFilterVariableHolder
 900+ * @return object
995901 */
996902 public static function loadVarDump( $stored_dump ) {
997903 wfProfileIn( __METHOD__ );
@@ -1034,14 +940,6 @@
1035941 return $obj;
1036942 }
1037943
1038 - /**
1039 - * @param $action string
1040 - * @param $parameters array
1041 - * @param $title Title
1042 - * @param $vars AbuseFilterVariableHolder
1043 - * @param $rule_desc
1044 - * @return string
1045 - */
1046944 public static function takeConsequenceAction( $action, $parameters, $title,
1047945 $vars, $rule_desc )
1048946 {
@@ -1201,14 +1099,6 @@
12021100 return $display;
12031101 }
12041102
1205 - /**
1206 - * @param $throttleId
1207 - * @param $types
1208 - * @param $title
1209 - * @param $rateCount
1210 - * @param $ratePeriod
1211 - * @return bool
1212 - */
12131103 public static function isThrottled( $throttleId, $types, $title, $rateCount, $ratePeriod ) {
12141104 global $wgMemc;
12151105
@@ -1237,11 +1127,6 @@
12381128 return false; // NOT THROTTLED
12391129 }
12401130
1241 - /**
1242 - * @param $type
1243 - * @param $title Title
1244 - * @return Int|string
1245 - */
12461131 public static function throttleIdentifier( $type, $title ) {
12471132 global $wgUser;
12481133
@@ -1272,12 +1157,6 @@
12731158 return $identifier;
12741159 }
12751160
1276 - /**
1277 - * @param $throttleId
1278 - * @param $type
1279 - * @param $title Title
1280 - * @return String
1281 - */
12821161 public static function throttleKey( $throttleId, $type, $title ) {
12831162 $types = explode( ',', $type );
12841163
@@ -1292,17 +1171,10 @@
12931172 return wfMemcKey( 'abusefilter', 'throttle', $throttleId, $type, $identifier );
12941173 }
12951174
1296 - /**
1297 - * @param $user User
1298 - * @return String
1299 - */
13001175 public static function autoPromoteBlockKey( $user ) {
13011176 return wfMemcKey( 'abusefilter', 'block-autopromote', $user->getId() );
13021177 }
13031178
1304 - /**
1305 - * @param $filters
1306 - */
13071179 public static function recordStats( $filters ) {
13081180 global $wgAbuseFilterConditionLimit, $wgMemc;
13091181
@@ -1341,10 +1213,6 @@
13421214 wfProfileOut( __METHOD__ );
13431215 }
13441216
1345 - /**
1346 - * @param $filters
1347 - * @param $total
1348 - */
13491217 public static function checkEmergencyDisable( $filters, $total ) {
13501218 global $wgAbuseFilterEmergencyDisableThreshold, $wgAbuseFilterEmergencyDisableCount,
13511219 $wgAbuseFilterEmergencyDisableAge, $wgMemc;
@@ -1383,31 +1251,18 @@
13841252 }
13851253 }
13861254
1387 - /**
1388 - * @return String
1389 - */
13901255 public static function filterLimitReachedKey() {
13911256 return wfMemcKey( 'abusefilter', 'stats', 'overflow' );
13921257 }
13931258
1394 - /**
1395 - * @return String
1396 - */
13971259 public static function filterUsedKey() {
13981260 return wfMemcKey( 'abusefilter', 'stats', 'total' );
13991261 }
14001262
1401 - /**
1402 - * @param $filter
1403 - * @return String
1404 - */
14051263 public static function filterMatchesKey( $filter = null ) {
14061264 return wfMemcKey( 'abusefilter', 'stats', 'matches', $filter );
14071265 }
14081266
1409 - /**
1410 - * @return User
1411 - */
14121267 public static function getFilterUser() {
14131268 $user = User::newFromName( wfMsgForContent( 'abusefilter-blocker' ) );
14141269 $user->load();
@@ -1442,7 +1297,6 @@
14431298 * @param $textName String
14441299 * @param $addResultDiv Boolean
14451300 * @param $canEdit Boolean
1446 - * @return string
14471301 */
14481302 static function buildEditBox( $rules, $textName = 'wpFilterRules', $addResultDiv = true,
14491303 $canEdit = true ) {
@@ -1567,10 +1421,6 @@
15681422 return array_unique( $differences );
15691423 }
15701424
1571 - /**
1572 - * @param $row
1573 - * @return array
1574 - */
15751425 static function translateFromHistory( $row ) {
15761426 # Translate into an abuse_filter row with some black magic.
15771427 # This is ever so slightly evil!
@@ -1606,20 +1456,12 @@
16071457 return array( $af_row, $actions_output );
16081458 }
16091459
1610 - /**
1611 - * @param $action string
1612 - * @return String
1613 - */
16141460 static function getActionDisplay( $action ) {
16151461 $display = wfMsg( "abusefilter-action-$action" );
16161462 $display = wfEmptyMsg( "abusefilter-action-$action", $display ) ? $action : $display;
16171463 return $display;
16181464 }
16191465
1620 - /**
1621 - * @param $row
1622 - * @return AbuseFilterVariableHolder|null
1623 - */
16241466 public static function getVarsFromRCRow( $row ) {
16251467 if ( $row->rc_this_oldid ) {
16261468 // It's an edit.
@@ -1639,10 +1481,6 @@
16401482 return $vars;
16411483 }
16421484
1643 - /**
1644 - * @param $row
1645 - * @return AbuseFilterVariableHolder
1646 - */
16471485 public static function getCreateVarsFromRCRow( $row ) {
16481486 $vars = new AbuseFilterVariableHolder;
16491487
@@ -1659,10 +1497,6 @@
16601498 return $vars;
16611499 }
16621500
1663 - /**
1664 - * @param $row
1665 - * @return AbuseFilterVariableHolder
1666 - */
16671501 public static function getEditVarsFromRCRow( $row ) {
16681502 $vars = new AbuseFilterVariableHolder;
16691503 $title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
@@ -1696,10 +1530,6 @@
16971531 return $vars;
16981532 }
16991533
1700 - /**
1701 - * @param $row
1702 - * @return AbuseFilterVariableHolder
1703 - */
17041534 public static function getMoveVarsFromRCRow( $row ) {
17051535 $vars = new AbuseFilterVariableHolder;
17061536
@@ -1729,8 +1559,8 @@
17301560 }
17311561
17321562 /**
1733 - * @param $title Title
1734 - * @param $article Array
 1563+ * @static
 1564+ * @param $title Title
17351565 * @return AbuseFilterVariableHolder
17361566 */
17371567 public static function getEditVars( $title, $article = null ) {
@@ -1789,10 +1619,6 @@
17901620 return $vars;
17911621 }
17921622
1793 - /**
1794 - * @param $vars AbuseFilterVariableHolder
1795 - * @return string
1796 - */
17971623 public static function buildVarDumpTable( $vars ) {
17981624 // Export all values
17991625 if ( $vars instanceof AbuseFilterVariableHolder ) {
@@ -1846,32 +1672,20 @@
18471673 return $output;
18481674 }
18491675
1850 - /**
1851 - * @param $page
1852 - * @param $type
1853 - * @param $title Title
1854 - * @param $sk Skin
1855 - * @param $args array
1856 - * @return String
1857 - */
18581676 static function modifyActionText( $page, $type, $title, $sk, $args ) {
18591677 list( $history_id, $filter_id ) = $args;
18601678
1861 - $filter_link = Linker::link( $title );
 1679+ $filter_link = $sk ? $sk->link( $title ) : $title->getCanonicalURL();
18621680
18631681 $details_title = SpecialPage::getTitleFor( 'AbuseFilter', "history/$filter_id/diff/prev/$history_id" );
18641682 $details_text = wfMsgExt( 'abusefilter-log-detailslink', 'parseinline' );
1865 - $details_link = Linker::link( $details_title, $details_text );
 1683+ $details_link =
 1684+ $sk ? $sk->link( $details_title, $details_text ) : $details_title->getCanonicalURL();
18661685
18671686 return wfMsgExt( 'abusefilter-log-entry-modify',
18681687 array( 'parseinline', 'replaceafter' ), array( $filter_link, $details_link ) );
18691688 }
18701689
1871 - /**
1872 - * @param $action
1873 - * @param $parameters
1874 - * @return String
1875 - */
18761690 static function formatAction( $action, $parameters ) {
18771691 global $wgLang;
18781692 if ( count( $parameters ) == 0 ) {
@@ -1884,10 +1698,6 @@
18851699 return $displayAction;
18861700 }
18871701
1888 - /**
1889 - * @param $value array
1890 - * @return string
1891 - */
18921702 static function formatFlags( $value ) {
18931703 global $wgLang;
18941704 $flags = array_filter( explode( ',', $value ) );
@@ -1898,9 +1708,6 @@
18991709 return $wgLang->commaList( $flags_display );
19001710 }
19011711
1902 - /**
1903 - * @param $data string
1904 - */
19051712 static function sendToUDP( $data ) {
19061713 global $wgAbuseFilterUDPPrefix, $wgAbuseFilterUDPAddress, $wgAbuseFilterUDPPort;
19071714
@@ -1912,15 +1719,11 @@
19131720 );
19141721 }
19151722
1916 - /**
1917 - * @param $filterID
1918 - * @return bool|mixed|string
1919 - */
19201723 static function getGlobalFilterDescription( $filterID ) {
19211724 global $wgAbuseFilterCentralDB;
19221725
19231726 if ( !$wgAbuseFilterCentralDB ) {
1924 - return '';
 1727+ return;
19251728 }
19261729
19271730 $fdb = wfGetDB( DB_SLAVE, array(), $wgAbuseFilterCentralDB );
Index: trunk/extensions/AbuseFilter/AbuseFilterVariableHolder.php
@@ -3,10 +3,6 @@
44 var $mVars = array();
55 static $varBlacklist = array( 'context' );
66
7 - /**
8 - * @param $variable
9 - * @param $datum
10 - */
117 function setVar( $variable, $datum ) {
128 $variable = strtolower( $variable );
139 if ( !( $datum instanceof AFPData || $datum instanceof AFComputedVariable ) ) {
@@ -16,20 +12,11 @@
1713 $this->mVars[$variable] = $datum;
1814 }
1915
20 - /**
21 - * @param $variable
22 - * @param $method
23 - * @param $parameters
24 - */
2516 function setLazyLoadVar( $variable, $method, $parameters ) {
2617 $placeholder = new AFComputedVariable( $method, $parameters );
2718 $this->setVar( $variable, $placeholder );
2819 }
2920
30 - /**
31 - * @param $variable
32 - * @return AFPData
33 - */
3421 function getVar( $variable ) {
3522 $variable = strtolower( $variable );
3623 if ( isset( $this->mVars[$variable] ) ) {
@@ -45,9 +32,6 @@
4633 }
4734 }
4835
49 - /**
50 - * @return AbuseFilterVariableHolder
51 - */
5236 static function merge() {
5337 $newHolder = new AbuseFilterVariableHolder;
5438
@@ -58,10 +42,6 @@
5943 return $newHolder;
6044 }
6145
62 - /**
63 - * @param $addHolder
64 - * @throws MWException
65 - */
6646 function addHolder( $addHolder ) {
6747 if ( !is_object( $addHolder ) ) {
6848 throw new MWException( 'Invalid argument to AbuseFilterVariableHolder::addHolder' );
@@ -74,9 +54,6 @@
7555 $this->setVar( 'context', 'stored' );
7656 }
7757
78 - /**
79 - * @return array
80 - */
8158 function exportAllVars() {
8259 $allVarNames = array_keys( $this->mVars );
8360 $exported = array();
@@ -90,10 +67,6 @@
9168 return $exported;
9269 }
9370
94 - /**
95 - * @param $var
96 - * @return bool
97 - */
9871 function varIsSet( $var ) {
9972 return array_key_exists( $var, $this->mVars );
10073 }
@@ -129,10 +102,6 @@
130103 static $userCache = array();
131104 static $articleCache = array();
132105
133 - /**
134 - * @param $method
135 - * @param $parameters
136 - */
137106 function __construct( $method, $parameters ) {
138107 $this->mMethod = $method;
139108 $this->mParameters = $parameters;
@@ -150,7 +119,7 @@
151120 function parseNonEditWikitext( $wikitext, $article ) {
152121 static $cache = array();
153122
154 - $cacheKey = md5( $wikitext ) . ':' . $article->getTitle()->getPrefixedText();
 123+ $cacheKey = md5( $wikitext ) . ':' . $article->mTitle->getPrefixedText();
155124
156125 if ( isset( $cache[$cacheKey] ) ) {
157126 return $cache[$cacheKey];
@@ -166,10 +135,6 @@
167136 return $edit;
168137 }
169138
170 - /**
171 - * @param $username string
172 - * @return User
173 - */
174139 static function userObjectFromName( $username ) {
175140 if ( isset( self::$userCache[$username] ) ) {
176141 return self::$userCache[$username];
@@ -195,11 +160,6 @@
196161 return $user;
197162 }
198163
199 - /**
200 - * @param $namespace
201 - * @param $title Title
202 - * @return Article
203 - */
204164 static function articleFromTitle( $namespace, $title ) {
205165 if ( isset( self::$articleCache["$namespace:$title"] ) ) {
206166 return self::$articleCache["$namespace:$title"];
@@ -217,10 +177,6 @@
218178 return self::$articleCache["$namespace:$title"];
219179 }
220180
221 - /**
222 - * @param $article Article
223 - * @return array
224 - */
225181 static function getLinksFromDB( $article ) {
226182 // Stolen from ConfirmEdit
227183 $id = $article->getId();
@@ -242,12 +198,6 @@
243199 return $links;
244200 }
245201
246 - /**
247 - * @param $vars AbuseFilterVariableHolder
248 - * @return AFPData|array|int|mixed|null|string
249 - * @throws MWException
250 - * @throws AFPException
251 - */
252202 function compute( $vars ) {
253203 $parameters = $this->mParameters;
254204 $result = null;
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php
@@ -91,7 +91,6 @@
9292 'abusefilter-log-detailedentry-global' => 'global filter $1',
9393 'abusefilter-log-detailedentry-local' => 'filter $1',
9494 'abusefilter-log-detailslink' => 'details',
95 - 'abusefilter-log-diff' => 'diff',
9695 'abusefilter-log-hidelink' => 'adjust visibility',
9796 'abusefilter-log-details-legend' => 'Details for log entry $1',
9897 'abusefilter-log-details-var' => 'Variable',
@@ -104,7 +103,7 @@
105104 'abusefilter-log-linkoncontribs' => 'abuse log',
106105 'abusefilter-log-linkoncontribs-text' => 'Abuse log for this user',
107106 'abusefilter-log-hidden' => '(entry hidden)',
108 - 'abusefilter-log-hidden-implicit' => '(hidden because revision has been deleted)',
 107+ 'abusefilter-log-hide' => 'hide or unhide', // @todo FIXME: Message unused?
109108 'abusefilter-log-cannot-see-details' => 'You do not have permission to see details of this entry.',
110109 'abusefilter-log-details-hidden' => 'You cannot view the details for this entry because it is hidden from public view.',
111110
Index: trunk/extensions/AbuseFilter/api/ApiQueryAbuseLog.php
@@ -73,7 +73,6 @@
7474 $this->addFieldsIf( 'afl_var_dump', $fld_details );
7575 $this->addFieldsIf( 'afl_actions', $fld_result );
7676 $this->addFieldsIf( 'afl_deleted', $fld_hidden );
77 - $this->addFields( 'afl_rev_id' );
7877
7978 if ( $fld_filter ) {
8079 $this->addTables( 'abuse_filter' );
@@ -111,11 +110,6 @@
112111 $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->afl_timestamp ) );
113112 break;
114113 }
115 - if ( SpecialAbuseLog::isHidden($row) &&
116 - !SpecialAbuseLog::canSeeHidden( $user )
117 - ) {
118 - continue;
119 - }
120114 $entry = array();
121115 if ( $fld_ids ) {
122116 $entry['id'] = intval( $row->afl_id );
@@ -153,10 +147,7 @@
154148 }
155149
156150 if ( $fld_hidden ) {
157 - $val = SpecialAbuseLog::isHidden($row);
158 - if ( $val ) {
159 - $entry['hidden'] = $val;
160 - }
 151+ $entry['hidden'] = $row->afl_deleted;
161152 }
162153
163154 if ( $entry ) {
Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php
@@ -4,11 +4,6 @@
55 }
66
77 class AbuseFilterHooks {
8 -
9 - /**
10 - * @var AbuseFilterVariableHolder
11 - */
12 - static $successful_action_vars = false;
138 // So far, all of the error message out-params for these hooks accept HTML.
149 // Hooray!
1510
@@ -16,8 +11,8 @@
1712 * Entry points for MediaWiki hook 'EditFilterMerged'
1813 *
1914 * @param $editor EditPage instance (object)
20 - * @param $text string Content of the edit box
21 - * @param &$error string Error message to return
 15+ * @param $text Content of the edit box
 16+ * @param &$error Error message to return
2217 * @param $summary Edit summary for page
2318 * @return bool
2419 */
@@ -25,8 +20,6 @@
2621 // Load vars
2722 $vars = new AbuseFilterVariableHolder;
2823
29 - self::$successful_action_vars = false;
30 -
3124 // Check for null edits.
3225 $oldtext = '';
3326
@@ -48,9 +41,9 @@
4942
5043 global $wgUser;
5144 $vars->addHolder( AbuseFilter::generateUserVars( $wgUser ) );
52 - $vars->addHolder( AbuseFilter::generateTitleVars( $title , 'article' ) );
53 - $vars->setVar( 'action', 'edit' );
54 - $vars->setVar( 'summary', $summary );
 45+ $vars->addHolder( AbuseFilter::generateTitleVars( $title , 'ARTICLE' ) );
 46+ $vars->setVar( 'ACTION', 'edit' );
 47+ $vars->setVar( 'SUMMARY', $summary );
5548 $vars->setVar( 'minor_edit', $editor->minoredit );
5649
5750 $vars->setVar( 'old_wikitext', $oldtext );
@@ -66,77 +59,9 @@
6760 $editor->showEditForm();
6861 return false;
6962 }
70 -
71 - self::$successful_action_vars = $vars;
72 -
7363 return true;
7464 }
7565
76 - /**
77 - * @param $article Article
78 - * @param $user User
79 - * @param $text string
80 - * @param $summary string
81 - * @param $minoredit bool
82 - * @param $watchthis bool
83 - * @param $sectionanchor
84 - * @param $flags
85 - * @param $revision Revision
86 - * @return bool
87 - */
88 - public static function onArticleSaveComplete(
89 - &$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor,
90 - &$flags, $revision
91 - ) {
92 - if ( ! self::$successful_action_vars ) {
93 - return true;
94 - }
95 -
96 - $vars = self::$successful_action_vars;
97 -
98 - if ( $vars->getVar('article_prefixedtext')->toString() !==
99 - $article->getTitle()->getPrefixedText()
100 - ) {
101 - return true;
102 - }
103 -
104 - if ( $vars->getVar('local_log_ids') ) {
105 - // Now actually do our storage
106 - $log_ids = $vars->getVar('local_log_ids')->toNative();
107 - $dbw = wfGetDB( DB_MASTER );
108 -
109 - if ( count($log_ids) ) {
110 - $dbw->update( 'abuse_filter_log',
111 - array( 'afl_rev_id' => $revision->getId() ),
112 - array( 'afl_id' => $log_ids ),
113 - __METHOD__
114 - );
115 - }
116 - }
117 -
118 - if ( $vars->getVar('global_log_ids') ) {
119 - $log_ids = $vars->getVar('global_log_ids')->toNative();
120 -
121 - global $wgAbuseFilterCentralDB;
122 - $dbw = wfGetDB( DB_MASTER, array(), $wgAbuseFilterCentralDB );
123 -
124 - if ( count($log_ids) ) {
125 - $dbw->update( 'abuse_filter_log',
126 - array( 'afl_rev_id' => $revision->getId() ),
127 - array( 'afl_id' => $log_ids, 'afl_wiki' => wfWikiId() ),
128 - __METHOD__
129 - );
130 - }
131 - }
132 -
133 - return true;
134 - }
135 -
136 - /**
137 - * @param $user
138 - * @param $promote
139 - * @return bool
140 - */
14166 public static function onGetAutoPromoteGroups( $user, &$promote ) {
14267 global $wgMemc;
14368
@@ -149,14 +74,6 @@
15075 return true;
15176 }
15277
153 - /**
154 - * @param $oldTitle Title
155 - * @param $newTitle Title
156 - * @param $user User
157 - * @param $error
158 - * @param $reason
159 - * @return bool
160 - */
16178 public static function onAbortMove( $oldTitle, $newTitle, $user, &$error, $reason ) {
16279 $vars = new AbuseFilterVariableHolder;
16380
@@ -178,34 +95,22 @@
17996 return $filter_result == '' || $filter_result === true;
18097 }
18198
182 - /**
183 - * @param $article Article
184 - * @param $user User
185 - * @param $reason string
186 - * @param $error
187 - * @return bool
188 - */
18999 public static function onArticleDelete( &$article, &$user, &$reason, &$error ) {
190100 $vars = new AbuseFilterVariableHolder;
191101
192102 global $wgUser;
193103 $vars->addHolder( AbuseFilter::generateUserVars( $wgUser ) );
194 - $vars->addHolder( AbuseFilter::generateTitleVars( $article->getTitle(), 'ARTICLE' ) );
 104+ $vars->addHolder( AbuseFilter::generateTitleVars( $article->mTitle, 'ARTICLE' ) );
195105 $vars->setVar( 'SUMMARY', $reason );
196106 $vars->setVar( 'ACTION', 'delete' );
197107
198 - $filter_result = AbuseFilter::filterAction( $vars, $article->getTitle() );
 108+ $filter_result = AbuseFilter::filterAction( $vars, $article->mTitle );
199109
200110 $error = $filter_result;
201111
202112 return $filter_result == '' || $filter_result === true;
203113 }
204114
205 - /**
206 - * @param $user User
207 - * @param $message
208 - * @return bool
209 - */
210115 public static function onAbortNewAccount( $user, &$message ) {
211116 if ( $user->getName() == wfMsgForContent( 'abusefilter-blocker' ) ) {
212117 $message = wfMsg( 'abusefilter-accountreserved' );
@@ -230,14 +135,10 @@
231136 return $filter_result == '' || $filter_result === true;
232137 }
233138
234 - /**
235 - * @param $recentChange RecentChange
236 - * @return bool
237 - */
238139 public static function onRecentChangeSave( $recentChange ) {
239140 $title = Title::makeTitle(
240 - $recentChange->getAttribute( 'rc_namespace' ),
241 - $recentChange->getAttribute( 'rc_title' )
 141+ $recentChange->mAttribs['rc_namespace'],
 142+ $recentChange->mAttribs['rc_title']
242143 );
243144 $action = $recentChange->mAttribs['rc_log_type'] ?
244145 $recentChange->mAttribs['rc_log_type'] : 'edit';
@@ -259,10 +160,6 @@
260161 return true;
261162 }
262163
263 - /**
264 - * @param $emptyTags array
265 - * @return bool
266 - */
267164 public static function onListDefinedTags( &$emptyTags ) {
268165 # This is a pretty awful hack.
269166 $dbr = wfGetDB( DB_SLAVE );
@@ -287,7 +184,6 @@
288185
289186 /**
290187 * @param $updater DatabaseUpdater
291 - * @throws MWException
292188 * @return bool
293189 */
294190 public static function onLoadExtensionSchemaUpdates( $updater = null ) {
@@ -305,7 +201,6 @@
306202 $updater->addExtensionUpdate( array( 'addField', 'abuse_filter', 'af_deleted', "$dir/db_patches/patch-af_deleted.sql", true ) );
307203 $updater->addExtensionUpdate( array( 'addField', 'abuse_filter', 'af_actions', "$dir/db_patches/patch-af_actions.sql", true ) );
308204 $updater->addExtensionUpdate( array( 'addField', 'abuse_filter', 'af_global', "$dir/db_patches/patch-global_filters.sql", true ) );
309 - $updater->addExtensionUpdate( array( 'addField', 'abuse_filter_log', 'afl_rev_id', "$dir/db_patches/patch-afl_action_id.sql", true ) );
310205 if ( $updater->getDB()->getType() == 'mysql' ) {
311206 $updater->addExtensionUpdate( array( 'addIndex', 'abuse_filter_log', 'filter_timestamp', "$dir/db_patches/patch-fix-indexes.sql", true ) );
312207 } else {
@@ -353,16 +248,11 @@
354249 }
355250 }
356251
357 - /**
358 - * @param $id
359 - * @param $nt Title
360 - * @param $tools
361 - * @return bool
362 - */
363252 public static function onContributionsToolLinks( $id, $nt, &$tools ) {
364253 global $wgUser;
365254 if ( $wgUser->isAllowed( 'abusefilter-log' ) ) {
366 - $tools[] = Linker::link(
 255+ $sk = $wgUser->getSkin();
 256+ $tools[] = $sk->link(
367257 SpecialPage::getTitleFor( 'AbuseLog' ),
368258 wfMsg( 'abusefilter-log-linkoncontribs' ),
369259 array( 'title' =>
@@ -373,12 +263,6 @@
374264 return true;
375265 }
376266
377 - /**
378 - * @param $saveName
379 - * @param $tempName
380 - * @param $error
381 - * @return bool
382 - */
383267 public static function onUploadVerification( $saveName, $tempName, &$error ) {
384268 $vars = new AbuseFilterVariableHolder;
385269

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111217AbuseFilter: Resolve bugs 18374, 28633....werdna23:41, 10 February 2012
r113585Documentation...reedy20:32, 11 March 2012
r113587A LOT of function level documentationreedy20:40, 11 March 2012
r113588More documentation stubs...reedy20:51, 11 March 2012
r113589Few more types top flesh out the previous revisionsreedy21:01, 11 March 2012

Status & tagging log