Index: trunk/extensions/AbuseFilter/AbuseFilter.parser.php |
— | — | @@ -335,18 +335,31 @@ |
336 | 336 | } |
337 | 337 | |
338 | 338 | /** Convert shorteners */ |
| 339 | + |
| 340 | + /** |
| 341 | + * @return bool |
| 342 | + */ |
339 | 343 | public function toBool() { |
340 | 344 | return self::castTypes( $this, self::DBool )->data; |
341 | 345 | } |
342 | 346 | |
| 347 | + /** |
| 348 | + * @return string |
| 349 | + */ |
343 | 350 | public function toString() { |
344 | 351 | return self::castTypes( $this, self::DString )->data; |
345 | 352 | } |
346 | 353 | |
| 354 | + /** |
| 355 | + * @return float |
| 356 | + */ |
347 | 357 | public function toFloat() { |
348 | 358 | return self::castTypes( $this, self::DFloat )->data; |
349 | 359 | } |
350 | 360 | |
| 361 | + /** |
| 362 | + * @return int |
| 363 | + */ |
351 | 364 | public function toInt() { |
352 | 365 | return self::castTypes( $this, self::DInt )->data; |
353 | 366 | } |
— | — | @@ -557,7 +570,11 @@ |
558 | 571 | |
559 | 572 | /* Levels */ |
560 | 573 | |
561 | | - /** Handles unexpected characters after the expression */ |
| 574 | + /** |
| 575 | + * Handles unexpected characters after the expression |
| 576 | + * |
| 577 | + * @param $result |
| 578 | + */ |
562 | 579 | protected function doLevelEntry( &$result ) { |
563 | 580 | $this->doLevelSemicolon( $result ); |
564 | 581 | |
— | — | @@ -566,7 +583,10 @@ |
567 | 584 | } |
568 | 585 | } |
569 | 586 | |
570 | | - /** Handles multiple expressions */ |
| 587 | + /** |
| 588 | + * Handles multiple expressions |
| 589 | + * @param $result |
| 590 | + */ |
571 | 591 | protected function doLevelSemicolon( &$result ) { |
572 | 592 | do { |
573 | 593 | $this->move(); |
— | — | @@ -576,7 +596,11 @@ |
577 | 597 | } while ( $this->mCur->type == AFPToken::TStatementSeparator ); |
578 | 598 | } |
579 | 599 | |
580 | | - /** Handles multiple expressions */ |
| 600 | + /** |
| 601 | + * Handles multiple expressions |
| 602 | + * |
| 603 | + * @param $result |
| 604 | + */ |
581 | 605 | protected function doLevelSet( &$result ) { |
582 | 606 | if ( $this->mCur->type == AFPToken::TID ) { |
583 | 607 | $varname = $this->mCur->value; |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterView.php |
— | — | @@ -18,6 +18,9 @@ |
19 | 19 | |
20 | 20 | abstract function show(); |
21 | 21 | |
| 22 | + /** |
| 23 | + * @return bool |
| 24 | + */ |
22 | 25 | function canEdit() { |
23 | 26 | global $wgUser; |
24 | 27 | static $canEdit = null; |
— | — | @@ -29,6 +32,9 @@ |
30 | 33 | return $canEdit; |
31 | 34 | } |
32 | 35 | |
| 36 | + /** |
| 37 | + * @return bool |
| 38 | + */ |
33 | 39 | function canViewPrivate() { |
34 | 40 | global $wgUser; |
35 | 41 | static $canView = null; |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php |
— | — | @@ -77,6 +77,12 @@ |
78 | 78 | } |
79 | 79 | |
80 | 80 | class AbuseFilterHistoryPager extends TablePager { |
| 81 | + |
| 82 | + /** |
| 83 | + * @param $filter |
| 84 | + * @param $page Article |
| 85 | + * @param $user User |
| 86 | + */ |
81 | 87 | function __construct( $filter, $page, $user ) { |
82 | 88 | $this->mFilter = $filter; |
83 | 89 | $this->mPage = $page; |
— | — | @@ -256,6 +262,8 @@ |
257 | 263 | /** |
258 | 264 | * Title used for self-links. Override this if you want to be able to |
259 | 265 | * use a title other than $wgTitle |
| 266 | + * |
| 267 | + * @return Title |
260 | 268 | */ |
261 | 269 | function getTitle() { |
262 | 270 | return $this->mPage->getTitle( 'history/' . $this->mFilter ); |
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php |
— | — | @@ -410,7 +410,13 @@ |
411 | 411 | return $result; |
412 | 412 | } |
413 | 413 | |
414 | | - /** Returns an associative array of filters which were tripped */ |
| 414 | + /** |
| 415 | + * Returns an associative array of filters which were tripped |
| 416 | + * |
| 417 | + * @param $vars array |
| 418 | + * |
| 419 | + * @return array |
| 420 | + */ |
415 | 421 | public static function checkAllFilters( $vars ) { |
416 | 422 | // Fetch from the database. |
417 | 423 | wfProfileIn( __METHOD__ ); |
— | — | @@ -548,7 +554,13 @@ |
549 | 555 | return array( $timeProfile, $condProfile ); |
550 | 556 | } |
551 | 557 | |
552 | | - /** Utility function to decode global-$index to $index. Returns false if not global */ |
| 558 | + /** |
| 559 | + * Utility function to decode global-$index to $index. Returns false if not global |
| 560 | + * |
| 561 | + * @param $filter string |
| 562 | + * |
| 563 | + * @return string|false |
| 564 | + */ |
553 | 565 | public static function decodeGlobalName( $filter ) { |
554 | 566 | if ( strpos( $filter, 'global-' ) == 0 ) { |
555 | 567 | return substr( $filter, strlen( 'global-' ) ); |
— | — | @@ -628,7 +640,14 @@ |
629 | 641 | return $actionsByFilter; |
630 | 642 | } |
631 | 643 | |
632 | | - /** Returns an array [ list of actions taken by filter, error message to display, if any ] */ |
| 644 | + /** |
| 645 | + * Returns an array [ list of actions taken by filter, error message to display, if any ] |
| 646 | + * |
| 647 | + * @param $filters array |
| 648 | + * @param $title Title |
| 649 | + * @param $vars array |
| 650 | + * @return array |
| 651 | + */ |
633 | 652 | public static function executeFilterActions( $filters, $title, $vars ) { |
634 | 653 | wfProfileIn( __METHOD__ ); |
635 | 654 | static $blockingActions = array( |
— | — | @@ -885,6 +904,11 @@ |
886 | 905 | /** |
887 | 906 | * Store a var dump to External Storage or the text table |
888 | 907 | * Some of this code is stolen from Revision::insertOn and friends |
| 908 | + * |
| 909 | + * @param $vars array |
| 910 | + * @param $global bool |
| 911 | + * |
| 912 | + * @return int |
889 | 913 | */ |
890 | 914 | public static function storeVarDump( $vars, $global = false ) { |
891 | 915 | wfProfileIn( __METHOD__ ); |
— | — | @@ -946,6 +970,10 @@ |
947 | 971 | /** |
948 | 972 | * Retrieve a var dump from External Storage or the text table |
949 | 973 | * Some of this code is stolen from Revision::loadText et al |
| 974 | + * |
| 975 | + * @param $stored_dump |
| 976 | + * |
| 977 | + * @return object |
950 | 978 | */ |
951 | 979 | public static function loadVarDump( $stored_dump ) { |
952 | 980 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1187,10 +1215,8 @@ |
1188 | 1216 | break; |
1189 | 1217 | case 'site': |
1190 | 1218 | return 1; |
1191 | | - break; |
1192 | 1219 | case 'page': |
1193 | 1220 | return $title->getPrefixedText(); |
1194 | | - break; |
1195 | 1221 | } |
1196 | 1222 | |
1197 | 1223 | return $identifier; |
— | — | @@ -1414,6 +1440,11 @@ |
1415 | 1441 | /** |
1416 | 1442 | * Each version is expected to be an array( $row, $actions ) |
1417 | 1443 | * Returns an array of fields that are different. |
| 1444 | + * |
| 1445 | + * @param $version_1 |
| 1446 | + * @param $version_2 |
| 1447 | + * |
| 1448 | + * @return array |
1418 | 1449 | */ |
1419 | 1450 | static function compareVersions( $version_1, $version_2 ) { |
1420 | 1451 | $compareFields = array( |
Index: trunk/extensions/AbuseFilter/AbuseFilterVariableHolder.php |
— | — | @@ -107,7 +107,15 @@ |
108 | 108 | $this->mParameters = $parameters; |
109 | 109 | } |
110 | 110 | |
111 | | - /** It's like Article::prepareTextForEdit, but not for editing (old wikitext usually) */ |
| 111 | + /** |
| 112 | + * It's like Article::prepareTextForEdit, but not for editing (old wikitext usually) |
| 113 | + * |
| 114 | + * |
| 115 | + * @param $wikitext String |
| 116 | + * @param $article Article |
| 117 | + * |
| 118 | + * @return object |
| 119 | + */ |
112 | 120 | function parseNonEditWikitext( $wikitext, $article ) { |
113 | 121 | static $cache = array(); |
114 | 122 | |
— | — | @@ -121,7 +129,7 @@ |
122 | 130 | $edit = (object)array(); |
123 | 131 | $options = new ParserOptions; |
124 | 132 | $options->setTidy( true ); |
125 | | - $edit->output = $wgParser->parse( $wikitext, $article->mTitle, $options ); |
| 133 | + $edit->output = $wgParser->parse( $wikitext, $article->getTitle(), $options ); |
126 | 134 | $cache[$cacheKey] = $edit; |
127 | 135 | |
128 | 136 | return $edit; |
Index: trunk/extensions/AbuseFilter/AbuseFilter.hooks.php |
— | — | @@ -6,6 +6,14 @@ |
7 | 7 | class AbuseFilterHooks { |
8 | 8 | // So far, all of the error message out-params for these hooks accept HTML. |
9 | 9 | // Hooray! |
| 10 | + |
| 11 | + /** |
| 12 | + * @param $editor |
| 13 | + * @param $text |
| 14 | + * @param $error |
| 15 | + * @param $summary |
| 16 | + * @return bool |
| 17 | + */ |
10 | 18 | public static function onEditFilterMerged( $editor, $text, &$error, $summary ) { |
11 | 19 | // Load vars |
12 | 20 | $vars = new AbuseFilterVariableHolder; |
— | — | @@ -198,11 +206,11 @@ |
199 | 207 | $wgExtPGNewFields[] = array( 'abuse_filter', 'af_actions', "TEXT NOT NULL DEFAULT ''" ); |
200 | 208 | $wgExtPGNewFields[] = array( 'abuse_filter', 'af_deleted', 'SMALLINT NOT NULL DEFAULT 0' ); |
201 | 209 | $wgExtPGNewFields[] = array( 'abuse_filter', 'af_global', 'SMALLINT NOT NULL DEFAULT 0' ); |
202 | | - |
| 210 | + |
203 | 211 | $wgExtPGNewFields[] = array( 'abuse_filter_log', 'afl_wiki', 'TEXT' ); |
204 | 212 | $wgExtPGNewFields[] = array( 'abuse_filter_log', 'afl_deleted', 'SMALLINT' ); |
205 | 213 | $wgExtPGAlteredFields[] = array( 'abuse_filter_log', 'afl_filter', 'TEXT' ); |
206 | | - |
| 214 | + |
207 | 215 | $wgExtNewIndexes[] = array( 'abuse_filter_log', 'abuse_filter_log_ip', "(afl_ip)" ); |
208 | 216 | } |
209 | 217 | } else { |